Disable deselecting legal docs
MODIFY
WalletWasabi.Gui/ViewModels/WasabiDocumentTabViewModel.cs
WalletWasabi.Gui/ViewModels/WasabiDocumentTabViewModel.cs
@@ -6,10 +6,12 @@ using AvalonStudio.Shell;
using Dock.Model;
using ReactiveUI;
using System;
+using System.Linq;
using System.Reactive;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Threading.Tasks;
+using WalletWasabi.Gui.Tabs;
using WalletWasabi.Helpers;
using WalletWasabi.Logging;
@@ -66,9 +68,12 @@ namespace WalletWasabi.Gui.ViewModels
public bool IsDirty { get; set; }
public virtual void OnSelected()
+ {
+ if (!LegalBarrier())
{
IsSelected = true;
}
+ }
public virtual void OnDeselected()
{
@@ -135,5 +140,22 @@ namespace WalletWasabi.Gui.ViewModels
}
return DialogResult;
}
+
+ /// <returns>True if barrier is active.</returns>
+ private bool LegalBarrier()
+ {
+ // If legal docs not accepted then make sure it's selected.
+ if (!(this is LegalDocumentsViewModel))
+ {
+ var foundLegalTab = IoC.Get<IShell>().Documents.OfType<LegalDocumentsViewModel>().FirstOrDefault();
+ if (foundLegalTab is { } && !foundLegalTab.IsAgreed)
+ {
+ IoC.Get<IShell>().Select(foundLegalTab);
+ return true;
+ }
+ }
+
+ return false;
+ }
}
}

Disable deselecting legal docs