Make sure every status stuff is set on the UI thread
MODIFY
WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
@@ -51,6 +51,8 @@ namespace WalletWasabi.Gui.ViewModels
private int _blocksLeft;
private string _btcPrice;
private StatusBarStatus _status;
+ private List<StatusBarStatus> StatusQueue { get; } = new List<StatusBarStatus>();
+ private object StatusQueueLock { get; } = new object();
public StatusBarViewModel()
{
@@ -297,10 +299,6 @@ namespace WalletWasabi.Gui.ViewModels
}
}
- private List<StatusBarStatus> StatusQueue { get; } = new List<StatusBarStatus>();
-
- private object StatusQueueLock { get; } = new object();
-
public void TryAddStatus(StatusBarStatus status)
{
try
@@ -344,24 +342,22 @@ namespace WalletWasabi.Gui.ViewModels
{
lock (StatusQueueLock)
{
- if (!TrySetPriorityStatus())
- {
- SetCustomStatusOrReady();
- }
+ RefreshStatusNoLock();
}
}
private void RefreshStatusNoLock()
+ {
+ Dispatcher.UIThread.PostLogException(() =>
{
if (!TrySetPriorityStatus())
{
SetCustomStatusOrReady();
}
+ });
}
private void SetCustomStatusOrReady()
- {
- Dispatcher.UIThread.PostLogException(() =>
{
if (StatusQueue.Any())
{
@@ -371,7 +367,6 @@ namespace WalletWasabi.Gui.ViewModels
{
Status = StatusBarStatus.Ready;
}
- });
}
private bool TrySetPriorityStatus()
@@ -401,15 +396,21 @@ namespace WalletWasabi.Gui.ViewModels
}
private void SetPeers(int peers)
+ {
+ Dispatcher.UIThread.PostLogException(() =>
{
// Set peers to 0 if Tor is not running, because we get Tor status from backend answer so it's seem to the user that peers are connected over clearnet, while they don't.
Peers = Tor == TorStatus.NotRunning ? 0 : peers;
+ });
}
private void SetTor(TorStatus tor)
+ {
+ Dispatcher.UIThread.PostLogException(() =>
{
// Set peers to 0 if Tor is not running, because we get Tor status from backend answer so it's seem to the user that peers are connected over clearnet, while they don't.
Tor = UseTor ? tor : TorStatus.TurnedOff;
+ });
}
#region IDisposable Support

Make sure every status stuff is set on the UI thread