Add Show button to Tray menu
MODIFY
WalletWasabi.Fluent/App.axaml
WalletWasabi.Fluent/App.axaml
<TrayIcon Icon="/Assets/WasabiLogo.ico">
<NativeMenu.Menu>
<NativeMenu>
- <NativeMenuItem Header="Quit Wasabi Wallet" Command="{Binding QuitCommand}" />
+ <NativeMenuItem Header="Show" Command="{Binding ShowCommand}" />
+ <NativeMenuItemSeparator />
+ <NativeMenuItem Header="Quit" Command="{Binding QuitCommand}" />
</NativeMenu>
</NativeMenu.Menu>
</TrayIcon>

MODIFY
WalletWasabi.Fluent/Behaviors/HideShowBehavior.cs
WalletWasabi.Fluent/Behaviors/HideShowBehavior.cs
@@ -3,8 +3,10 @@ using System.ComponentModel;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Runtime.InteropServices;
+using Avalonia;
using Avalonia.Controls;
using ReactiveUI;
+using WalletWasabi.Fluent.ViewModels;
using WalletWasabi.Services;
namespace WalletWasabi.Fluent.Behaviors
@@ -21,8 +23,9 @@ namespace WalletWasabi.Fluent.Behaviors
// On macOs the Hide/Show is a natural feature.
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
- Observable
- .FromEventPattern(Services.SingleInstanceChecker, nameof(SingleInstanceChecker.OtherInstanceStarted))
+ Observable.Merge(
+ Observable.FromEventPattern(Services.SingleInstanceChecker, nameof(SingleInstanceChecker.OtherInstanceStarted)),
+ Observable.FromEventPattern(((ApplicationViewModel)Application.Current.DataContext!), nameof(ApplicationViewModel.ShowRequested)))
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(_ =>
{

MODIFY
WalletWasabi.Fluent/ViewModels/ApplicationViewModel.cs
WalletWasabi.Fluent/ViewModels/ApplicationViewModel.cs
@@ -31,9 +31,17 @@ namespace WalletWasabi.Fluent.ViewModels
}
}
});
+
+ ShowCommand = ReactiveCommand.Create(() =>
+ {
+ ShowRequested?.Invoke(this, EventArgs.Empty);
+ });
}
+ public event EventHandler? ShowRequested;
+
public ICommand QuitCommand { get; }
+ public ICommand ShowCommand { get; }
public bool CanShutdown()
{

Add Show button to Tray menu