Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wallet explorer utility buttons. #3384

Merged
merged 31 commits into from Mar 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
04e1114
Add utility buttons to wallet explorer.
Mar 26, 2020
bf3a247
Update collapse icon to dark theme
jmacato Mar 27, 2020
26d4872
Implement Lurking Wife mode toggle button
jmacato Mar 27, 2020
cc3221f
Fix Icon order.
Mar 27, 2020
3e128b8
Merge remote-tracking branch 'origin/master' into wallet-explorer-uti…
Mar 27, 2020
d701a79
polish button spacing.
Mar 27, 2020
d70f3c6
Dont access locator 2 times.
Mar 27, 2020
7d89b59
fix code factor
Mar 27, 2020
897bf30
Merge branch 'wallet-explorer-utility-buttons' of https://github.com/…
Mar 27, 2020
c02d6f6
Update WalletWasabi.Gui/Controls/WalletExplorer/WalletExplorerViewMod…
nopara73 Mar 27, 2020
40978cb
Merge branch 'master' into pr/3373-wallet-explorer-utility-buttons
nopara73 Mar 27, 2020
f029944
Update WalletWasabi.Gui/Icons/Icons.xaml
nopara73 Mar 27, 2020
219c6f1
Remove async context
nopara73 Mar 27, 2020
0e645d2
Merge branch 'wallet-explorer-utility-buttons' of https://github.com/…
nopara73 Mar 27, 2020
713715b
Merge branch 'master' into pr/3373-wallet-explorer-utility-buttons
nopara73 Mar 28, 2020
1ec9619
WalletExplorerViewModel format nitpick
nopara73 Mar 28, 2020
252bea3
Pass around WalletViewModelBase instead of wallet.
nopara73 Mar 28, 2020
6d393c5
Expand wallet tab.
nopara73 Mar 28, 2020
08d6bf8
Call base to set title
nopara73 Mar 28, 2020
6733809
Reduce nesting
nopara73 Mar 28, 2020
7c91846
Extract CollapseWallets function.
nopara73 Mar 28, 2020
e16be15
Extract ToggleLurkingWifeMode function.
nopara73 Mar 28, 2020
ab3010f
Make WalletViewModel private and WalletViewModelBase protected.
Mar 28, 2020
2cf2d4f
Fix expanding selected wallet.
Mar 28, 2020
1011b5b
Fix opening wallet tabs if your opening multiple wallets at a time.
Mar 28, 2020
5ea48b3
code factor issues.
Mar 28, 2020
b739148
Revert "Pass around WalletViewModelBase instead of wallet."
Mar 28, 2020
c164b03
Remove use of base class for expanding wallets.
Mar 28, 2020
01c9926
whitespace.
Mar 28, 2020
407b65c
remove command declaration.
Mar 28, 2020
7b938c1
monitor command exceptions correctly.
Mar 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -25,7 +25,7 @@

namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public class CoinJoinTabViewModel : WasabiDocumentTabViewModel
public class CoinJoinTabViewModel : WasabiDocumentTabViewModel, IWalletViewModel
{
private long _roundId;
private RoundPhaseState _roundPhaseState;
Expand Down Expand Up @@ -133,6 +133,8 @@ public CoinJoinTabViewModel(Wallet wallet)

private Wallet Wallet { get; }

Wallet IWalletViewModel.Wallet => Wallet;

[ValidateMethod(nameof(ValidatePassword))]
public string Password
{
Expand Down
Expand Up @@ -16,7 +16,7 @@

namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public class HistoryTabViewModel : WasabiDocumentTabViewModel
public class HistoryTabViewModel : WasabiDocumentTabViewModel, IWalletViewModel
{
private ObservableCollection<TransactionViewModel> _transactions;
private TransactionViewModel _selectedTransaction;
Expand Down Expand Up @@ -50,6 +50,8 @@ public HistoryTabViewModel(Wallet wallet)

private Wallet Wallet { get; }

Wallet IWalletViewModel.Wallet => Wallet;

public ReactiveCommand<Unit, Unit> SortCommand { get; }

public override void OnOpen(CompositeDisposable disposables)
Expand Down
Expand Up @@ -77,7 +77,7 @@
</MenuItem>
<MenuItem Header="Hide Address" Command="{Binding LockAddress}">
<MenuItem.Icon>
<DrawingPresenter HorizontalAlignment="Left" Height="16" Width="16" Stretch="Fill" Drawing="{StaticResource ReceiveTabView_LockAddress}" />
<DrawingPresenter HorizontalAlignment="Left" Height="16" Width="16" Stretch="Fill" Drawing="{StaticResource EyesHide}" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
Expand Down
13 changes: 5 additions & 8 deletions WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
@@ -1,30 +1,25 @@
using Avalonia;
using Avalonia.Threading;
using ReactiveUI;
using Splat;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.Blockchain.Analysis.Clustering;
using WalletWasabi.Blockchain.Keys;
using WalletWasabi.Gui.Helpers;
using WalletWasabi.Gui.Tabs.WalletManager;
using WalletWasabi.Gui.Suggestions;
using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Logging;
using WalletWasabi.Hwi;
using WalletWasabi.Hwi.Exceptions;
using Splat;
using WalletWasabi.Gui.Suggestions;
using WalletWasabi.Wallets;

namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public class ReceiveTabViewModel : WasabiDocumentTabViewModel
public class ReceiveTabViewModel : WasabiDocumentTabViewModel, IWalletViewModel
{
private ObservableCollection<AddressViewModel> _addresses;
private AddressViewModel _selectedAddress;
Expand Down Expand Up @@ -95,6 +90,8 @@ public ReceiveTabViewModel(Wallet wallet)

private Wallet Wallet { get; }

Wallet IWalletViewModel.Wallet => Wallet;

public SuggestLabelViewModel LabelSuggestion { get; }

public bool IsHardwareWallet => Wallet.KeyManager.IsHardwareWallet;
Expand Down
Expand Up @@ -41,11 +41,14 @@

namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public abstract class SendControlViewModel : WasabiDocumentTabViewModel
public abstract class SendControlViewModel : WasabiDocumentTabViewModel, IWalletViewModel
{
protected Global Global { get; }

private Wallet Wallet { get; }

Wallet IWalletViewModel.Wallet => Wallet;

private string _buildTransactionButtonText;
private bool _isMax;
private string _amountText;
Expand Down
167 changes: 93 additions & 74 deletions WalletWasabi.Gui/Controls/WalletExplorer/WalletExplorerView.xaml
Expand Up @@ -3,7 +3,11 @@
xmlns:ViewModels="clr-namespace:WalletWasabi.Gui.Controls.WalletExplorer;assembly=WalletWasabi.Gui"
xmlns:i="clr-namespace:Avalonia.Xaml.Interactivity;assembly=Avalonia.Xaml.Interactivity"
xmlns:behaviors="clr-namespace:WalletWasabi.Gui.Behaviors;assembly=WalletWasabi.Gui"
xmlns:converters="clr-namespace:WalletWasabi.Gui.Converters;assembly=WalletWasabi.Gui"
x:Class="WalletWasabi.Gui.Controls.WalletExplorer.WalletExplorerView">
<UserControl.Resources>
<converters:BooleanStringConverter x:Key="BooleanStringConverter" />
</UserControl.Resources>
<UserControl.Styles>
<Style Selector="DrawingPresenter#PART_Spinner">
<Style.Animations>
Expand All @@ -15,78 +19,93 @@
</Style.Animations>
</Style>
</UserControl.Styles>
<Grid>
<TreeView BorderThickness="0" Items="{Binding Wallets}" SelectedItem="{Binding SelectedItem}">
<TreeView.Styles>
<Style Selector="TreeViewItem">
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
</Style>
</TreeView.Styles>
<TreeView.DataTemplates>
<TreeDataTemplate DataType="ViewModels:ClosedWalletViewModel" ItemsSource="{Binding Actions}">
<StackPanel Orientation="Horizontal" Spacing="6">
<i:Interaction.Behaviors>
<behaviors:CommandOnDoubleClickBehavior Command="{Binding OpenWalletCommand}" />
</i:Interaction.Behaviors>
<StackPanel.ContextMenu>
<ContextMenu>
<MenuItem Header="Load Wallet" Command="{Binding OpenWalletCommand}" />
</ContextMenu>
</StackPanel.ContextMenu>
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorer_ClosedWallet}" />
<TextBlock Text="{Binding Title}" Height="19" VerticalAlignment="Center" />
<DrawingPresenter Name="PART_Spinner" Width="16" Height="16" IsVisible="{Binding IsBusy}" Drawing="{DynamicResource WalletExplorer_Spinner}" />
</StackPanel>
</TreeDataTemplate>
<TreeDataTemplate DataType="ViewModels:WalletViewModel" ItemsSource="{Binding Actions}">
<StackPanel Orientation="Horizontal" Spacing="6">
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorer_OpenWallet}" />
<Button Content="{Binding Title}" Command="{Binding LurkingWifeModeCommand}" VerticalAlignment="Center" BorderThickness="0" Margin="0" Padding="0" Background="Transparent" />
</StackPanel>
</TreeDataTemplate>
<TreeDataTemplate DataType="ViewModels:SendTabViewModel">
<StackPanel Orientation="Horizontal" Spacing="6">
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorerView_Send}" />
<TextBlock Text="{Binding Title}" VerticalAlignment="Center" />
</StackPanel>
</TreeDataTemplate>
<TreeDataTemplate DataType="ViewModels:BuildTabViewModel">
<StackPanel Orientation="Horizontal" Spacing="6">
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorerView_Builder}" />
<TextBlock Text="{Binding Title}" VerticalAlignment="Center" />
</StackPanel>
</TreeDataTemplate>
<TreeDataTemplate DataType="ViewModels:ReceiveTabViewModel">
<StackPanel Orientation="Horizontal" Spacing="6">
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorerView_Receive}" />
<TextBlock Text="{Binding Title}" VerticalAlignment="Center" />
</StackPanel>
</TreeDataTemplate>
<TreeDataTemplate DataType="ViewModels:CoinJoinTabViewModel">
<StackPanel Orientation="Horizontal" Spacing="6">
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorerView_CoinJoin}" />
<TextBlock Text="{Binding Title}" VerticalAlignment="Center" />
</StackPanel>
</TreeDataTemplate>
<TreeDataTemplate DataType="ViewModels:HistoryTabViewModel">
<StackPanel Orientation="Horizontal" Spacing="6">
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorerView_History}" />
<TextBlock Text="{Binding Title}" VerticalAlignment="Center" />
</StackPanel>
</TreeDataTemplate>
<TreeDataTemplate DataType="ViewModels:WalletInfoViewModel">
<StackPanel Orientation="Horizontal" Spacing="6">
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorerView_Info}" />
<TextBlock Text="Wallet Info" VerticalAlignment="Center" />
</StackPanel>
</TreeDataTemplate>
<TreeDataTemplate DataType="ViewModels:WalletAdvancedViewModel" ItemsSource="{Binding Items}">
<StackPanel Orientation="Horizontal" Spacing="6">
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorerView_Advanced}" />
<TextBlock Text="Advanced" VerticalAlignment="Center" />
</StackPanel>
</TreeDataTemplate>
</TreeView.DataTemplates>
</TreeView>
</Grid>
<DockPanel LastChildFill="True">
<Panel DockPanel.Dock="Top" HorizontalAlignment="Stretch" Background="{DynamicResource ThemeControlLowBrush}">
<StackPanel Orientation="Horizontal" Spacing="2" Margin="8 1">
<Button Background="Transparent" BorderThickness="0" ToolTip.Tip="{Binding IsLurkingWifeMode, StringFormat=\{0\} Lurking Wife Mode, Converter={StaticResource BooleanStringConverter}, ConverterParameter=Disable:Enable}" Command="{Binding LurkingWifeModeCommand}">
<Panel>
<DrawingPresenter Width="16" Height="16" IsVisible="{Binding !IsLurkingWifeMode}" Drawing="{DynamicResource EyesShow}" />
<DrawingPresenter Width="16" Height="16" IsVisible="{Binding IsLurkingWifeMode}" Drawing="{DynamicResource EyesHide}" />
</Panel>
</Button>
<Button Background="Transparent" BorderThickness="0" ToolTip.Tip="Collapse All" Command="{Binding CollapseAllCommand}">
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorerView_CollapseTree}" />
</Button>
</StackPanel>
</Panel>
<Panel>
<TreeView BorderThickness="0" Items="{Binding Wallets}" SelectedItem="{Binding SelectedItem}">
<TreeView.Styles>
<Style Selector="TreeViewItem">
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
</Style>
</TreeView.Styles>
<TreeView.DataTemplates>
<TreeDataTemplate DataType="ViewModels:ClosedWalletViewModel" ItemsSource="{Binding Actions}">
<StackPanel Orientation="Horizontal" Spacing="6">
<i:Interaction.Behaviors>
<behaviors:CommandOnDoubleClickBehavior Command="{Binding OpenWalletCommand}" />
</i:Interaction.Behaviors>
<StackPanel.ContextMenu>
<ContextMenu>
<MenuItem Header="Open Wallet" Command="{Binding OpenWalletCommand}" />
</ContextMenu>
</StackPanel.ContextMenu>
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorer_ClosedWallet}" />
<TextBlock Text="{Binding Title}" Height="19" VerticalAlignment="Center" />
<DrawingPresenter Name="PART_Spinner" Width="16" Height="16" IsVisible="{Binding IsBusy}" Drawing="{DynamicResource WalletExplorer_Spinner}" />
</StackPanel>
</TreeDataTemplate>
<TreeDataTemplate DataType="ViewModels:WalletViewModel" ItemsSource="{Binding Actions}">
<StackPanel Orientation="Horizontal" Spacing="6">
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorer_OpenWallet}" />
<TextBlock Text="{Binding Title}" Height="19" VerticalAlignment="Center" />
</StackPanel>
</TreeDataTemplate>
<TreeDataTemplate DataType="ViewModels:SendTabViewModel">
<StackPanel Orientation="Horizontal" Spacing="6">
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorerView_Send}" />
<TextBlock Text="{Binding Title}" VerticalAlignment="Center" />
</StackPanel>
</TreeDataTemplate>
<TreeDataTemplate DataType="ViewModels:BuildTabViewModel">
<StackPanel Orientation="Horizontal" Spacing="6">
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorerView_Builder}" />
<TextBlock Text="{Binding Title}" VerticalAlignment="Center" />
</StackPanel>
</TreeDataTemplate>
<TreeDataTemplate DataType="ViewModels:ReceiveTabViewModel">
<StackPanel Orientation="Horizontal" Spacing="6">
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorerView_Receive}" />
<TextBlock Text="{Binding Title}" VerticalAlignment="Center" />
</StackPanel>
</TreeDataTemplate>
<TreeDataTemplate DataType="ViewModels:CoinJoinTabViewModel">
<StackPanel Orientation="Horizontal" Spacing="6">
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorerView_CoinJoin}" />
<TextBlock Text="{Binding Title}" VerticalAlignment="Center" />
</StackPanel>
</TreeDataTemplate>
<TreeDataTemplate DataType="ViewModels:HistoryTabViewModel">
<StackPanel Orientation="Horizontal" Spacing="6">
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorerView_History}" />
<TextBlock Text="{Binding Title}" VerticalAlignment="Center" />
</StackPanel>
</TreeDataTemplate>
<TreeDataTemplate DataType="ViewModels:WalletInfoViewModel">
<StackPanel Orientation="Horizontal" Spacing="6">
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorerView_Info}" />
<TextBlock Text="Wallet Info" VerticalAlignment="Center" />
</StackPanel>
</TreeDataTemplate>
<TreeDataTemplate DataType="ViewModels:WalletAdvancedViewModel" ItemsSource="{Binding Items}">
<StackPanel Orientation="Horizontal" Spacing="6">
<DrawingPresenter Width="16" Height="16" Drawing="{DynamicResource WalletExplorerView_Advanced}" />
<TextBlock Text="Advanced" VerticalAlignment="Center" />
</StackPanel>
</TreeDataTemplate>
</TreeView.DataTemplates>
</TreeView>
</Panel>
</DockPanel>
</UserControl>