public PreferencesViewModel(ISettingsProvider settingsProvider, IScreenManager screenManager) { this.settingsProvider = settingsProvider; Screens = new ObservableCollection <DetailedScreen>(screenManager.GetScreens()); Settings = settingsProvider.GetSettings <PopupSettings>(); PlaceScreen(); AvailableColors = new ObservableCollection <AvailableColor>(); var properties = typeof(Colors).GetProperties(BindingFlags.Static | BindingFlags.Public); foreach (var prop in properties) { var name = prop.Name; var value = (Color)prop.GetValue(null, null); var availableColor = new AvailableColor(name, value); if (Settings.FontColor == name) { FontColor = availableColor; } if (Settings.ItemBackgroundColor == name) { ItemBackgroundColor = availableColor; } AvailableColors.Add(availableColor); } SaveCommand = new DelegateCommand(SaveSettings); ResetToDefaultsCommand = new DelegateCommand(() => settingsProvider.ResetToDefaults <PopupSettings>()); VisitCommand = new DelegateCommand(Visit); }
public PreferencesViewModel(ISettingsProvider settingsProvider, IScreenManager screenManager) { this.settingsProvider = settingsProvider; Screens = new ObservableCollection<DetailedScreen>(screenManager.GetScreens()); Settings = settingsProvider.GetSettings<PopupSettings>(); PlaceScreen(); AvailableColors = new ObservableCollection<AvailableColor>(); var properties = typeof(Colors).GetProperties(BindingFlags.Static | BindingFlags.Public); foreach (var prop in properties) { var name = prop.Name; var value = (Color)prop.GetValue(null, null); var availableColor = new AvailableColor(name, value); if (Settings.FontColor == name) FontColor = availableColor; if (Settings.ItemBackgroundColor == name) ItemBackgroundColor = availableColor; AvailableColors.Add(availableColor); } SaveCommand = new DelegateCommand(SaveSettings); ResetToDefaultsCommand = new DelegateCommand(() => settingsProvider.ResetToDefaults<PopupSettings>()); VisitCommand = new DelegateCommand(Visit); }
public ShellViewModel( ISettingsService settingsService, IScreenManager screenManager, ITimerFactory timerFactory, IWindowManager windowManager, IMessageProvider messageProvider) { this.settingsService = settingsService; this.messageProvider = messageProvider; Keys = new ObservableCollection <Message>(); Screens = new ObservableCollection <DetailedScreen>(screenManager.GetScreens()); Settings = settingsService.Get <Settings>("PopupSettings"); if (Settings == null) { Settings = new Settings(); SetDefaultSettings(); } PlaceScreen(); windowManager.ShowWindow(new KeyShowViewModel(Keys, Settings)); timerToken = timerFactory.Start(1000, Cleanup); }
/// <summary> /// Activates the loading screen. /// </summary> public static void Load(IScreenManager screenManager, bool loadingIsSlow, PlayerIndex? controllingPlayer, params Screen[] screensToLoad) { // Tell all the current screens to transition off. foreach (Screen screen in screenManager.GetScreens()) screen.ExitScreen(); // Create and activate the loading screen. LoadingScreen loadingScreen = new LoadingScreen(loadingIsSlow, screensToLoad); screenManager.AddScreen(loadingScreen, controllingPlayer); }
/// <summary> /// Activates the loading screen. /// </summary> public static void Load(IScreenManager screenManager, bool loadingIsSlow, PlayerIndex?controllingPlayer, params Screen[] screensToLoad) { // Tell all the current screens to transition off. foreach (Screen screen in screenManager.GetScreens()) { screen.ExitScreen(); } // Create and activate the loading screen. LoadingScreen loadingScreen = new LoadingScreen(loadingIsSlow, screensToLoad); screenManager.AddScreen(loadingScreen, controllingPlayer); }
public ShellViewModel( ISettingsProvider settingsProvider, IScreenManager screenManager, ITimerFactory timerFactory, IWindowManager windowManager, IMessageProvider messageProvider) { this.settingsProvider = settingsProvider; this.messageProvider = messageProvider; Keys = new ObservableCollection <Message>(); Screens = new ObservableCollection <DetailedScreen>(screenManager.GetScreens()); Settings = settingsProvider.GetSettings <PopupSettings>(); PlaceScreen(); keyShowViewModel = new KeyShowViewModel(Keys, Settings); windowManager.ShowWindow(keyShowViewModel); timerToken = timerFactory.Start(1000, Cleanup); }
public async Task <ListResultDto <GetScreenOutput> > GetScreensAsync(string Keyword) { var screens = await _screenManager.GetScreens(Keyword); return(new ListResultDto <GetScreenOutput>(ObjectMapper.Map <List <GetScreenOutput> >(screens))); }