saving the FeeTarget (on sendTab) to the UiConfig file making it non
volatile.
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
@@ -64,7 +64,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
ResetMax();
SetFeeTargetLimits();
- FeeTarget = MinimumFeeTarget;
+ FeeTarget = Global.UiConfig.FeeTarget ?? MinimumFeeTarget;
SetFeesAndTexts();
Global.Synchronizer.PropertyChanged += Synchronizer_PropertyChanged;
@@ -525,7 +525,11 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
public int FeeTarget
{
get => _feeTarget;
- set => this.RaiseAndSetIfChanged(ref _feeTarget, value);
+ set
+ {
+ this.RaiseAndSetIfChanged(ref _feeTarget, value);
+ Global.UiConfig.FeeTarget = value;
+ }
}
public int MinimumFeeTarget

MODIFY
WalletWasabi.Gui/Global.cs
WalletWasabi.Gui/Global.cs
@@ -75,12 +75,18 @@ namespace WalletWasabi.Gui
public static TorProcessManager TorManager { get; private set; }
public static Config Config { get; private set; }
+ public static UiConfig UiConfig { get; private set; }
public static void InitializeConfig(Config config)
{
Config = Guard.NotNull(nameof(config), config);
}
+ public static void InitializeUiConfig(UiConfig uiConfig)
+ {
+ UiConfig = Guard.NotNull(nameof(uiConfig), uiConfig);
+ }
+
private static long _triedDesperateDequeuing = 0;
private static async Task TryDesperateDequeueAllCoinsAsync()

MODIFY
WalletWasabi.Gui/MainWindow.xaml.cs
WalletWasabi.Gui/MainWindow.xaml.cs
@@ -18,7 +18,7 @@ namespace WalletWasabi.Gui
{
public class MainWindow : MetroWindow
{
- public UiConfig UiConfig { get; private set; }
+
public MainWindow()
{
@@ -46,15 +46,12 @@ namespace WalletWasabi.Gui
private async void MainWindow_ClosingAsync(object sender, CancelEventArgs e)
{
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- {
- UiConfig.WindowState = WindowState;
- UiConfig.Width = Width;
- UiConfig.Height = Height;
- await UiConfig.ToFileAsync();
+ Global.UiConfig.WindowState = WindowState;
+ Global.UiConfig.Width = Width;
+ Global.UiConfig.Height = Height;
+ await Global.UiConfig.ToFileAsync();
Logging.Logger.LogInfo<UiConfig>("UiConfig is saved.");
}
- }
#pragma warning disable IDE1006 // Naming Styles
private async void OnActivated(object sender, EventArgs e)
@@ -62,13 +59,14 @@ namespace WalletWasabi.Gui
{
Activated -= OnActivated;
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- {
var uiConfigFilePath = Path.Combine(Global.DataDir, "UiConfig.json");
var uiConfig = new UiConfig(uiConfigFilePath);
await uiConfig.LoadOrCreateDefaultFileAsync();
+ Global.InitializeUiConfig(uiConfig);
Logging.Logger.LogInfo<UiConfig>("UiConfig is successfully initialized.");
- UiConfig = uiConfig;
+
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
MainWindowViewModel.Instance.Width = (double)uiConfig.Width;
MainWindowViewModel.Instance.Height = (double)uiConfig.Height;
MainWindowViewModel.Instance.WindowState = (WindowState)uiConfig.WindowState;

MODIFY
WalletWasabi.Gui/UiConfig.cs
WalletWasabi.Gui/UiConfig.cs
@@ -28,6 +28,9 @@ namespace WalletWasabi.Gui
[JsonProperty(PropertyName = "Width")]
public double? Width { get; internal set; }
+ [JsonProperty(PropertyName = "FeeTarget")]
+ public int? FeeTarget { get; internal set; }
+
public UiConfig()
{
}
@@ -37,11 +40,12 @@ namespace WalletWasabi.Gui
SetFilePath(filePath);
}
- public UiConfig(WindowState windowState, double height, double width)
+ public UiConfig(WindowState windowState, double height, double width, int feeTarget)
{
WindowState = Guard.NotNull(nameof(windowState), windowState);
Height = Guard.NotNull(nameof(height), height);
Width = Guard.NotNull(nameof(width), width);
+ FeeTarget = Guard.NotNull(nameof(feeTarget), feeTarget);
}
/// <inheritdoc />
@@ -63,6 +67,7 @@ namespace WalletWasabi.Gui
WindowState = Avalonia.Controls.WindowState.Maximized;
Height = 530;
Width = 1100;
+ FeeTarget = 2;
if (!File.Exists(FilePath))
{
@@ -84,6 +89,7 @@ namespace WalletWasabi.Gui
WindowState = config.WindowState ?? WindowState;
Height = config.Height ?? Height;
Width = config.Width ?? Width;
+ FeeTarget = config.FeeTarget ?? FeeTarget;
}
/// <inheritdoc />
@@ -114,6 +120,11 @@ namespace WalletWasabi.Gui
return true;
}
+ if (FeeTarget != config.FeeTarget)
+ {
+ return true;
+ }
+
return false;
}

- saving the FeeTarget (on sendTab) to the UiConfig file making it non
volatile.