public ToolCommands(CommandIconService commandIconService, AvaloniaGlobalComponent global)
        {
            Global = global.Global;
            var walletManagerCommand = ReactiveCommand.Create(OnWalletManager);

            var settingsCommand = ReactiveCommand.Create(() =>
            {
                IoC.Get <IShell>().AddOrSelectDocument(() => new SettingsViewModel(Global));
            });

            Observable
            .Merge(walletManagerCommand.ThrownExceptions)
            .Merge(settingsCommand.ThrownExceptions)
            .Subscribe(OnException);

            WalletManagerCommand = new CommandDefinition(
                "Wallet Manager",
                commandIconService.GetCompletionKindImage("WalletManager"),
                walletManagerCommand);

            SettingsCommand = new CommandDefinition(
                "Settings",
                commandIconService.GetCompletionKindImage("Settings"),
                settingsCommand);
        }
Esempio n. 2
0
        public ToolCommands(CommandIconService commandIconService, AvaloniaGlobalComponent global)
        {
            Global = global.Global;
            var walletManagerCommand = ReactiveCommand.Create(OnWalletManager);

            var settingsCommand = ReactiveCommand.Create(() =>
            {
                IoC.Get <IShell>().AddOrSelectDocument(() => new SettingsViewModel(Global));
            });

#if DEBUG
            var devToolsCommand = ReactiveCommand.Create(() =>
            {
                var devTools = new DevTools(Application.Current.Windows.FirstOrDefault());

                var devToolsWindow = new Window
                {
                    Width         = 1024,
                    Height        = 512,
                    Content       = devTools,
                    DataTemplates =
                    {
                        new ViewLocator <Avalonia.Diagnostics.ViewModels.ViewModelBase>()
                    }
                };

                devToolsWindow.Show();
            });
#endif

            Observable
            .Merge(walletManagerCommand.ThrownExceptions)
            .Merge(settingsCommand.ThrownExceptions)
#if DEBUG
            .Merge(devToolsCommand.ThrownExceptions)
#endif
            .Subscribe(OnException);

            WalletManagerCommand = new CommandDefinition(
                "Wallet Manager",
                commandIconService.GetCompletionKindImage("WalletManager"),
                walletManagerCommand);

            SettingsCommand = new CommandDefinition(
                "Settings",
                commandIconService.GetCompletionKindImage("Settings"),
                settingsCommand);

#if DEBUG
            DevToolsCommand = new CommandDefinition(
                "Dev Tools",
                commandIconService.GetCompletionKindImage("DevTools"),
                devToolsCommand);
#endif
        }
Esempio n. 3
0
        public SystemCommands(CommandIconService commandIconService, AvaloniaGlobalComponent global)
        {
            Global = Guard.NotNull(nameof(Global), global.Global);

            var exit = ReactiveCommand.Create(OnExit);

            exit.ThrownExceptions.Subscribe(ex => Logger.LogWarning(ex));

            ExitCommand = new CommandDefinition(
                "Exit",
                commandIconService.GetCompletionKindImage("Exit"),
                exit);
        }
