Dispose everything in CoinJoinTabViewModel
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinJoinTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinJoinTabViewModel.cs
@@ -25,6 +25,8 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public class CoinJoinTabViewModel : WalletActionViewModel, IDisposable
{
+ private CompositeDisposable Disposables { get; }
+
private CoinListViewModel _coinsList;
private long _roundId;
private int _successfulRoundCount;
@@ -44,12 +46,12 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private string _dequeueButtonText;
private const string DequeueButtonTextString = "Dequeue Selected Coins";
private const string DequeuingButtonTextString = "Dequeuing coins...";
- private CompositeDisposable Disposables { get; }
public CoinJoinTabViewModel(WalletViewModel walletViewModel)
: base("CoinJoin", walletViewModel)
{
Disposables = new CompositeDisposable();
+
Password = "";
TargetPrivacy = GetTargetPrivacy(Global.Config.MixUntilAnonymitySet);
@@ -57,30 +59,16 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
UpdateRequiredBtcLabel(registrableRound);
- if (registrableRound != default)
- {
- CoordinatorFeePercent = registrableRound.State.CoordinatorFeePercent.ToString();
- }
- else
- {
- CoordinatorFeePercent = "0.003";
- }
+ CoordinatorFeePercent = registrableRound?.State?.CoordinatorFeePercent.ToString() ?? "0.003";
- if (registrableRound?.State?.Denomination != null && registrableRound.State.Denomination != Money.Zero)
- {
- CoinsList = new CoinListViewModel();
- }
- else
- {
- CoinsList = new CoinListViewModel();
- }
+ CoinsList = new CoinListViewModel().DisposeWith(Disposables);
AmountQueued = Money.Zero; // Global.ChaumianClient.State.SumAllQueuedCoinAmounts();
Global.ChaumianClient.CoinQueued += ChaumianClient_CoinQueued;
Global.ChaumianClient.CoinDequeued += ChaumianClient_CoinDequeued;
- var mostAdvancedRound = Global.ChaumianClient.State.GetMostAdvancedRoundOrDefault();
+ CcjClientRound mostAdvancedRound = Global.ChaumianClient?.State?.GetMostAdvancedRoundOrDefault();
if (mostAdvancedRound != default)
{
RoundId = mostAdvancedRound.State.RoundId;
@@ -97,6 +85,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
PeersRegistered = 0;
PeersNeeded = 100;
}
+
Global.ChaumianClient.StateUpdated += ChaumianClient_StateUpdated;
EnqueueCommand = ReactiveCommand.Create(async () =>
@@ -113,14 +102,17 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
TargetPrivacy = TargetPrivacy.Some;
}).DisposeWith(Disposables);
+
PrivacyFineCommand = ReactiveCommand.Create(() =>
{
TargetPrivacy = TargetPrivacy.Fine;
}).DisposeWith(Disposables);
+
PrivacyStrongCommand = ReactiveCommand.Create(() =>
{
TargetPrivacy = TargetPrivacy.Strong;
}).DisposeWith(Disposables);
+
TargetButtonCommand = ReactiveCommand.Create(async () =>
{
switch (TargetPrivacy)

Dispose everything in CoinJoinTabViewModel