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; } });
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); }
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 { })
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 { })