fix phaseState colour converter so it will work with multiple wallets.
# Conflicts:
#	WalletWasabi.Gui/Converters/PhaseColorConverter.cs
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinJoinTabView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/CoinJoinTabView.xaml
<Grid ColumnDefinitions="210, *" RowDefinitions="50, 20, 20">
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal" Spacing="4" Margin="0 12">
<Canvas Height="20" Width="200">
- <Ellipse Width="20" Height="20" StrokeThickness="4" Stroke="{Binding Phase, ConverterParameter=InputRegistration, Converter={StaticResource PhaseColorConverter}}" Canvas.Left="0" />
- <Ellipse Width="20" Height="20" StrokeThickness="4" Stroke="{Binding Phase, ConverterParameter=ConnectionConfirmation, Converter={StaticResource PhaseColorConverter}}" Canvas.Left="50" />
- <Ellipse Width="20" Height="20" StrokeThickness="4" Stroke="{Binding Phase, ConverterParameter=OutputRegistration, Converter={StaticResource PhaseColorConverter}}" Canvas.Left="100" />
- <Ellipse Width="20" Height="20" StrokeThickness="4" Stroke="{Binding Phase, ConverterParameter=Signing, Converter={StaticResource PhaseColorConverter}}" Canvas.Left="150" />
- <Line StartPoint="20,10" EndPoint="50,10" StrokeThickness="4" Stroke="{Binding Phase, ConverterParameter=InputRegistration, Converter={StaticResource PhaseColorConverter}}" />
- <Line StartPoint="70,10" EndPoint="100,10" StrokeThickness="4" Stroke="{Binding Phase, ConverterParameter=ConnectionConfirmation, Converter={StaticResource PhaseColorConverter}}" />
- <Line StartPoint="120,10" EndPoint="150,10" StrokeThickness="4" Stroke="{Binding Phase, ConverterParameter=OutputRegistration, Converter={StaticResource PhaseColorConverter}}" />
+ <Ellipse Width="20" Height="20" StrokeThickness="4" Stroke="{Binding PhaseState, ConverterParameter=InputRegistration, Converter={StaticResource PhaseColorConverter}}" Canvas.Left="0" />
+ <Ellipse Width="20" Height="20" StrokeThickness="4" Stroke="{Binding PhaseState, ConverterParameter=ConnectionConfirmation, Converter={StaticResource PhaseColorConverter}}" Canvas.Left="50" />
+ <Ellipse Width="20" Height="20" StrokeThickness="4" Stroke="{Binding PhaseState, ConverterParameter=OutputRegistration, Converter={StaticResource PhaseColorConverter}}" Canvas.Left="100" />
+ <Ellipse Width="20" Height="20" StrokeThickness="4" Stroke="{Binding PhaseState, ConverterParameter=Signing, Converter={StaticResource PhaseColorConverter}}" Canvas.Left="150" />
+ <Line StartPoint="20,10" EndPoint="50,10" StrokeThickness="4" Stroke="{Binding PhaseState, ConverterParameter=InputRegistration, Converter={StaticResource PhaseColorConverter}}" />
+ <Line StartPoint="70,10" EndPoint="100,10" StrokeThickness="4" Stroke="{Binding PhaseState, ConverterParameter=ConnectionConfirmation, Converter={StaticResource PhaseColorConverter}}" />
+ <Line StartPoint="120,10" EndPoint="150,10" StrokeThickness="4" Stroke="{Binding PhaseState, ConverterParameter=OutputRegistration, Converter={StaticResource PhaseColorConverter}}" />
</Canvas>
</StackPanel>
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" Spacing="4" Margin="0 12">
- <TextBlock VerticalAlignment="Center" Foreground="YellowGreen" Text="{Binding Phase, Converter={StaticResource PhaseStringConverter}}" />
+ <TextBlock VerticalAlignment="Center" Foreground="YellowGreen" Text="{Binding PhaseState, Converter={StaticResource PhaseStringConverter}}" />
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal" Spacing="4" IsVisible="{Binding TimeLeftTillRoundTimeout, Converter={StaticResource TimeSpanVisibilityConverter}}">
<TextBlock Text="Registration Ends In:" />

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinJoinTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinJoinTabViewModel.cs
@@ -31,7 +31,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private CompositeDisposable Disposables { get; set; }
private long _roundId;
- private RoundPhase _phase;
+ private PhaseState _phase;
private DateTimeOffset _roundTimesout;
private TimeSpan _timeLeftTillRoundTimeout;
private Money _requiredBTC;
@@ -159,7 +159,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
if (mostAdvancedRound != default)
{
RoundId = mostAdvancedRound.State.RoundId;
- Phase = mostAdvancedRound.State.Phase;
+ PhaseState = new PhaseState(mostAdvancedRound.State.Phase, Global.WalletService.ChaumianClient?.State.IsInErrorState ?? false);
RoundTimesout = mostAdvancedRound.State.Phase == RoundPhase.InputRegistration ? mostAdvancedRound.State.InputRegistrationTimesout : DateTimeOffset.UtcNow;
PeersRegistered = mostAdvancedRound.State.RegisteredPeerCount;
PeersNeeded = mostAdvancedRound.State.RequiredPeerCount;
@@ -167,7 +167,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
else
{
RoundId = -1;
- Phase = RoundPhase.InputRegistration;
+ PhaseState = new PhaseState(RoundPhase.InputRegistration, false);
RoundTimesout = DateTimeOffset.UtcNow;
PeersRegistered = 0;
PeersNeeded = 100;
@@ -300,10 +300,15 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
RoundId = mostAdvancedRound.State.RoundId;
if (!chaumianClient.State.IsInErrorState)
{
- Phase = mostAdvancedRound.State.Phase;
+ PhaseState = new PhaseState(mostAdvancedRound.State.Phase, false);
RoundTimesout = mostAdvancedRound.State.Phase == RoundPhase.InputRegistration ? mostAdvancedRound.State.InputRegistrationTimesout : DateTimeOffset.UtcNow;
}
- this.RaisePropertyChanged(nameof(Phase));
+ else
+ {
+ PhaseState = new PhaseState(PhaseState.Phase, true);
+ }
+
+ this.RaisePropertyChanged(nameof(PhaseState));
this.RaisePropertyChanged(nameof(RoundTimesout));
PeersRegistered = mostAdvancedRound.State.RegisteredPeerCount;
PeersNeeded = mostAdvancedRound.State.RequiredPeerCount;
@@ -375,7 +380,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
set => this.RaiseAndSetIfChanged(ref _roundId, value);
}
- public RoundPhase Phase
+ public PhaseState PhaseState
{
get => _phase;
set => this.RaiseAndSetIfChanged(ref _phase, value);

MODIFY
WalletWasabi.Gui/Converters/PhaseColorConverter.cs
WalletWasabi.Gui/Converters/PhaseColorConverter.cs
-using Avalonia;
using Avalonia.Data.Converters;
using Avalonia.Media;
-using Splat;
using System;
-using System.Collections.Generic;
using System.Globalization;
-using System.Text;
using WalletWasabi.CoinJoin.Common.Models;
+using WalletWasabi.Gui.Controls.WalletExplorer;
namespace WalletWasabi.Gui.Converters
{
@@ -19,11 +16,10 @@ namespace WalletWasabi.Gui.Converters
throw new ArgumentException($"Unknown '{parameter}' value");
}
- var global = Locator.Current.GetService<Global>();
- var phaseError = global.WalletService.ChaumianClient.State.IsInErrorState;
+ var phaseState = (PhaseState)value;
- return (RoundPhase)p <= (RoundPhase)value
- ? phaseError
+ return (RoundPhase)p <= phaseState.Phase
+ ? phaseState.Error
? Brushes.IndianRed
: Brushes.Green
: Brushes.Gray;

MODIFY
WalletWasabi.Gui/Converters/PhaseStringConverter.cs
WalletWasabi.Gui/Converters/PhaseStringConverter.cs
@@ -5,6 +5,7 @@ using System.Globalization;
using System.Text;
using WalletWasabi.CoinJoin.Common.Models;
using WalletWasabi.Exceptions;
+using WalletWasabi.Gui.Controls.WalletExplorer;
namespace WalletWasabi.Gui.Converters
{
@@ -12,9 +13,9 @@ namespace WalletWasabi.Gui.Converters
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
- if (value is RoundPhase phase)
+ if (value is PhaseState phase)
{
- return phase switch
+ return phase.Phase switch
{
RoundPhase.InputRegistration => "Registration",
RoundPhase.ConnectionConfirmation => "Connection Confirmation",
@@ -35,19 +36,19 @@ namespace WalletWasabi.Gui.Converters
if (s.Equals("Registration", StringComparison.OrdinalIgnoreCase) || s.Equals(RoundPhase.InputRegistration.ToString(), StringComparison.OrdinalIgnoreCase))
{
- return RoundPhase.InputRegistration;
+ return new PhaseState(RoundPhase.InputRegistration, false);
}
else if (s.Equals("Connection Confirmation", StringComparison.OrdinalIgnoreCase) || s.Equals(RoundPhase.ConnectionConfirmation.ToString(), StringComparison.OrdinalIgnoreCase))
{
- return RoundPhase.ConnectionConfirmation;
+ return new PhaseState(RoundPhase.ConnectionConfirmation, false);
}
else if (s.Equals("Output Registration", StringComparison.OrdinalIgnoreCase) || s.Equals(RoundPhase.OutputRegistration.ToString(), StringComparison.OrdinalIgnoreCase))
{
- return RoundPhase.OutputRegistration;
+ return new PhaseState(RoundPhase.OutputRegistration, false);
}
else if (s.Equals("Signing", StringComparison.OrdinalIgnoreCase) || s.Equals(RoundPhase.Signing.ToString(), StringComparison.OrdinalIgnoreCase))
{
- return RoundPhase.Signing;
+ return new PhaseState(RoundPhase.Signing, false);
}
throw new InvalidOperationException();

fix phaseState colour converter so it will work with multiple wallets.

# Conflicts:
#	WalletWasabi.Gui/Converters/PhaseColorConverter.cs