prevent double loading of legaldocs lockscreen.
MODIFY
WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
@@ -58,6 +58,8 @@ namespace WalletWasabi.Gui.ViewModels
private Global Global { get; }
private StatusSet ActiveStatuses { get; }
+ private bool _legalDocsLoading;
+
public StatusBarViewModel()
{
Global = Locator.Current.GetService<Global>();
@@ -258,6 +260,10 @@ namespace WalletWasabi.Gui.ViewModels
UpdateAvailable = !x.ClientUpToDate;
CriticalUpdateAvailable = !x.BackendCompatible;
+ if (!_legalDocsLoading)
+ {
+ _legalDocsLoading = true;
+
try
{
if (Global.LegalDocuments is null || Global.LegalDocuments.Version < x.LegalDocumentsVersion)
@@ -269,8 +275,7 @@ namespace WalletWasabi.Gui.ViewModels
var filePath = Path.Combine(legalFolderPath, $"{version}.txt");
var legalContent = await client.GetLegalDocumentsAsync(CancellationToken.None);
- MainWindowViewModel.Instance.LockScreen = new LegalDocumentsViewModel(legalContent, new LegalDocuments(filePath));
- MainWindowViewModel.Instance.LockScreen.IsLocked = true;
+ MainWindowViewModel.Instance.PushLockScreen(new LegalDocumentsViewModel(legalContent, new LegalDocuments(filePath)));
}
}
catch (Exception ex)
@@ -278,6 +283,11 @@ namespace WalletWasabi.Gui.ViewModels
Logger.LogError(ex);
NotificationHelpers.Error("Could not get Legal Documents!");
}
+ finally
+ {
+ _legalDocsLoading = false;
+ }
+ }
});
UpdateCommand = ReactiveCommand.CreateFromTask(async () =>

prevent double loading of legaldocs lockscreen.