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 void ConstructorsAndPropertiesTests()
        {
            var bb = new TestDialogViewModel("message", "heading");

            Assert.AreEqual(bb.Heading, "heading");
            Assert.AreEqual(bb.Message, "message");

            bb.CloseDialogWithResult(null, DialogResult.OK);
            Assert.AreEqual(DialogResult.OK, bb.UserDialogResult);
        }
예제 #3
0
        public SettingsPageViewModel(IScreen screen) : base(screen)
        {
            Title = "Settings";

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

            OpenDialogCommand = ReactiveCommand.Create(async() =>
            {
                var x      = new TestDialogViewModel();
                var result = await x.ShowDialogAsync(MainViewModel.Instance);
            });

            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 { })
예제 #4
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 { })