public SystemCommands(CommandIconService commandIconService) { var global = Locator.Current.GetService <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)); }
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)); }
public WalletCommands(CommandIconService commandIconService) { GenerateWalletCommand = new CommandDefinition( "Generate Wallet", commandIconService.GetCompletionKindImage("GenerateWallet"), ReactiveCommand.Create(OnGenerateWallet)); RecoverWalletCommand = new CommandDefinition( "Recover Wallet", commandIconService.GetCompletionKindImage("RecoverWallet"), ReactiveCommand.Create(OnRecoverWallet)); LoadWallet = new CommandDefinition( "Load Wallet", commandIconService.GetCompletionKindImage("LoadWallet"), ReactiveCommand.Create(OnLoadWallet)); Observable .Merge(GenerateWalletCommand.GetReactiveCommand().ThrownExceptions) .Merge(RecoverWalletCommand.GetReactiveCommand().ThrownExceptions) .Merge(LoadWallet.GetReactiveCommand().ThrownExceptions) .ObserveOn(RxApp.TaskpoolScheduler) .Subscribe(ex => Logger.LogError(ex)); }
public HelpCommands(CommandIconService commandIconService) { AboutCommand = new CommandDefinition( "About", commandIconService.GetCompletionKindImage("About"), ReactiveCommand.Create(() => IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel()))); CustomerSupportCommand = new CommandDefinition( "Customer Support", commandIconService.GetCompletionKindImage("CustomerSupport"), ReactiveCommand.CreateFromTask(async() => { try { await IoHelpers.OpenBrowserAsync("https://www.reddit.com/r/WasabiWallet/"); } catch (Exception ex) { Logger.LogWarning(ex); IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel()); } })); ReportBugCommand = new CommandDefinition( "Report Bug", commandIconService.GetCompletionKindImage("ReportBug"), ReactiveCommand.CreateFromTask(async() => { try { await IoHelpers.OpenBrowserAsync("https://github.com/zkSNACKs/WalletWasabi/issues"); } catch (Exception ex) { Logger.LogWarning(ex); IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel()); } })); DocsCommand = new CommandDefinition( "Documentation", commandIconService.GetCompletionKindImage("Documentation"), ReactiveCommand.CreateFromTask(async() => { try { await IoHelpers.OpenBrowserAsync("https://docs.wasabiwallet.io/"); } catch (Exception ex) { Logger.LogWarning(ex); IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel()); } })); LegalDocumentsCommand = new CommandDefinition( "Legal Documents", commandIconService.GetCompletionKindImage("LegalDocuments"), ReactiveCommand.Create(() => IoC.Get <IShell>().AddOrSelectDocument(() => new LegalDocumentsViewModel()))); 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)); }
public HelpCommands(CommandIconService commandIconService) { AboutCommand = new CommandDefinition( "About", commandIconService.GetCompletionKindImage("About"), ReactiveCommand.Create(() => IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel()))); UserSupportCommand = new CommandDefinition( "User Support", commandIconService.GetCompletionKindImage("UserSupport"), ReactiveCommand.CreateFromTask(async() => { try { await IoHelpers.OpenBrowserAsync("https://www.reddit.com/r/Groestlcoin/"); } catch (Exception ex) { Logger.LogWarning(ex); IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel()); } })); ReportBugCommand = new CommandDefinition( "Report Bug", commandIconService.GetCompletionKindImage("ReportBug"), ReactiveCommand.CreateFromTask(async() => { try { await IoHelpers.OpenBrowserAsync("https://github.com/Groestlcoin/WalletWasabi/issues"); } catch (Exception ex) { Logger.LogWarning(ex); IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel()); } })); DocsCommand = new CommandDefinition( "Documentation", commandIconService.GetCompletionKindImage("Documentation"), ReactiveCommand.CreateFromTask(async() => { try { await IoHelpers.OpenBrowserAsync("https://groestlcoin.org/forum/"); } catch (Exception ex) { Logger.LogWarning(ex); IoC.Get <IShell>().AddOrSelectDocument(() => new AboutViewModel()); } })); LegalDocumentsCommand = new CommandDefinition( "Legal Documents", commandIconService.GetCompletionKindImage("LegalDocuments"), ReactiveCommand.Create(() => IoC.Get <IShell>().AddOrSelectDocument(() => new LegalDocumentsViewModel(legalDoc: Locator.Current.GetService <Global>()?.LegalDocuments)))); Observable .Merge(AboutCommand.GetReactiveCommand().ThrownExceptions) .Merge(UserSupportCommand.GetReactiveCommand().ThrownExceptions) .Merge(ReportBugCommand.GetReactiveCommand().ThrownExceptions) .Merge(DocsCommand.GetReactiveCommand().ThrownExceptions) .Merge(LegalDocumentsCommand.GetReactiveCommand().ThrownExceptions) .ObserveOn(RxApp.TaskpoolScheduler) .Subscribe(ex => { Logger.LogError(ex); NotificationHelpers.Error(ex.ToUserFriendlyString()); }); }