Esempio n. 4
0
        public ToolCommands(CommandIconService commandIconService, AvaloniaGlobalComponent global)
        {
            Global = global.Global;
            var walletManagerCommand = ReactiveCommand.Create(OnWalletManager);

            var settingsCommand = ReactiveCommand.Create(() =>
                                                         IoC.Get <IShell>().AddOrSelectDocument(() => new SettingsViewModel(Global)));

            var transactionBroadcasterCommand = ReactiveCommand.Create(() =>
                                                                       IoC.Get <IShell>().AddOrSelectDocument(() => new TransactionBroadcasterViewModel(Global)));

#if DEBUG
            var devToolsCommand = ReactiveCommand.Create(() =>
                                                         DevToolsExtensions.OpenDevTools((Application.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime).MainWindow));
#endif
            Observable
            .Merge(walletManagerCommand.ThrownExceptions)
            .Merge(settingsCommand.ThrownExceptions)
            .Merge(transactionBroadcasterCommand.ThrownExceptions)
#if DEBUG
            .Merge(devToolsCommand.ThrownExceptions)
#endif
            .ObserveOn(RxApp.TaskpoolScheduler)
            .Subscribe(ex => Logger.LogError(ex));

            WalletManagerCommand = new CommandDefinition(
                "Wallet Manager",
                commandIconService.GetCompletionKindImage("WalletManager"),
                walletManagerCommand);

            SettingsCommand = new CommandDefinition(
                "Settings",
                commandIconService.GetCompletionKindImage("Settings"),
                settingsCommand);

            TransactionBroadcasterCommand = new CommandDefinition(
                "Transaction Broadcaster",
                commandIconService.GetCompletionKindImage("BroadcastTransaction"),
                transactionBroadcasterCommand);

#if DEBUG
            DevToolsCommand = new CommandDefinition(
                "Dev Tools",
                commandIconService.GetCompletionKindImage("DevTools"),
                devToolsCommand);
#endif
        }
Esempio n. 5
0
        public DiskCommands(CommandIconService commandIconService, AvaloniaGlobalComponent global)
        {
            Global = global.Global;
            var onOpenDataFolder    = ReactiveCommand.Create(OnOpenDataFolder);
            var onOpenWalletsFolder = ReactiveCommand.Create(OnOpenWalletsFolder);
            var onOpenLogFile       = ReactiveCommand.Create(OnOpenLogFile);
            var onOpenTorLogFile    = ReactiveCommand.Create(OnOpenTorLogFile);
            var onOpenConfigFile    = ReactiveCommand.Create(OnOpenConfigFile);

            Observable
            .Merge(onOpenConfigFile.ThrownExceptions)
            .Merge(onOpenWalletsFolder.ThrownExceptions)
            .Merge(onOpenLogFile.ThrownExceptions)
            .Merge(onOpenTorLogFile.ThrownExceptions)
            .Merge(onOpenConfigFile.ThrownExceptions)
            .ObserveOn(RxApp.TaskpoolScheduler)
            .Subscribe(ex => Logger.LogError(ex));

            OpenDataFolderCommand = new CommandDefinition(
                "Data Folder",
                commandIconService.GetCompletionKindImage("FolderOpen"),
                onOpenDataFolder);

            OpenWalletsFolderCommand = new CommandDefinition(
                "Wallets Folder",
                commandIconService.GetCompletionKindImage("FolderOpen"),
                onOpenWalletsFolder);

            OpenLogFileCommand = new CommandDefinition(
                "Log File",
                commandIconService.GetCompletionKindImage("Log"),
                onOpenLogFile);

            OpenTorLogFileCommand = new CommandDefinition(
                "Tor Log File",
                commandIconService.GetCompletionKindImage("Log"),
                onOpenTorLogFile);

            OpenConfigFileCommand = new CommandDefinition(
                "Config File",
                commandIconService.GetCompletionKindImage("Settings"),
                onOpenConfigFile);
        }
Esempio n. 6
0
        public SystemCommands(CommandIconService commandIconService, AvaloniaGlobalComponent global)
        {
            Global = Guard.NotNull(nameof(Global), global.Global);

            ExitCommand = new CommandDefinition(
                "Exit",
                commandIconService.GetCompletionKindImage("Exit"),
                ReactiveCommand.Create(OnExit));

            LockScreenCommand = new CommandDefinition(
                "Lock Screen",
                commandIconService.GetCompletionKindImage("Lock"),
                ReactiveCommand.Create(() => { Global.UiConfig.LockScreenActive = true; }));

            Observable
            .Merge(ExitCommand.GetReactiveCommand().ThrownExceptions)
            .Merge(ExitCommand.GetReactiveCommand().ThrownExceptions)
            .ObserveOn(RxApp.TaskpoolScheduler)
            .Subscribe(ex => Logger.LogWarning(ex));
        }
