implement update ui.
MODIFY
WalletWasabi.Gui/Behaviors/CommandBaseBehavior.cs
WalletWasabi.Gui/Behaviors/CommandBaseBehavior.cs
@@ -41,7 +41,7 @@ namespace WalletWasabi.Gui.Behaviors
protected bool ExecuteCommand()
{
- if (Command != null)
+ if (Command != null && Command.CanExecute(CommandParameter))
{
Command.Execute(CommandParameter);
return true;

RENAME
WalletWasabi.Gui/Converters/StatusColorConvertor.cs
WalletWasabi.Gui/Converters/StatusColorConverter.cs
@@ -9,7 +9,7 @@ using WalletWasabi.Models;
namespace WalletWasabi.Gui.Converters
{
- public class StatusColorConvertor : IValueConverter
+ public class StatusColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{

MODIFY
WalletWasabi.Gui/Styles/Styles.xaml
WalletWasabi.Gui/Styles/Styles.xaml
<SolidColorBrush x:Key="HyperLinkForeground">#00A2E8</SolidColorBrush>
<SolidColorBrush x:Key="ErrorMessageForeground">#F25022</SolidColorBrush>
<SolidColorBrush x:Key="WarningMessageForeground">#FFDD00</SolidColorBrush>
+ <SolidColorBrush x:Key="GreenBrush">#00DD10</SolidColorBrush>
<sys:Double x:Key="FontSizeSmall">12</sys:Double>
<sys:Double x:Key="FontSizeNormal">14</sys:Double>

MODIFY
WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
@@ -10,9 +10,21 @@ using WalletWasabi.Models;
using NBitcoin;
using System.Threading.Tasks;
using System.Threading;
+using Avalonia.Threading;
+using AvalonStudio.Extensibility;
+using AvalonStudio.Shell;
+using WalletWasabi.Gui.Tabs;
+using System.Reactive.Linq;
namespace WalletWasabi.Gui.ViewModels
{
+ public enum UpdateStatus
+ {
+ Latest,
+ Optional,
+ Critical
+ }
+
public class StatusBarViewModel : ViewModelBase, IDisposable
{
public NodesCollection Nodes { get; }
@@ -20,6 +32,45 @@ namespace WalletWasabi.Gui.ViewModels
public IndexDownloader IndexDownloader { get; }
public UpdateChecker UpdateChecker { get; }
+ private UpdateStatus _updateStatus;
+
+ public UpdateStatus UpdateStatus
+ {
+ get => _updateStatus;
+ set
+ {
+ if(value != UpdateStatus.Latest)
+ {
+ UpdateAvailable = true;
+
+ if(value == UpdateStatus.Critical)
+ {
+ CriticalUpdateAvailable = true;
+ }
+ }
+
+ this.RaiseAndSetIfChanged(ref _updateStatus, value);
+ }
+ }
+
+ public ReactiveCommand UpdateCommand { get; }
+
+ private bool _updateAvailable;
+
+ public bool UpdateAvailable
+ {
+ get => _updateAvailable;
+ set => this.RaiseAndSetIfChanged(ref _updateAvailable, value);
+ }
+
+ private bool _criticalUpdateAvailable;
+
+ public bool CriticalUpdateAvailable
+ {
+ get => _criticalUpdateAvailable;
+ set => this.RaiseAndSetIfChanged(ref _criticalUpdateAvailable, value);
+ }
+
private BackendStatus _backend;
public BackendStatus Backend
@@ -101,6 +152,7 @@ namespace WalletWasabi.Gui.ViewModels
{
_clientOutOfDate = 0;
_backendIncompatible = 0;
+ UpdateStatus = UpdateStatus.Latest;
Nodes = nodes;
Nodes.Added += Nodes_Added;
@@ -145,15 +197,26 @@ namespace WalletWasabi.Gui.ViewModels
() =>
{
Interlocked.Exchange(ref _backendIncompatible, 1);
+ Dispatcher.UIThread.Post(() =>
+ {
SetStatusAndDoUpdateActions();
+ });
return Task.CompletedTask;
},
() =>
{
Interlocked.Exchange(ref _clientOutOfDate, 1);
+ Dispatcher.UIThread.Post(() =>
+ {
SetStatusAndDoUpdateActions();
+ });
return Task.CompletedTask;
});
+
+ UpdateCommand = ReactiveCommand.Create(() =>
+ {
+ IoC.Get<IShell>().AddOrSelectDocument(() => new AboutViewModel());
+ }, this.WhenAnyValue(x=>x.UpdateStatus).Select(x => x != UpdateStatus.Latest));
}
private void SetStatusAndDoUpdateActions()
@@ -161,15 +224,12 @@ namespace WalletWasabi.Gui.ViewModels
if (Interlocked.Read(ref _backendIncompatible) != 0)
{
Status = "THE BACKEND WAS UPGRADED WITH BREAKING CHANGES - PLEASE UPDATE YOUR SOFTWARE";
- // ToDo: 1. Make the status bar clickable. Click takes the user to the About page. (Where the new release download link is.)
- // ToDo: 2. Remove all the text from the status bar except this one.
- // ToDo: 3. Make the background of the status bar "IndianRed". Other red is fine, but I think IndianRed would look the best.
+ UpdateStatus = UpdateStatus.Critical;
}
else if (Interlocked.Read(ref _clientOutOfDate) != 0)
{
Status = "New Version Is Available";
- // ToDo: 1. Make the status bar clickable. Click takes the user to the About page. (Where the new release download link is.)
- // ToDo: 2. Add a green flag icon to the beginning of this text.
+ UpdateStatus = UpdateStatus.Optional;
}
else if (Tor != TorStatus.Running || Backend != BackendStatus.Connected || Peers < 1)
{

implement update ui.