Skip to content
Permalink
Browse files

[WIP] UI shows red circles if the mixing failed

  • Loading branch information...
molnard committed Nov 15, 2018
1 parent 5374d3c commit ee99ebde77f9876520a8750dd218e1b3e871781d
@@ -214,7 +214,11 @@ private void UpdateStates()
{
RoundId = mostAdvancedRound.State.RoundId;
SuccessfulRoundCount = mostAdvancedRound.State.SuccessfulRoundCount;
Phase = mostAdvancedRound.State.Phase;
if (!Global.ChaumianClient.State.IsInErrorState)
{
Phase = mostAdvancedRound.State.Phase;
}
this.RaisePropertyChanged(nameof(Phase));
PeersRegistered = mostAdvancedRound.State.RegisteredPeerCount;
PeersNeeded = mostAdvancedRound.State.RequiredPeerCount;
}
@@ -301,7 +305,9 @@ public int SuccessfulRoundCount
public CcjRoundPhase Phase
{
get { return _phase; }
set { this.RaiseAndSetIfChanged(ref _phase, value); }
set {
this.RaiseAndSetIfChanged(ref _phase, value);
}
}

public Money RequiredBTC
@@ -14,9 +14,10 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
{
if(!Enum.TryParse(typeof(CcjRoundPhase), parameter.ToString(), false, out var p))
throw new ArgumentException($"Unknown '{parameter}' value");
var phaseError = Global.ChaumianClient.State.IsInErrorState;

return ((CcjRoundPhase)p <= (CcjRoundPhase)value)
? Brushes.Green
? (phaseError? Brushes.Red : Brushes.Green)
: Brushes.Gray;
}

@@ -272,7 +272,7 @@ public CcjClientRound GetSingleOrDefaultRound(long roundId)
public void UpdateRoundsByStates(params CcjRunningRoundState[] allRunningRoundsStates)
{
Guard.NotNullOrEmpty(nameof(allRunningRoundsStates), allRunningRoundsStates);

IsInErrorState = false;
lock (StateLock)
{
// Find the rounds those aren't running anymore
@@ -301,6 +301,13 @@ public void UpdateRoundsByStates(params CcjRunningRoundState[] allRunningRoundsS
}

round.AliceClient?.Dispose();

var newSuccessfulRoundCount = allRunningRoundsStates.FirstOrDefault()?.SuccessfulRoundCount;
if (newSuccessfulRoundCount != null && round.State.SuccessfulRoundCount == newSuccessfulRoundCount)
{
IsInErrorState = true;
}

Logger.LogInfo<CcjClientState>($"Round ({round.State.RoundId}) removed. Reason: It's not running anymore.");
}
Rounds.RemoveAll(x => roundsToRemove.Contains(x.State.RoundId));
@@ -325,6 +332,8 @@ public void UpdateRoundsByStates(params CcjRunningRoundState[] allRunningRoundsS
}
}

public bool IsInErrorState { get; private set; }

public void AddOrReplaceRound(CcjClientRound round)
{
lock (StateLock)

0 comments on commit ee99ebd

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