detect and save privatemode
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/WalletViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/WalletViewModel.cs
@@ -33,12 +33,11 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
var coinsChanged = Observable.FromEventPattern(Global.WalletService.Coins, nameof(Global.WalletService.Coins.CollectionChanged));
var coinSpent = Observable.FromEventPattern(Global.WalletService, nameof(Global.WalletService.CoinSpentOrSpenderConfirmed));
- Global.UiConfig.PrivateMode.WhenAnyValue(x => x).Subscribe(x =>
+ Global.UiConfig.WhenAnyValue(x => x.PrivateMode).Subscribe(x =>
{
SetBalance(Name);
}).DisposeWith(Disposables);
-
coinsChanged
.Merge(coinSpent)
.ObserveOn(RxApp.MainThreadScheduler)
@@ -72,9 +71,10 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
Actions[3].DisplayActionTab();
}
- PrivateModeCommand = ReactiveCommand.Create(() =>
+ PrivateModeCommand = ReactiveCommand.CreateFromTask(async () =>
{
Global.UiConfig.PrivateMode = !Global.UiConfig.PrivateMode;
+ await Global.UiConfig.ToFileAsync();
}).DisposeWith(Disposables);
}
@@ -100,7 +100,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
Money balance = Enumerable.Where(WalletService.Coins, c => c.Unspent && !c.IsDust && !c.SpentAccordingToBackend).Sum(c => (long?)c.Amount) ?? 0;
- Title = $"{walletName} ({(Global.UiConfig.PrivateMode?"##########":balance.ToString(false, true))} BTC)";
+ Title = $"{walletName} ({(Global.UiConfig.PrivateMode.Value ? "#########" : balance.ToString(false, true))} BTC)";
}
#region IDisposable Support

MODIFY
WalletWasabi.Gui/UiConfig.cs
WalletWasabi.Gui/UiConfig.cs
@@ -19,7 +19,7 @@ namespace WalletWasabi.Gui
[JsonObject(MemberSerialization.OptIn)]
public class UiConfig : ReactiveObject, IConfig
{
- private bool _privateMode;
+ private bool? _privateMode;
/// <inheritdoc />
public string FilePath { get; private set; }
@@ -44,7 +44,7 @@ namespace WalletWasabi.Gui
public bool? Autocopy { get; internal set; }
[JsonProperty(PropertyName = "PrivateMode")]
- public bool PrivateMode
+ public bool? PrivateMode
{
get => _privateMode;
set => this.RaiseAndSetIfChanged(ref _privateMode, value);
@@ -117,7 +117,7 @@ namespace WalletWasabi.Gui
FeeTarget = config.FeeTarget ?? FeeTarget;
FeeDisplayFormat = config.FeeDisplayFormat ?? FeeDisplayFormat;
Autocopy = config.Autocopy ?? Autocopy;
- PrivateMode = false;
+ PrivateMode = config.PrivateMode ?? PrivateMode;
}
/// <inheritdoc />
@@ -182,6 +182,5 @@ namespace WalletWasabi.Gui
{
if (FilePath is null) throw new NotSupportedException($"{nameof(FilePath)} is not set. Use {nameof(SetFilePath)} to set it.");
}
-
}
}

detect and save privatemode