예제 #1
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
        }
예제 #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(() =>
            {
                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
        }