Example #1
0
        public ConnectHardwareWalletViewModel(string walletName, Network network, WalletManager walletManager)
        {
            Title      = "Hardware Wallet";
            _message   = "";
            IsBusy     = true;
            WalletName = walletName;
            HardwareWalletOperations = new HardwareWalletOperations(walletManager, network);
            HardwareWalletOperations.NoHardwareWalletFound += OnNoHardwareWalletFound;

            BackCommand = ReactiveCommand.Create(() =>
            {
                HardwareWalletOperations.Dispose();
                Navigate().Back();
            });

            CancelCommand = ReactiveCommand.Create(() =>
            {
                HardwareWalletOperations.Dispose();
                Navigate().Clear();
            });

            NextCommand = ReactiveCommand.Create(() =>
            {
                HardwareWalletOperations.StartDetection();
                ContinueButtonEnable = false;
                Message = "";
            });

            // TODO: Create an up-to-date article
            OpenBrowserCommand = ReactiveCommand.CreateFromTask(async() =>
                                                                await IoHelpers.OpenBrowserAsync("https://docs.wasabiwallet.io/using-wasabi/ColdWasabi.html#using-hardware-wallet-step-by-step"));
        }
Example #2
0
    public StatusBarViewModel()
    {
        UseTor         = Services.Config.UseTor; // Do not make it dynamic, because if you change this config settings only next time will it activate.
        TorStatus      = UseTor ? Services.Synchronizer.TorStatus : TorStatus.TurnedOff;
        UseBitcoinCore = Services.Config.StartLocalBitcoinCoreOnStartup;

        UpdateCommand     = ReactiveCommand.CreateFromTask(async() => await IoHelpers.OpenBrowserAsync("https://wasabiwallet.io/#download"));
        AskMeLaterCommand = ReactiveCommand.Create(() => UpdateAvailable = false);

        this.WhenAnyValue(
            x => x.TorStatus,
            x => x.BackendStatus,
            x => x.Peers,
            x => x.BitcoinCoreStatus,
            x => x.UpdateAvailable,
            x => x.CriticalUpdateAvailable,
            x => x.IsConnectionIssueDetected)
        .Throttle(TimeSpan.FromMilliseconds(100))
        .ObserveOn(RxApp.MainThreadScheduler)
        .Subscribe(_ =>
        {
            if (BackendStatus == BackendStatus.Connected)
            {
                IsConnectionIssueDetected = false;
            }

            SetStatusBarState();
        });
    }