Esempio n. 7
0
        public ToolCommands(CommandIconService commandIconService, AvaloniaGlobalComponent global)
        {
            Global = global.Global;
            var walletManagerCommand = ReactiveCommand.Create(OnWalletManager);

            var settingsCommand = ReactiveCommand.Create(() => IoC.Get <IShell>().AddOrSelectDocument(() => new SettingsViewModel(Global)));

#if DEBUG
            var devToolsCommand = ReactiveCommand.Create(() =>
            {
                DevToolsExtensions.OpenDevTools((Application.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime).MainWindow);
            });
#endif

            Observable
            .Merge(walletManagerCommand.ThrownExceptions)
            .Merge(settingsCommand.ThrownExceptions)
#if DEBUG
            .Merge(devToolsCommand.ThrownExceptions)
#endif
            .Subscribe(OnException);

            WalletManagerCommand = new CommandDefinition(
                "Wallet Manager",
                commandIconService.GetCompletionKindImage("WalletManager"),
                walletManagerCommand);

            SettingsCommand = new CommandDefinition(
                "Settings",
                commandIconService.GetCompletionKindImage("Settings"),
                settingsCommand);

#if DEBUG
            DevToolsCommand = new CommandDefinition(
                "Dev Tools",
                commandIconService.GetCompletionKindImage("DevTools"),
                devToolsCommand);
#endif
        }
Esempio n. 8
0
        public WalletManagerViewModel(AvaloniaGlobalComponent global) : base(global.Global, "Wallet Manager")
        {
            LoadWalletViewModelDesktop  = new LoadWalletViewModel(this, LoadWalletType.Desktop);
            LoadWalletViewModelHardware = new LoadWalletViewModel(this, LoadWalletType.Hardware);

            Categories = new ObservableCollection <CategoryViewModel>
            {
                new GenerateWalletViewModel(this),
                new RecoverWalletViewModel(this),
                LoadWalletViewModelDesktop,
                new LoadWalletViewModel(this, LoadWalletType.Password),
                LoadWalletViewModelHardware
            };

            SelectedCategory = Categories.FirstOrDefault();

            this.WhenAnyValue(x => x.SelectedCategory).Subscribe(category =>
            {
                category?.OnCategorySelected();

                CurrentView = category;
            });
        }
Esempio n. 9
0
        public SystemCommands(CommandIconService commandIconService, AvaloniaGlobalComponent global)
        {
            Global = Guard.NotNull(nameof(Global), global.Global);

            var exit = ReactiveCommand.Create(OnExit);

            exit.ThrownExceptions.Subscribe(ex => Logger.LogWarning(ex));

            ExitCommand = new CommandDefinition(
                "Exit",
                commandIconService.GetCompletionKindImage("Exit"),
                exit);

                                #pragma warning disable IDE0053 // Use expression body for lambda expressions
            var lockCommand = ReactiveCommand.Create(() => { Global.UiConfig.LockScreenActive = true; });
                                #pragma warning restore IDE0053 // Use expression body for lambda expressions

            lockCommand.ThrownExceptions.Subscribe(ex => Logger.LogWarning(ex));

            LockScreenCommand = new CommandDefinition(
                "Lock Screen",
                commandIconService.GetCompletionKindImage("Lock"),
                lockCommand);
        }
