CodeMaid Gui project
MODIFY
WalletWasabi.Gui/AvaloniaGlobalComponent.cs
WalletWasabi.Gui/AvaloniaGlobalComponent.cs
@@ -13,6 +13,7 @@ namespace WalletWasabi.Gui
// Avalonia, we can't use Avalonia's IoC to create our singleton as it will
// create a new instance.
public static Global AvaloniaInstance { get; set; }
+
public Global Global => AvaloniaInstance;
}
}

MODIFY
WalletWasabi.Gui/CommandLine/Daemon.cs
WalletWasabi.Gui/CommandLine/Daemon.cs
@@ -13,10 +13,12 @@ namespace WalletWasabi.Gui.CommandLine
public class Daemon
{
public Global Global { get; }
+
public Daemon(Global global)
{
Global = global;
}
+
internal async Task RunAsync(string walletName, bool mixAll, bool keepMixAlive)
{
try

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinViewModel.cs
@@ -24,6 +24,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private ObservableAsPropertyHelper<bool> _unavailable;
private CoinListViewModel _owner;
public Global Global => _owner.Global;
+
public CoinViewModel(CoinListViewModel owner, SmartCoin model)
{
Model = model;

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/WalletExplorerViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/WalletExplorerViewModel.cs
@@ -28,6 +28,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
[Import]
public AvaloniaGlobalComponent GlobalComponent { get; set; }
+
public Global Global => GlobalComponent?.Global;
private ObservableCollection<WalletViewModel> _wallets;

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/WalletViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/WalletViewModel.cs
@@ -26,6 +26,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
get => _isExpanded;
set => this.RaiseAndSetIfChanged(ref _isExpanded, value);
}
+
public WalletViewModel(Global global, bool receiveDominant)
: base(global, Path.GetFileNameWithoutExtension(global.WalletService.KeyManager.FilePath))
{

MODIFY
WalletWasabi.Gui/MainWindow.xaml.cs
WalletWasabi.Gui/MainWindow.xaml.cs
@@ -42,6 +42,7 @@ namespace WalletWasabi.Gui
(PlatformImpl as Avalonia.Native.WindowImpl).SetTitleBarColor(color);
}
}
+
public Global Global => (DataContext as MainWindowViewModel)?.Global;
private void InitializeComponent()

MODIFY
WalletWasabi.Gui/Program.cs
WalletWasabi.Gui/Program.cs
@@ -15,8 +15,9 @@ namespace WalletWasabi.Gui
{
internal class Program
{
- static Global Global;
+ private static Global Global;
#pragma warning disable IDE1006 // Naming Styles
+
private static async Task Main(string[] args)
#pragma warning restore IDE1006 // Naming Styles
{

MODIFY
WalletWasabi.Gui/Shell/Commands/HelpCommands.cs
WalletWasabi.Gui/Shell/Commands/HelpCommands.cs
@@ -17,6 +17,7 @@ namespace WalletWasabi.Gui.Shell.Commands
internal class HelpCommands
{
public Global Global { get; }
+
[ImportingConstructor]
public HelpCommands(CommandIconService commandIconService, AvaloniaGlobalComponent global)
{

MODIFY
WalletWasabi.Gui/Shell/Commands/ToolCommands.cs
WalletWasabi.Gui/Shell/Commands/ToolCommands.cs
@@ -16,6 +16,7 @@ namespace WalletWasabi.Gui.Shell.Commands
internal class ToolCommands
{
public Global Global { get; }
+
[ImportingConstructor]
public ToolCommands(CommandIconService commandIconService, AvaloniaGlobalComponent global)
{

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/RecoverWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/RecoverWalletViewModel.cs
@@ -27,6 +27,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
private int _minGapLimit;
private ObservableCollection<SuggestionViewModel> _suggestions;
public Global Global { get; }
+
public RecoverWalletViewModel(WalletManagerViewModel owner) : base("Recover Wallet")
{
Global = owner.Global;

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/WalletManagerViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/WalletManagerViewModel.cs
@@ -23,6 +23,7 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
private ViewModelBase _currentView;
private LoadWalletViewModel LoadWalletViewModelDesktop { get; }
private LoadWalletViewModel LoadWalletViewModelHardware { get; }
+
[ImportingConstructor]
public WalletManagerViewModel(AvaloniaGlobalComponent global) : base(global.Global, "Wallet Manager")
{

MODIFY
WalletWasabi.Gui/ViewModels/AddressViewModel.cs
WalletWasabi.Gui/ViewModels/AddressViewModel.cs
@@ -21,6 +21,7 @@ namespace WalletWasabi.Gui.ViewModels
public HdPubKey Model { get; }
public Global Global { get; }
+
public AddressViewModel(HdPubKey model, Global global)
{
Global = global;

MODIFY
WalletWasabi.Gui/ViewModels/MainWindowViewModel.cs
WalletWasabi.Gui/ViewModels/MainWindowViewModel.cs
@@ -83,6 +83,7 @@ namespace WalletWasabi.Gui.ViewModels
get => _canClose;
set => this.RaiseAndSetIfChanged(ref _canClose, value);
}
+
public Global Global { get; internal set; }
}
}

MODIFY
WalletWasabi.Gui/ViewModels/WasabiDocumentTabViewModel.cs
WalletWasabi.Gui/ViewModels/WasabiDocumentTabViewModel.cs
@@ -20,6 +20,7 @@ namespace WalletWasabi.Gui.ViewModels
{
Global = global ?? throw new ArgumentNullException(nameof(global));
}
+
public Global Global { get; }
public Guid Id { get; set; } = Guid.NewGuid();
public virtual string Title { get; set; }

CodeMaid Gui project