Skip to content
Permalink
Browse files

[skip ci] Implement banneduntil tooltip

  • Loading branch information...
nopara73 committed Nov 19, 2018
1 parent a603610 commit 2e4307de03adfcaf5d5233ea152442ea473e323e
@@ -8,7 +8,6 @@
<converters:CoinStatusColorConverter x:Key="CoinStatusColorConverter" />
<converters:CoinStatusBorderBrushConverter x:Key="CoinStatusBorderBrushConverter" />
<converters:CoinStatusForegroundConverter x:Key="CoinStatusForegroundConverter" />
<converters:CoinStatusToolTipConverter x:Key="CoinStatusToolTipConverter" />
</UserControl.Resources>
<UserControl.Styles>
<Style Selector="TextBlock">
@@ -71,7 +70,7 @@
<Path HorizontalAlignment="Left" Data="F1 M 23.7501,33.25L 34.8334,44.3333L 52.2499,22.1668L 56.9999,26.9168L 34.8334,53.8333L 19.0001,38L 23.7501,33.25 Z" Fill="#22B14C" Height="16" Width="16" Stretch="Fill" />
</Border>

<Border ToolTip.Tip="{Binding Status, Converter={StaticResource CoinStatusToolTipConverter}}" Padding="1" Grid.Column="2" Background="{Binding Status, Converter={StaticResource CoinStatusColorConverter}}" BorderBrush="{Binding Status, Converter={StaticResource CoinStatusBorderBrushConverter}}" HorizontalAlignment="Left" BorderThickness="1" CornerRadius="0,6,6,0">
<Border ToolTip.Tip="{Binding ToolTip}" Padding="1" Grid.Column="2" Background="{Binding Status, Converter={StaticResource CoinStatusColorConverter}}" BorderBrush="{Binding Status, Converter={StaticResource CoinStatusBorderBrushConverter}}" HorizontalAlignment="Left" BorderThickness="1" CornerRadius="0,6,6,0">
<TextBlock Text="{Binding Status, Converter={StaticResource CoinStatusStringConverter}, Mode=OneWay}" Background="{Binding Status, Converter={StaticResource CoinStatusColorConverter}}" Foreground="{Binding Status, Converter={StaticResource CoinStatusForegroundConverter}}" />
</Border>

@@ -9,6 +9,7 @@
using System.Linq;
using WalletWasabi.Gui.Models;
using WalletWasabi.Models.ChaumianCoinJoin;
using System.Globalization;

namespace WalletWasabi.Gui.Controls.WalletExplorer
{
@@ -41,19 +42,22 @@ public CoinViewModel(SmartCoin model)
model.WhenAnyValue(x => x.IsBanned).ObserveOn(RxApp.MainThreadScheduler).Subscribe(_ =>
{
this.RaisePropertyChanged(nameof(Status));
this.RaisePropertyChanged(nameof(BannedCoinToolTip));
});

model.WhenAnyValue(x => x.SpentAccordingToBackend).ObserveOn(RxApp.MainThreadScheduler).Subscribe(_ =>
{
this.RaisePropertyChanged(nameof(Status));
});

this.WhenAnyValue(x => x.Status).ObserveOn(RxApp.MainThreadScheduler).Subscribe(_ =>
{
this.RaisePropertyChanged(nameof(ToolTip));
});

Global.IndexDownloader.WhenAnyValue(x => x.BestHeight).ObserveOn(RxApp.MainThreadScheduler).Subscribe(_ =>
{
this.RaisePropertyChanged(nameof(Confirmations));
this.RaisePropertyChanged(nameof(Status));
this.RaisePropertyChanged(nameof(BannedCoinToolTip));
});

Global.ChaumianClient.StateUpdated += ChaumianClient_StateUpdated;
@@ -86,7 +90,26 @@ public bool IsSelected
set { this.RaiseAndSetIfChanged(ref _isSelected, value); }
}

public string BannedCoinToolTip => Model.IsBanned ? $"Banned until {Model.BannedUntilUtc.Value.ToLocalTime()}." : "This coin is not banned.";
public string ToolTip
{
get
{
switch (Status)
{
case SmartCoinStatus.Confirmed: return "This coin is confirmed.";
case SmartCoinStatus.Unconfirmed: return "This coin is unconfirmed.";
case SmartCoinStatus.MixingOnWaitingList: return "This coin is waiting for its turn to be coinjoined.";
case SmartCoinStatus.MixingBanned: return $"The coordinator banned this coin from participation until {Model.BannedUntilUtc.Value.ToString("yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture)}.";
case SmartCoinStatus.MixingInputRegistration: return "This coin is registered for coinjoin.";
case SmartCoinStatus.MixingConnectionConfirmation: return "This coin is currently in Connection Confirmation phase.";
case SmartCoinStatus.MixingOutputRegistration: return "This coin is currently in Output Registration phase.";
case SmartCoinStatus.MixingSigning: return "This coin is currently in Signing phase.";
case SmartCoinStatus.SpentAccordingToBackend: return "According to the Backend, this coin is spent. Wallet state will be corrected after confirmation.";
case SmartCoinStatus.MixingWaitingForConfirmation: return "Coinjoining unconfirmed coins is not allowed.";
default: return "This is impossible.";
}
}
}

public Money Amount => Model.Amount;

This file was deleted.

0 comments on commit 2e4307d

Please sign in to comment.
You can’t perform that action at this time.