Esempio n. 10
0
        public HelpCommands(CommandIconService commandIconService, AvaloniaGlobalComponent global)
        {
            Global       = global.Global;
            AboutCommand = new CommandDefinition(
                "About",
                commandIconService.GetCompletionKindImage("About"),
                ReactiveCommand.Create(() =>
            {
                IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel(Global));
            }));

            CustomerSupportCommand = new CommandDefinition(
                "Customer Support",
                commandIconService.GetCompletionKindImage("CustomerSupport"),
                ReactiveCommand.Create(() =>
            {
                try
                {
                    IoHelpers.OpenBrowser("https://www.reddit.com/r/WasabiWallet/");
                }
                catch (Exception ex)
                {
                    Logging.Logger.LogWarning <HelpCommands>(ex);
                    IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel(Global));
                }
            }));

            ReportBugCommand = new CommandDefinition(
                "Report Bug",
                commandIconService.GetCompletionKindImage("ReportBug"),
                ReactiveCommand.Create(() =>
            {
                try
                {
                    IoHelpers.OpenBrowser("https://github.com/zkSNACKs/WalletWasabi/issues");
                }
                catch (Exception ex)
                {
                    Logging.Logger.LogWarning <HelpCommands>(ex);
                    IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel(Global));
                }
            }));

            FaqCommand = new CommandDefinition(
                "FAQ",
                commandIconService.GetCompletionKindImage("Faq"),
                ReactiveCommand.Create(() =>
            {
                try
                {
                    IoHelpers.OpenBrowser("https://github.com/zkSNACKs/WalletWasabi/blob/master/WalletWasabi.Documentation/FAQ.md");
                }
                catch (Exception ex)
                {
                    Logging.Logger.LogWarning <HelpCommands>(ex);
                    IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel(Global));
                }
            }));

            PrivacyPolicyCommand = new CommandDefinition(
                "Privacy Policy",
                commandIconService.GetCompletionKindImage("PrivacyPolicy"),
                ReactiveCommand.Create(() =>
            {
                IoC.Get <IShell>().AddOrSelectDocument(() => new PrivacyPolicyViewModel(Global));
            }));

            TermsAndConditionsCommand = new CommandDefinition(
                "Terms and Conditions",
                commandIconService.GetCompletionKindImage("TermsAndConditions"),
                ReactiveCommand.Create(() =>
            {
                IoC.Get <IShell>().AddOrSelectDocument(() => new TermsAndConditionsViewModel(Global));
            }));

            LegalIssuesCommand = new CommandDefinition(
                "Legal Issues",
                commandIconService.GetCompletionKindImage("LegalIssues"),
                ReactiveCommand.Create(() =>
            {
                IoC.Get <IShell>().AddOrSelectDocument(() => new LegalIssuesViewModel(Global));
            }));

#if DEBUG
            DevToolsCommand = new CommandDefinition(
                "Dev Tools",
                commandIconService.GetCompletionKindImage("DevTools"),
                ReactiveCommand.Create(() =>
            {
                var devTools = new DevTools(Application.Current.Windows.FirstOrDefault());

                var devToolsWindow = new Window {
                    Width         = 1024,
                    Height        = 512,
                    Content       = devTools,
                    DataTemplates =
                    {
                        new ViewLocator <Avalonia.Diagnostics.ViewModels.ViewModelBase>(),
                    }
                };

                devToolsWindow.Show();
            }));
#endif
        }
