mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
Fix loading our app state (#40401)
Yea this is dumb. Cant have private setters when json deserializing. closes #40399
This commit is contained in:
@@ -21,7 +21,7 @@ public partial class AppStateModel : ObservableObject
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// STATE HERE
|
// STATE HERE
|
||||||
public RecentCommandsManager RecentCommands { get; private set; } = new();
|
public RecentCommandsManager RecentCommands { get; set; } = new();
|
||||||
|
|
||||||
// END SETTINGS
|
// END SETTINGS
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ public partial class SettingsModel : ObservableObject
|
|||||||
{
|
{
|
||||||
foreach (var item in newSettings)
|
foreach (var item in newSettings)
|
||||||
{
|
{
|
||||||
savedSettings[item.Key] = item.Value != null ? item.Value.DeepClone() : null;
|
savedSettings[item.Key] = item.Value?.DeepClone();
|
||||||
}
|
}
|
||||||
|
|
||||||
var serialized = savedSettings.ToJsonString(JsonSerializationContext.Default.Options);
|
var serialized = savedSettings.ToJsonString(JsonSerializationContext.Default.Options);
|
||||||
@@ -188,6 +188,8 @@ public partial class SettingsModel : ObservableObject
|
|||||||
[JsonSerializable(typeof(HistoryItem))]
|
[JsonSerializable(typeof(HistoryItem))]
|
||||||
[JsonSerializable(typeof(SettingsModel))]
|
[JsonSerializable(typeof(SettingsModel))]
|
||||||
[JsonSerializable(typeof(AppStateModel))]
|
[JsonSerializable(typeof(AppStateModel))]
|
||||||
|
[JsonSerializable(typeof(RecentCommandsManager))]
|
||||||
|
[JsonSerializable(typeof(List<string>), TypeInfoPropertyName = "StringList")]
|
||||||
[JsonSerializable(typeof(List<HistoryItem>), TypeInfoPropertyName = "HistoryList")]
|
[JsonSerializable(typeof(List<HistoryItem>), TypeInfoPropertyName = "HistoryList")]
|
||||||
[JsonSerializable(typeof(Dictionary<string, object>), TypeInfoPropertyName = "Dictionary")]
|
[JsonSerializable(typeof(Dictionary<string, object>), TypeInfoPropertyName = "Dictionary")]
|
||||||
[JsonSourceGenerationOptions(UseStringEnumConverter = true, WriteIndented = true, IncludeFields = true, PropertyNameCaseInsensitive = true, AllowTrailingCommas = true)]
|
[JsonSourceGenerationOptions(UseStringEnumConverter = true, WriteIndented = true, IncludeFields = true, PropertyNameCaseInsensitive = true, AllowTrailingCommas = true)]
|
||||||
|
|||||||
Reference in New Issue
Block a user