privatemode binding
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/WalletExplorerView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/WalletExplorerView.xaml
</DrawingGroup>
</DrawingPresenter.Drawing>
</DrawingPresenter>
- <TextBlock Text="{Binding Title}" Height="19" VerticalAlignment="Center" />
+ <Button Content="{Binding Title}" Height="19" VerticalAlignment="Center" BorderThickness="0" Background="Transparent" Command="{Binding PrivateModeCommand}"/>
</StackPanel>
</TreeDataTemplate>

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/WalletViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/WalletViewModel.cs
@@ -33,6 +33,12 @@ 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 =>
+ {
+ SetBalance(Name);
+ }).DisposeWith(Disposables);
+
+
coinsChanged
.Merge(coinSpent)
.ObserveOn(RxApp.MainThreadScheduler)
@@ -65,6 +71,11 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
Actions[2].DisplayActionTab();
Actions[3].DisplayActionTab();
}
+
+ PrivateModeCommand = ReactiveCommand.Create(() =>
+ {
+ Global.UiConfig.PrivateMode = !Global.UiConfig.PrivateMode;
+ }).DisposeWith(Disposables);
}
public string Name { get; }
@@ -77,6 +88,8 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
set => this.RaiseAndSetIfChanged(ref _title, value);
}
+ public ReactiveCommand PrivateModeCommand { get; }
+
public ObservableCollection<WalletActionViewModel> Actions
{
get => _actions;
@@ -86,7 +99,8 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private void SetBalance(string walletName)
{
Money balance = Enumerable.Where(WalletService.Coins, c => c.Unspent && !c.IsDust && !c.SpentAccordingToBackend).Sum(c => (long?)c.Amount) ?? 0;
- Title = $"{walletName} ({balance.ToString(false, true)} BTC)";
+
+ Title = $"{walletName} ({(Global.UiConfig.PrivateMode?"##########":balance.ToString(false, true))} BTC)";
}
#region IDisposable Support

MODIFY
WalletWasabi.Gui/UiConfig.cs
WalletWasabi.Gui/UiConfig.cs
@@ -17,9 +17,9 @@ using WalletWasabi.JsonConverters;
namespace WalletWasabi.Gui
{
[JsonObject(MemberSerialization.OptIn)]
- public class UiConfig : IConfig, INotifyPropertyChanged
+ public class UiConfig : ReactiveObject, IConfig
{
- private bool? _privateMode;
+ private bool _privateMode;
/// <inheritdoc />
public string FilePath { get; private set; }
@@ -44,17 +44,10 @@ namespace WalletWasabi.Gui
public bool? Autocopy { get; internal set; }
[JsonProperty(PropertyName = "PrivateMode")]
- public bool? PrivateMode
+ public bool PrivateMode
{
get => _privateMode;
- set
- {
- if (_privateMode != value)
- {
- _privateMode = value;
- NotifyPropertyChanged();
- }
- }
+ set => this.RaiseAndSetIfChanged(ref _privateMode, value);
}
public UiConfig()
@@ -190,12 +183,5 @@ namespace WalletWasabi.Gui
if (FilePath is null) throw new NotSupportedException($"{nameof(FilePath)} is not set. Use {nameof(SetFilePath)} to set it.");
}
- public event PropertyChangedEventHandler PropertyChanged;
-
- private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
-
}
}

privatemode binding