Esempio n. 11
0
        public HelpCommands(CommandIconService commandIconService, AvaloniaGlobalComponent global)
        {
            Global       = global.Global;
            AboutCommand = new CommandDefinition(
                "About",
                commandIconService.GetCompletionKindImage("About"),
                ReactiveCommand.Create(() =>
            {
                IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel(Global));
            }));

            CustomerSupportCommand = new CommandDefinition(
                "Customer Support",
                commandIconService.GetCompletionKindImage("CustomerSupport"),
                ReactiveCommand.Create(() =>
            {
                try
                {
                    IoHelpers.OpenBrowser("https://www.reddit.com/r/WasabiWallet/");
                }
                catch (Exception ex)
                {
                    Logging.Logger.LogWarning <HelpCommands>(ex);
                    IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel(Global));
                }
            }));

            ReportBugCommand = new CommandDefinition(
                "Report Bug",
                commandIconService.GetCompletionKindImage("ReportBug"),
                ReactiveCommand.Create(() =>
            {
                try
                {
                    IoHelpers.OpenBrowser("https://github.com/zkSNACKs/WalletWasabi/issues");
                }
                catch (Exception ex)
                {
                    Logging.Logger.LogWarning <HelpCommands>(ex);
                    IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel(Global));
                }
            }));

            DocsCommand = new CommandDefinition(
                "Documentation",
                commandIconService.GetCompletionKindImage("Documentation"),
                ReactiveCommand.Create(() =>
            {
                try
                {
                    IoHelpers.OpenBrowser("https://docs.wasabiwallet.io/");
                }
                catch (Exception ex)
                {
                    Logging.Logger.LogWarning <HelpCommands>(ex);
                    IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel(Global));
                }
            }));

            PrivacyPolicyCommand = new CommandDefinition(
                "Privacy Policy",
                commandIconService.GetCompletionKindImage("PrivacyPolicy"),
                ReactiveCommand.Create(() =>
            {
                IoC.Get <IShell>().AddOrSelectDocument(() => new PrivacyPolicyViewModel(Global));
            }));

            TermsAndConditionsCommand = new CommandDefinition(
                "Terms and Conditions",
                commandIconService.GetCompletionKindImage("TermsAndConditions"),
                ReactiveCommand.Create(() =>
            {
                IoC.Get <IShell>().AddOrSelectDocument(() => new TermsAndConditionsViewModel(Global));
            }));

            LegalIssuesCommand = new CommandDefinition(
                "Legal Issues",
                commandIconService.GetCompletionKindImage("LegalIssues"),
                ReactiveCommand.Create(() =>
            {
                IoC.Get <IShell>().AddOrSelectDocument(() => new LegalIssuesViewModel(Global));
            }));
        }
Esempio n. 12
0
        public HelpCommands(CommandIconService commandIconService, AvaloniaGlobalComponent global)
        {
            Global       = global.Global;
            AboutCommand = new CommandDefinition(
                "About",
                commandIconService.GetCompletionKindImage("About"),
                ReactiveCommand.Create(() => IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel(Global))));

            CustomerSupportCommand = new CommandDefinition(
                "Customer Support",
                commandIconService.GetCompletionKindImage("CustomerSupport"),
                ReactiveCommand.Create(() =>
            {
                try
                {
                    IoHelpers.OpenBrowser("https://www.reddit.com/r/WasabiWallet/");
                }
                catch (Exception ex)
                {
                    Logger.LogWarning(ex);
                    IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel(Global));
                }
            }));

            ReportBugCommand = new CommandDefinition(
                "Report Bug",
                commandIconService.GetCompletionKindImage("ReportBug"),
                ReactiveCommand.Create(() =>
            {
                try
                {
                    IoHelpers.OpenBrowser("https://github.com/zkSNACKs/WalletWasabi/issues");
                }
                catch (Exception ex)
                {
                    Logger.LogWarning(ex);
                    IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel(Global));
                }
            }));

            DocsCommand = new CommandDefinition(
                "Documentation",
                commandIconService.GetCompletionKindImage("Documentation"),
                ReactiveCommand.Create(() =>
            {
                try
                {
                    IoHelpers.OpenBrowser("https://docs.wasabiwallet.io/");
                }
                catch (Exception ex)
                {
                    Logger.LogWarning(ex);
                    IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel(Global));
                }
            }));

            LegalDocumentsCommand = new CommandDefinition(
                "Legal Documents",
                commandIconService.GetCompletionKindImage("LegalDocuments"),
                ReactiveCommand.Create(() => IoC.Get <IShell>().AddOrSelectDocument(() => new LegalDocumentsViewModel(Global))));

            Observable
            .Merge(AboutCommand.GetReactiveCommand().ThrownExceptions)
            .Merge(CustomerSupportCommand.GetReactiveCommand().ThrownExceptions)
            .Merge(ReportBugCommand.GetReactiveCommand().ThrownExceptions)
            .Merge(DocsCommand.GetReactiveCommand().ThrownExceptions)
            .Merge(LegalDocumentsCommand.GetReactiveCommand().ThrownExceptions)
            .ObserveOn(RxApp.TaskpoolScheduler)
            .Subscribe(ex => Logger.LogError(ex));
        }