public void CompletedSchedulesUpdated() { string idComplete = "schedule1"; string idNotComplete = "schedule2"; List <Theme> expected = new List <Theme>() { new ThemeBuilder().WithScheduleIds(idComplete).Build(), new ThemeBuilder().WithScheduleIds(idNotComplete).Build() }; mockRepo.Setup(r => r.GetAllThemesAsync()) .Returns(Task.FromResult(Result <List <Theme> > .Success(expected))); mockRepo.Setup(r => r.GetCompletedScheduleIds()) .Returns(new List <string>() { idComplete }); ThemesPageViewModel model = new ThemesPageViewModel(mockRepo.Object); model.ReloadIfNeeded(); Assert.True(model.ThemeModels.Find(t => t.FirstScheduleId == idComplete)?.IsCompleted); Assert.False(model.ThemeModels.Find(t => t.FirstScheduleId == idNotComplete)?.IsCompleted); }
protected override void OnNavigatedTo(NavigationEventArgs e) { if (e.Parameter is ThemesPageViewModel viewModel) { ViewModel = viewModel; } }
public SettingsViewModel(ISettingsService settingsService, IDefaultValueProvider defaultValueProvider, IDialogService dialogService, ITrayProcessCommunicationService trayProcessCommunicationService, IThemeParserFactory themeParserFactory) { KeyBindings = new KeyBindingsPageViewModel(settingsService, dialogService, defaultValueProvider, trayProcessCommunicationService); General = new GeneralPageViewModel(settingsService, dialogService, defaultValueProvider); Shell = new ProfilesPageViewModel(settingsService, dialogService, defaultValueProvider); Terminal = new TerminalPageViewModel(settingsService, dialogService, defaultValueProvider); Themes = new ThemesPageViewModel(settingsService, dialogService, defaultValueProvider, themeParserFactory); }
protected override void OnNavigatedTo(NavigationEventArgs e) { if (e.Parameter is ThemesPageViewModel viewModel) { ViewModel = viewModel; } TitleBar.RestoreColors(); }
protected override void OnNavigatedTo(NavigationEventArgs e) { if (e.Parameter is ThemesPageViewModel viewModel) { ViewModel = viewModel; viewModel.SelectedThemeBackgroundColorChanged += OnSelectedThemeBackgroundColorChanged; var theme = ContrastHelper.GetIdealThemeForBackgroundColor(ViewModel.SelectedTheme.Background); SetTheme(theme); } }
public SettingsViewModel(ISettingsService settingsService, IDefaultValueProvider defaultValueProvider, IDialogService dialogService, ITrayProcessCommunicationService trayProcessCommunicationService, IThemeParserFactory themeParserFactory, ISystemFontService systemFontService, IFileSystemService fileSystemService, IStartupTaskService startupTaskService) { KeyBindings = new KeyBindingsPageViewModel(settingsService, dialogService, defaultValueProvider, trayProcessCommunicationService); General = new GeneralPageViewModel(settingsService, dialogService, defaultValueProvider, startupTaskService); Shell = new ProfilesPageViewModel(settingsService, dialogService, defaultValueProvider, fileSystemService); Terminal = new TerminalPageViewModel(settingsService, dialogService, defaultValueProvider, systemFontService); Themes = new ThemesPageViewModel(settingsService, dialogService, defaultValueProvider, themeParserFactory, fileSystemService); Mouse = new MousePageViewModel(settingsService, dialogService, defaultValueProvider); }
public ThemesPage() { CreateCommands(); InitializeComponent(); var app = Application.Current as App; viewModel = new ThemesPageViewModel(app.AppRepository); viewModel.ThemeLoadFailed += OnThemeLoadFailed; BindingContext = viewModel; }
public void FailedThemeLoad() { mockRepo.Setup(r => r.GetAllThemesAsync()) .Returns(Task.FromResult(Result <List <Theme> > .Failure())); ThemesPageViewModel model = new ThemesPageViewModel(mockRepo.Object); Assert.Raises <EventArgs>( attach: handler => model.ThemeLoadFailed += handler, detach: handler => model.ThemeLoadFailed -= handler, testCode: () => model.ReloadIfNeeded()); }
public SettingsViewModel(ISettingsService settingsService, IDefaultValueProvider defaultValueProvider, IDialogService dialogService, ITrayProcessCommunicationService trayProcessCommunicationService, IThemeParserFactory themeParserFactory, ISystemFontService systemFontService, IFileSystemService fileSystemService, IStartupTaskService startupTaskService, IUpdateService updateService, IApplicationView applicationView, IApplicationLanguageService applicationLanguageService) { About = new AboutPageViewModel(settingsService, updateService, applicationView); KeyBindings = new KeyBindingsPageViewModel(settingsService, dialogService, defaultValueProvider, trayProcessCommunicationService); General = new GeneralPageViewModel(settingsService, dialogService, defaultValueProvider, startupTaskService, applicationLanguageService); Profiles = new ProfilesPageViewModel(settingsService, dialogService, defaultValueProvider, fileSystemService, applicationView); Terminal = new TerminalPageViewModel(settingsService, dialogService, defaultValueProvider, systemFontService); Themes = new ThemesPageViewModel(settingsService, dialogService, defaultValueProvider, themeParserFactory, fileSystemService); Mouse = new MousePageViewModel(settingsService, dialogService, defaultValueProvider); SshProfiles = new SshProfilesPageViewModel(settingsService, dialogService, fileSystemService, applicationView, defaultValueProvider, trayProcessCommunicationService); }
public SettingsViewModel(ISettingsService settingsService, IDefaultValueProvider defaultValueProvider, IDialogService dialogService, ITrayProcessCommunicationService trayProcessCommunicationService, IThemeParserFactory themeParserFactory, ISystemFontService systemFontService, IFileSystemService fileSystemService, IStartupTaskService startupTaskService, IApplicationView applicationView, IApplicationLanguageService applicationLanguageService, ApplicationDataContainers containers, IImageFileSystemService imageFileSystemService) { KeyBindings = new KeyBindingsPageViewModel(settingsService, dialogService, trayProcessCommunicationService); General = new GeneralPageViewModel(settingsService, dialogService, defaultValueProvider, startupTaskService, applicationLanguageService, trayProcessCommunicationService, fileSystemService); Profiles = new ProfilesPageViewModel(settingsService, dialogService, defaultValueProvider, fileSystemService, applicationView); Terminal = new TerminalPageViewModel(settingsService, dialogService, defaultValueProvider, systemFontService); Themes = new ThemesPageViewModel(settingsService, dialogService, defaultValueProvider, themeParserFactory, fileSystemService, imageFileSystemService); Mouse = new MousePageViewModel(settingsService, dialogService, defaultValueProvider); SshProfiles = new SshProfilesPageViewModel(settingsService, dialogService, fileSystemService, applicationView, trayProcessCommunicationService, containers.HistoryContainer); }