Example #3
0
        public ConnectHardwareWalletViewModel(string walletName, WalletManagerViewModel walletManagerViewModel)
        {
            _message       = "";
            WalletName     = walletName;
            WalletManager  = walletManagerViewModel.Model;
            Wallets        = walletManagerViewModel.Wallets;
            AbandonedTasks = new AbandonedTasks();
            CancelCts      = new CancellationTokenSource();

            NextCommand = ReactiveCommand.Create(() =>
            {
                if (DetectedDevice is { } device)
                {
                    NavigateToNext(device);
                    return;
                }

                StartDetection();
            });

            OpenBrowserCommand = ReactiveCommand.CreateFromTask(async() =>
                                                                await IoHelpers.OpenBrowserAsync("https://docs.wasabiwallet.io/using-wasabi/ColdWasabi.html#using-hardware-wallet-step-by-step"));

            NavigateToExistingWalletLoginCommand = ReactiveCommand.Create(() =>
            {
                var navBar = NavigationManager.Get <NavBarViewModel>();

                if (ExistingWallet is { } && navBar is { })
        public LinkViewModel()
        {
            OpenBrowserCommand = ReactiveCommand.CreateFromTask <string>(
                async(link) =>
                await IoHelpers.OpenBrowserAsync(link));

            CopyLinkCommand = ReactiveCommand.CreateFromTask <string>(
                async(link) =>
                await Application.Current.Clipboard.SetTextAsync(link));
        }
    public CrashReportWindowViewModel(SerializableException serializedException)
    {
        SerializedException = serializedException;
        CancelCommand       = ReactiveCommand.Create(AppLifetimeHelper.Restart);
        NextCommand         = ReactiveCommand.Create(AppLifetimeHelper.Shutdown);

        OpenGitHubRepoCommand = ReactiveCommand.CreateFromTask(async() => await IoHelpers.OpenBrowserAsync(AboutViewModel.UserSupportLink));

        CopyTraceCommand = ReactiveCommand.CreateFromTask(async() =>
        {
            if (Application.Current is { Clipboard: { } clipboard })
            {
                await clipboard.SetTextAsync(Trace);
            }
        });
Example #6
0
        public AboutViewModel()
        {
            OpenBrowserCommand = ReactiveCommand.CreateFromTask <string>(IoHelpers.OpenBrowserAsync);

            AboutAdvancedInfoDialogCommand = ReactiveCommand.CreateFromTask(
                execute: async() => await NavigateDialog(new AboutAdvancedInfoViewModel(), NavigationTarget.CompactDialogScreen));

            OpenBrowserCommand = ReactiveCommand.CreateFromTask <string>(
                async(link) =>
                await IoHelpers.OpenBrowserAsync(link));

            CopyLinkCommand = ReactiveCommand.CreateFromTask <string>(
                async(link) =>
                await Application.Current.Clipboard.SetTextAsync(link));

            NextCommand = CancelCommand;
        }
Example #7
0
        public ConnectHardwareWalletViewModel(string walletName)
        {
            _message       = "";
            WalletName     = walletName;
            Wallets        = UiServices.WalletManager.Wallets;
            AbandonedTasks = new AbandonedTasks();
            CancelCts      = new CancellationTokenSource();

            EnableBack = true;

            NextCommand = ReactiveCommand.Create(OnNext);

            OpenBrowserCommand = ReactiveCommand.CreateFromTask(async() =>
                                                                await IoHelpers.OpenBrowserAsync("https://docs.wasabiwallet.io/using-wasabi/ColdWasabi.html#using-hardware-wallet-step-by-step"));

            NavigateToExistingWalletLoginCommand = ReactiveCommand.Create(execute: OnNavigateToExistingWalletLogin);

            this.WhenAnyValue(x => x.Message)
            .ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(message => ConfirmationRequired = !string.IsNullOrEmpty(message));
        }
Example #8
0
        public AboutViewModel()
        {
            OpenBrowserCommand = ReactiveCommand.CreateFromTask <string>(IoHelpers.OpenBrowserAsync);

            var interaction = new Interaction <Unit, Unit>();

            interaction.RegisterHandler(
                async x =>
                x.SetOutput((await new AboutAdvancedInfoViewModel().ShowDialogAsync()).Result));

            AboutAdvancedInfoDialogCommand = ReactiveCommand.CreateFromTask(
                execute: async() => await interaction.Handle(Unit.Default).ToTask());

            OpenBrowserCommand = ReactiveCommand.CreateFromTask <string>(
                async(link) =>
                await IoHelpers.OpenBrowserAsync(link));

            CopyLinkCommand = ReactiveCommand.CreateFromTask <string>(
                async(link) =>
                await Application.Current.Clipboard.SetTextAsync(link));

            NextCommand = CancelCommand;
        }
Example #9
0
        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));
        }
Example #10
0
    public AboutViewModel(bool navigateBack = false)
    {
        EnableBack = navigateBack;

        Links = new List <ViewModelBase>()
        {
            new LinkViewModel()
            {
                Link        = DocsLink,
                Description = "Documentation",
                IsClickable = true
            },
            new SeparatorViewModel(),
            new LinkViewModel()
            {
                Link        = SourceCodeLink,
                Description = "Source Code (GitHub)",
                IsClickable = true
            },
            new SeparatorViewModel(),
            new LinkViewModel()
            {
                Link        = ClearnetLink,
                Description = "Website (Clearnet)",
                IsClickable = true
            },
            new SeparatorViewModel(),
            new LinkViewModel()
            {
                Link        = TorLink,
                Description = "Website (Tor)",
                IsClickable = false
            },
            new SeparatorViewModel(),
            new LinkViewModel()
            {
                Link        = StatusPageLink,
                Description = "Coordinator Status Page",
                IsClickable = true
            },
            new SeparatorViewModel(),
            new LinkViewModel()
            {
                Link        = UserSupportLink,
                Description = "User Support",
                IsClickable = true
            },
            new SeparatorViewModel(),
            new LinkViewModel()
            {
                Link        = BugReportLink,
                Description = "Bug Reporting",
                IsClickable = true
            },
            new SeparatorViewModel(),
            new LinkViewModel()
            {
                Link        = FAQLink,
                Description = "FAQs",
                IsClickable = true
            },
        };

        License = new LinkViewModel()
        {
            Link        = LicenseLink,
            Description = "MIT License",
            IsClickable = true
        };

        OpenBrowserCommand = ReactiveCommand.CreateFromTask <string>(IoHelpers.OpenBrowserAsync);

        AboutAdvancedInfoDialogCommand = ReactiveCommand.CreateFromTask(
            execute: async() => await NavigateDialogAsync(new AboutAdvancedInfoViewModel(), NavigationTarget.CompactDialogScreen));

        OpenBrowserCommand = ReactiveCommand.CreateFromTask <string>(
            async(link) =>
            await IoHelpers.OpenBrowserAsync(link));

        CopyLinkCommand = ReactiveCommand.CreateFromTask <string>(
            async(link) =>
        {
            if (Application.Current is { Clipboard: { } clipboard })
            {
                await clipboard.SetTextAsync(link);
            }
        });
Example #11
0
        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());
            });
        }