public SettingsPageViewModel(IScreen screen) : base(screen)
        {
            Title = "Settings";

            NextCommand = ReactiveCommand.Create(() => screen.Router.Navigate.Execute(new SettingsPageViewModel(screen)));

            OpenDialogCommand = ReactiveCommand.CreateFromTask(async() => await ConfirmSetting.Handle("Please confirm the setting:").ToTask());

            ConfirmSetting = new Interaction <string, bool>();

            ConfirmSetting.RegisterHandler(
                async interaction =>
            {
                var x      = new TestDialogViewModel(screen, interaction.Input);
                var result = await x.ShowDialogAsync();
                interaction.SetOutput(result);
            });

            ChangeThemeCommand = ReactiveCommand.Create(() =>
            {
                var currentTheme = Application.Current.Styles.Select(x => (StyleInclude)x).FirstOrDefault(x => x.Source is { } && x.Source.AbsolutePath.Contains("Themes"));

                if (currentTheme?.Source is { } src)
                {
                    var themeIndex = Application.Current.Styles.IndexOf(currentTheme);

                    var newTheme = new StyleInclude(new Uri("avares://WalletWasabi.Fluent/App.xaml"))
                    {
                        Source = new Uri($"avares://WalletWasabi.Fluent/Styles/Themes/{(src.AbsolutePath.Contains("Light") ? "BaseDark" : "BaseLight")}.xaml")
                    };

                    Application.Current.Styles[themeIndex] = newTheme;
                }
            });
示例#2
0
        public SettingsPageViewModel(IScreen screen) : base(screen)
        {
            Title = "Settings";

            NextCommand = ReactiveCommand.Create(() => screen.Router.Navigate.Execute(new AddWalletPageViewModel(screen)));

            OpenDialogCommand = ReactiveCommand.CreateFromTask(async() => await ConfirmSetting.Handle("Please confirm the setting:").ToTask());

            ConfirmSetting = new Interaction <string, bool>();

            ConfirmSetting.RegisterHandler(
                async interaction =>
            {
                var x      = new TestDialogViewModel(screen, interaction.Input);
                var result = await x.ShowDialogAsync(MainViewModel.Instance);
                interaction.SetOutput(result);
            });

            ChangeThemeCommand = ReactiveCommand.Create(() =>
            {
                var currentTheme = Application.Current.Styles.Select(x => (StyleInclude)x).FirstOrDefault(x => x.Source is { } && x.Source.AbsolutePath.Contains("Themes"));

                if (currentTheme?.Source is { })