Implement better Copied animation
Closes
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabView.xaml
<controls:GroupBox Title="{Binding Title}" TextBlock.FontSize="30" Padding="20" Margin="10">
<Grid Classes="content">
<DockPanel LastChildFill="True">
- <Grid IsVisible="{Binding ClipboardNotificationVisible}" Grid.ColumnSpan="4" DockPanel.Dock="Top">
- <Grid Opacity="{Binding ClipboardNotificationOpacity}">
- <Grid.Transitions>
- <DoubleTransition Property="Grid.Opacity"
- Easing="CircularEaseIn"
- Duration="0:0:0.5" />
- </Grid.Transitions>
- <TextBlock Text="TransactionId Is Copied to Clipboard!" Foreground="#22B14C" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="4" />
- </Grid>
- </Grid>
<DockPanel LastChildFill="True" DockPanel.Dock="Bottom">
<Grid ColumnDefinitions="40, 160, 150, *" Margin="10 0 0 0" DockPanel.Dock="Top">
<TextBlock Text="" />
</Border>
<TextBlock Text="{Binding DateTime}" Grid.Column="1" />
<TextBlock Text="{Binding AmountBtc}" Grid.Column="2" Foreground="{Binding AmountBtc, Converter={StaticResource MoneyBrushConverter}}" />
- <TextBlock Text="{Binding TransactionId}" Grid.Column="3" />
+ <TextBlock IsVisible="{Binding !ClipboardNotificationVisible}" Text="{Binding TransactionId}" Grid.Column="3" />
+
+ <Grid IsVisible="{Binding ClipboardNotificationVisible}" Grid.Column="3">
+ <Grid Opacity="{Binding ClipboardNotificationOpacity}">
+ <Grid.Transitions>
+ <DoubleTransition Property="Opacity"
+ Easing="CircularEaseIn"
+ Duration="0:0:0.5" />
+ </Grid.Transitions>
+ <TextBlock Text="Copied" Foreground="White" FontWeight="Bold" />
+ </Grid>
+ </Grid>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/HistoryTabViewModel.cs
@@ -24,9 +24,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
private ObservableCollection<TransactionViewModel> _transactions;
private TransactionViewModel _selectedTransaction;
- private double _clipboardNotificationOpacity;
- private bool _clipboardNotificationVisible;
- private long _disableClipboard;
private SortOrder _dateSortDirection;
private SortOrder _amountSortDirection;
private SortOrder _transactionSortDirection;
@@ -38,7 +35,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
: base("History", walletViewModel)
{
Disposables = new CompositeDisposable();
- Interlocked.Exchange(ref _disableClipboard, 0);
Transactions = new ObservableCollection<TransactionViewModel>();
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
RewriteTableAsync();
@@ -60,28 +56,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
}).DisposeWith(Disposables);
- this.WhenAnyValue(x => x.SelectedTransaction).Subscribe(async transaction =>
- {
- if (Interlocked.Read(ref _disableClipboard) == 0)
- {
- if (!(transaction is null))
- {
- await Application.Current.Clipboard.SetTextAsync(transaction.TransactionId);
- ClipboardNotificationVisible = true;
- ClipboardNotificationOpacity = 1;
-
- Dispatcher.UIThread.PostLogException(async () =>
- {
- await Task.Delay(1000);
- ClipboardNotificationOpacity = 0;
- });
- }
- }
- else
- {
- Interlocked.Exchange(ref _disableClipboard, 0);
- }
- }).DisposeWith(Disposables);
+ this.WhenAnyValue(x => x.SelectedTransaction).Subscribe(transaction => transaction?.CopyToClipboard()).DisposeWith(Disposables);
SortCommand = ReactiveCommand.Create(() => RefreshOrdering()).DisposeWith(Disposables);
@@ -114,7 +89,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
var txToSelect = Transactions.FirstOrDefault(x => x.TransactionId == rememberSelectedTransactionId);
if (txToSelect != default)
{
- Interlocked.Exchange(ref _disableClipboard, 1);
SelectedTransaction = txToSelect;
}
}
@@ -225,18 +199,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
set => this.RaiseAndSetIfChanged(ref _selectedTransaction, value);
}
- public double ClipboardNotificationOpacity
- {
- get => _clipboardNotificationOpacity;
- set => this.RaiseAndSetIfChanged(ref _clipboardNotificationOpacity, value);
- }
-
- public bool ClipboardNotificationVisible
- {
- get => _clipboardNotificationVisible;
- set => this.RaiseAndSetIfChanged(ref _clipboardNotificationVisible, value);
- }
-
public SortOrder DateSortDirection
{
get => _dateSortDirection;

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabView.xaml
<TextBlock Classes="warningMessage" Text="Label Is Required!" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Grid>
</Grid>
- <Grid IsVisible="{Binding ClipboardNotificationVisible}">
- <Grid Opacity="{Binding ClipboardNotificationOpacity}">
- <Grid.Transitions>
- <DoubleTransition Property="Opacity"
- Easing="CircularEaseIn"
- Duration="0:0:0.5" />
- </Grid.Transitions>
- <TextBlock Text="Address Is Copied To Clipboard!" Foreground="#22B14C" VerticalAlignment="Center" HorizontalAlignment="Center" />
- </Grid>
- </Grid>
</DockPanel>
<Grid ColumnDefinitions="300, *, 50" Margin="5 10 5 0" Grid.Row="1">
<TextBlock Text="Label:" />
</StackPanel>
</Expander>
<Grid ColumnDefinitions="400, *, 100" Margin="30 0 0 0">
- <TextBlock Text="{Binding Address}">
+ <TextBlock IsVisible="{Binding !ClipboardNotificationVisible}" Text="{Binding Address}">
<TextBlock.ContextMenu>
<ContextMenu>
<MenuItem Header="_Copy" Command="{Binding CopyToClipboard}">
</ContextMenu>
</TextBlock.ContextMenu>
</TextBlock>
+
+ <Grid IsVisible="{Binding ClipboardNotificationVisible}">
+ <Grid Opacity="{Binding ClipboardNotificationOpacity}">
+ <Grid.Transitions>
+ <DoubleTransition Property="Opacity"
+ Easing="CircularEaseIn"
+ Duration="0:0:0.5" />
+ </Grid.Transitions>
+ <TextBlock Text="Copied" Foreground="White" FontWeight="Bold" />
+ </Grid>
+ </Grid>
+
<TextBlock Text="{Binding Label}" Grid.Column="1" />
</Grid>
</Grid>

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
@@ -22,8 +22,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private string _label;
private double _labelRequiredNotificationOpacity;
private bool _labelRequiredNotificationVisible;
- private double _clipboardNotificationOpacity;
- private bool _clipboardNotificationVisible;
private int _caretIndex;
private ObservableCollection<SuggestionViewModel> _suggestions;
private CompositeDisposable Disposables { get; }
@@ -84,21 +82,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
this.WhenAnyValue(x => x.Label).Subscribe(x => UpdateSuggestions(x)).DisposeWith(Disposables);
- this.WhenAnyValue(x => x.SelectedAddress).Subscribe(address =>
- {
- if (!(address is null))
- {
- address.CopyToClipboard();
- ClipboardNotificationVisible = true;
- ClipboardNotificationOpacity = 1;
-
- Dispatcher.UIThread.PostLogException(async () =>
- {
- await Task.Delay(1000);
- ClipboardNotificationOpacity = 0;
- });
- }
- }).DisposeWith(Disposables);
+ this.WhenAnyValue(x => x.SelectedAddress).Subscribe(address => address?.CopyToClipboard()).DisposeWith(Disposables);
this.WhenAnyValue(x => x.CaretIndex).Subscribe(_ =>
{
@@ -156,18 +140,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
set => this.RaiseAndSetIfChanged(ref _labelRequiredNotificationVisible, value);
}
- public double ClipboardNotificationOpacity
- {
- get => _clipboardNotificationOpacity;
- set => this.RaiseAndSetIfChanged(ref _clipboardNotificationOpacity, value);
- }
-
- public bool ClipboardNotificationVisible
- {
- get => _clipboardNotificationVisible;
- set => this.RaiseAndSetIfChanged(ref _clipboardNotificationVisible, value);
- }
-
public int CaretIndex
{
get => _caretIndex;

Implement better Copied animation
Closes https://github.com/zkSNACKs/WalletWasabi/issues/1044