Display message indicating there is an open wallet
MODIFY
WalletWasabi.Gui/Styles/Styles.xaml
WalletWasabi.Gui/Styles/Styles.xaml
<SolidColorBrush x:Key="ThemeAccentBrush">#007ACC</SolidColorBrush>
<SolidColorBrush x:Key="HyperLinkForeground">#00A2E8</SolidColorBrush>
<SolidColorBrush x:Key="ErrorMessageForeground">#F25022</SolidColorBrush>
+ <SolidColorBrush x:Key="WarningMessageForeground">#FFDD00</SolidColorBrush>
<sys:Double x:Key="FontSizeSmall">12</sys:Double>
<sys:Double x:Key="FontSizeNormal">14</sys:Double>
<Setter Property="TextBlock.Foreground" Value="{DynamicResource ErrorMessageForeground}" />
</Style>
+ <Style Selector=".warningMessage">
+ <Setter Property="TextBlock.Foreground" Value="{DynamicResource WarningMessageForeground}" />
+ </Style>
+
<Style Selector="Button.activeHyperLink">
<Setter Property="TextBlock.Foreground" Value="{DynamicResource HyperLinkForeground}" />
<Setter Property="Cursor" Value="Hand" />

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/GenerateWalletSuccessViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/GenerateWalletSuccessViewModel.cs
@@ -14,7 +14,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
ConfirmCommand = ReactiveCommand.Create(() =>
{
- owner.SelectedCategory = owner.LoadWalletCategory;
+ owner.SelectLoadWallet();
});
}

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/LoadWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/LoadWalletViewModel.cs
@@ -18,14 +18,28 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
private ObservableCollection<string> _wallets;
private string _selectedWallet;
private bool _isSelectedWallet;
+ private bool _isWalletOpened;
+ private bool _canLoadWallet;
+ private string _warningMessage;
+ private WalletManagerViewModel _owner;
- public LoadWalletViewModel() : base("Load Wallet")
+ public LoadWalletViewModel(WalletManagerViewModel owner) : base("Load Wallet")
{
+ _owner = owner;
_wallets = new ObservableCollection<string>();
- this.WhenAnyValue(x => x.SelectedWallet).Subscribe(SelectedWallet => IsSelectedWallet = !string.IsNullOrEmpty(SelectedWallet));
- LoadCommand = ReactiveCommand.Create(
- LoadWallet,
- this.WhenAnyValue(x => x.IsSelectedWallet));
+
+ this.WhenAnyValue(x => x.SelectedWallet)
+ .Subscribe(selectedWallet => CanLoadWallet = !string.IsNullOrEmpty(selectedWallet) && !IsWalletOpened);
+
+ this.WhenAnyValue(x => x.IsWalletOpened)
+ .Subscribe(isWalletOpened => CanLoadWallet = !string.IsNullOrEmpty(SelectedWallet) && !isWalletOpened);
+
+ this.WhenAnyValue(x=>x.IsWalletOpened)
+ .Subscribe(isWalletOpened => WarningMessage = isWalletOpened
+ ? "There is an already open wallet. Restart the application in order to be able to open a different wallet."
+ : string.Empty );
+
+ LoadCommand = ReactiveCommand.Create( LoadWallet, this.WhenAnyValue(x => x.CanLoadWallet));
}
public ObservableCollection<string> Wallets
@@ -40,10 +54,22 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
set { this.RaiseAndSetIfChanged(ref _selectedWallet, value); }
}
- public bool IsSelectedWallet
+ public bool IsWalletOpened
+ {
+ get { return _isWalletOpened; }
+ set { this.RaiseAndSetIfChanged(ref _isWalletOpened, value); }
+ }
+
+ public string WarningMessage
+ {
+ get { return _warningMessage; }
+ set { this.RaiseAndSetIfChanged(ref _warningMessage, value); }
+ }
+
+ public bool CanLoadWallet
{
- get { return _isSelectedWallet; }
- set { this.RaiseAndSetIfChanged(ref _isSelectedWallet, value); }
+ get { return _canLoadWallet; }
+ set { this.RaiseAndSetIfChanged(ref _canLoadWallet, value); }
}
public override void OnCategorySelected()
@@ -56,6 +82,13 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
{
_wallets.Add(Path.GetFileNameWithoutExtension(file.FullName));
}
+
+ if(_wallets.Any())
+ {
+ SelectedWallet = _wallets.First();
+ }
+
+ IsWalletOpened = Global.WalletService != null;
}
public ReactiveCommand LoadCommand { get; }
@@ -72,8 +105,10 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
}
var keyManager = KeyManager.FromFile(walletFullPath);
-
//Global.WalletService = new WalletService(keyManager)
+
+ IsWalletOpened = true;
+ _owner.SelectGenerateWallet();
}
}
}

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/RecoverWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/RecoverWalletViewModel.cs
@@ -52,7 +52,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
var mnemonic = new Mnemonic(MnemonicWords);
KeyManager.Recover(mnemonic, Password, walletFilePath);
- owner.SelectedCategory = owner.LoadWalletCategory;
+ owner.SelectLoadWallet();
}
catch (Exception ex)
{

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/WalletManagerViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/WalletManagerViewModel.cs
@@ -14,13 +14,11 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
public WalletManagerViewModel() : base("Wallet Manager")
{
- LoadWalletCategory = new LoadWalletViewModel();
-
Categories = new ObservableCollection<CategoryViewModel>
{
new GenerateWalletViewModel(this),
new RecoverWalletViewModel(this),
- LoadWalletCategory
+ new LoadWalletViewModel(this)
};
SelectedCategory = Categories.FirstOrDefault();
@@ -33,8 +31,6 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
});
}
- public LoadWalletViewModel LoadWalletCategory { get; }
-
public ObservableCollection<CategoryViewModel> Categories
{
get { return _categories; }

Display message indicating there is an open wallet