make ui config WindowState compatible with Fluent
MODIFY
WalletWasabi.Gui/Converters/WindowStateAfterStartJsonConverter.cs
WalletWasabi.Gui/Converters/WindowStateAfterStartJsonConverter.cs
@@ -9,7 +9,7 @@ namespace WalletWasabi.Gui.Converters
/// <inheritdoc />
public override bool CanConvert(Type objectType)
{
- return objectType == typeof(WindowState);
+ return objectType == typeof(string);
}
/// <inheritdoc />
@@ -22,25 +22,25 @@ namespace WalletWasabi.Gui.Converters
if (string.IsNullOrWhiteSpace(value))
{
- return WindowState.Maximized;
+ return WindowState.Maximized.ToString();
}
var windowStateString = value.Trim();
return windowStateString.StartsWith("norm", StringComparison.OrdinalIgnoreCase)
- ? WindowState.Normal
- : WindowState.Maximized;
+ ? WindowState.Normal.ToString()
+ : WindowState.Maximized.ToString();
}
catch
{
- return WindowState.Maximized;
+ return WindowState.Maximized.ToString();
}
}
/// <inheritdoc />
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
- writer.WriteValue(((WindowState)value).ToString());
+ writer.WriteValue(value);
}
}
}

MODIFY
WalletWasabi.Gui/MainWindow.xaml.cs
WalletWasabi.Gui/MainWindow.xaml.cs
@@ -103,7 +103,7 @@ namespace WalletWasabi.Gui
{
if (Global.UiConfig is { }) // UiConfig not yet loaded.
{
- Global.UiConfig.WindowState = WindowState;
+ Global.UiConfig.WindowState = WindowState.ToString();
IDocumentTabViewModel? selectedDocument = IoC.Get<IShell>().SelectedDocument;
Global.UiConfig.LastActiveTab = selectedDocument is null

MODIFY
WalletWasabi.Gui/UiConfig.cs
WalletWasabi.Gui/UiConfig.cs
@@ -45,7 +45,7 @@ namespace WalletWasabi.Gui
[JsonProperty(PropertyName = "WindowState")]
[JsonConverter(typeof(WindowStateAfterStartJsonConverter))]
- public WindowState WindowState { get; internal set; } = WindowState.Normal;
+ public string WindowState { get; internal set; } = Avalonia.Controls.WindowState.Normal.ToString();
[DefaultValue(2)]
[JsonProperty(PropertyName = "FeeTarget", DefaultValueHandling = DefaultValueHandling.Populate)]

MODIFY
WalletWasabi.Gui/ViewModels/MainWindowViewModel.cs
WalletWasabi.Gui/ViewModels/MainWindowViewModel.cs
@@ -37,7 +37,8 @@ namespace WalletWasabi.Gui.ViewModels
_menuVisible = true;
- WindowState = uiConfig.WindowState;
+ var windowState = (WindowState) Enum.Parse(typeof(WindowState), uiConfig.WindowState);
+ WindowState = windowState;
InitializeLockScreen();

make ui config WindowState compatible with Fluent