﻿using WalletWasabi.Fluent.ViewModels.NavBar;
using WalletWasabi.Helpers;

namespace WalletWasabi.Fluent.ViewModels.Wallets.Actions
{
	public abstract partial class WalletActionViewModel : NavBarItemViewModel
	{
		[AutoNotify] private bool _isEnabled;

		protected WalletActionViewModel(WalletViewModelBase wallet)
		{
			Wallet = Guard.NotNull(nameof(wallet), wallet);
		}

		public WalletViewModelBase Wallet { get; }

		public override string ToString() => Title;
	}
}
﻿using System.Reactive;
using System.Reactive.Linq;
using ReactiveUI;
using WalletWasabi.Fluent.ViewModels.NavBar;
using WalletWasabi.Helpers;
using WalletWasabi.Wallets;

namespace WalletWasabi.Fluent.ViewModels.Wallets.Actions
{
	public abstract partial class WalletActionViewModel : NavBarItemViewModel
	{
		[AutoNotify] private bool _isEnabled;

		protected WalletActionViewModel(WalletViewModelBase wallet)
		{
			Wallet = Guard.NotNull(nameof(wallet), wallet);

			wallet.WhenAnyValue(x => x.WalletState).Select(x => IsEnabled = (x == WalletState.Started));
		}

		public WalletViewModelBase Wallet { get; }

		public override string ToString() => Title;
	}
}
Set IsEnabled wallet action property depending on wallet state
Set IsEnabled wallet action property depending on wallet state
