Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        /// <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);
        }
Exemple #5
0
        /// <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);
        }
Exemple #6
0
        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);
        }
Exemple #7
0
        public async Task <ListResultDto <GetScreenOutput> > GetScreensAsync(string Keyword)
        {
            var screens = await _screenManager.GetScreens(Keyword);

            return(new ListResultDto <GetScreenOutput>(ObjectMapper.Map <List <GetScreenOutput> >(screens)));
        }