Exemplo n.º 1
0
        public ThemesPageViewModel(ISettingsService settingsService, IDialogService dialogService, IDefaultValueProvider defaultValueProvider,
                                   IThemeParserFactory themeParserFactory, IFileSystemService fileSystemService)
        {
            _settingsService      = settingsService;
            _dialogService        = dialogService;
            _defaultValueProvider = defaultValueProvider;
            _themeParserFactory   = themeParserFactory;
            _fileSystemService    = fileSystemService;

            CreateThemeCommand = new RelayCommand(CreateTheme);
            ImportThemeCommand = new RelayCommand(ImportTheme);
            CloneCommand       = new RelayCommand <ThemeViewModel>(CloneTheme);

            _settingsService.TerminalOptionsChanged += OnTerminalOptionsChanged;

            BackgroundOpacity = _settingsService.GetTerminalOptions().BackgroundOpacity;

            var activeThemeId = _settingsService.GetCurrentThemeId();

            foreach (var theme in _settingsService.GetThemes())
            {
                var viewModel = new ThemeViewModel(theme, _settingsService, _dialogService, fileSystemService);
                viewModel.Activated += OnThemeActivated;
                viewModel.Deleted   += OnThemeDeleted;

                if (theme.Id == activeThemeId)
                {
                    viewModel.IsActive = true;
                }
                Themes.Add(viewModel);
            }

            SelectedTheme = Themes.First(t => t.IsActive);
        }
        public ThemesPageViewModel(ISettingsService settingsService, IDialogService dialogService, IDefaultValueProvider defaultValueProvider)
        {
            _settingsService      = settingsService;
            _dialogService        = dialogService;
            _defaultValueProvider = defaultValueProvider;

            CreateThemeCommand = new RelayCommand(CreateTheme);

            var activeThemeId = _settingsService.GetCurrentThemeId();

            foreach (var theme in _settingsService.GetThemes())
            {
                var viewModel = new ThemeViewModel(theme, _settingsService, _dialogService);
                viewModel.Activated += OnThemeActivated;
                viewModel.Deleted   += OnThemeDeleted;

                if (theme.Id == activeThemeId)
                {
                    viewModel.IsActive = true;
                }
                Themes.Add(viewModel);
            }

            SelectedTheme = Themes.First(t => t.IsActive);
        }
 public MainViewModel(MainView host)
 {
     _host             = host;
     _wizardVersion    = "0.0.0.0";
     _templatesVersion = "0.0.0.0";
     Themes.Add("Light");
     Themes.Add("Dark");
     SelectedTheme = Themes.First();
 }
Exemplo n.º 4
0
        protected ThemeManager(SerializationInfo info, StreamingContext context)
        {
            var theme = Themes.First(i => i.Name == info.GetString("ThemeName"));

            if (theme != null)
            {
                CurrentTheme = theme;
            }
        }
Exemplo n.º 5
0
        public MainViewModel()
        {
            Themes = new[]
            {
                new Theme("Default theme", new Uri("/Wpf.TestHarness;component/Themes/DefaultTheme.xaml", UriKind.Relative)),
                new Theme("Red theme", new Uri("/Wpf.Mvvm.TestHarness;component/Themes/RedTheme.xaml", UriKind.Relative)),
                new Theme("Blue theme", new Uri("/Wpf.Mvvm.TestHarness;component/Themes/BlueTheme.xaml", UriKind.Relative))
            };

            _selectedTheme = Themes.First();
        }
Exemplo n.º 6
0
 protected Workspace()
 {
     this.Themes = new List <Tuple <string, Theme> >
     {
         new Tuple <string, Theme>(nameof(GenericTheme), new GenericTheme()),
         new Tuple <string, Theme>(nameof(Vs2013BlueTheme), new Vs2013BlueTheme()),
         new Tuple <string, Theme>(nameof(Vs2013DarkTheme), new Vs2013DarkTheme()),
         new Tuple <string, Theme>(nameof(Vs2013LightTheme), new Vs2013LightTheme()),
     };
     this.SelectedTheme = Themes.First();
 }
Exemplo n.º 7
0
        public void Load()
        {
            Themes = ThemeHelper.GetAvailableThemes()
                     .Select(t => new SelectableVM <Theme>(t))
                     .ToList();

            var settings = SettingsHelper.GetSettings();

            SelectedTheme = Themes.FirstOrDefault(t => t.Data.Name.Equals(settings.Theme, System.StringComparison.OrdinalIgnoreCase)) ??
                            Themes.First();

            DefaultOverwritePasses = settings.DefaultOverwritePasses;

            _isLoaded = true;
        }
Exemplo n.º 8
0
 /// <summary>
 /// Class constructor
 /// </summary>
 protected Workspace()
 {
     this.Themes = new List <Tuple <string, Theme> >
     {
         new Tuple <string, Theme>(nameof(AeroTheme), new AeroTheme()),
         new Tuple <string, Theme>(nameof(ExpressionDarkTheme), new ExpressionDarkTheme()),
         new Tuple <string, Theme>(nameof(ExpressionLightTheme), new ExpressionLightTheme()),
         new Tuple <string, Theme>(nameof(MetroTheme), new MetroTheme()),
         new Tuple <string, Theme>(nameof(VS2010Theme), new VS2010Theme()),
         new Tuple <string, Theme>(nameof(Vs2013BlueTheme), new Vs2013BlueTheme()),
         new Tuple <string, Theme>(nameof(Vs2013DarkTheme), new Vs2013DarkTheme()),
         new Tuple <string, Theme>(nameof(Vs2013LightTheme), new Vs2013LightTheme()),
     };
     this.SelectedTheme = Themes.First();
 }
Exemplo n.º 9
0
        public void ChangeTheme(string key)
        {
            if (this.Themes.Any(x => x.Key == key))
            {
                var theme = Themes.First(x => x.Key == key);
                Application.Current.Resources.MergedDictionaries.Clear();
                Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary()
                {
                    Source = theme.ResourcePath
                });

                if (theme.Key.Contains("Light"))
                {
                    DevExpress.Xpf.Core.ApplicationThemeHelper.ApplicationThemeName = DevExpress.Xpf.Core.Theme.MetropolisLightName;

                    Telerik.Windows.Controls.StyleManager.ApplicationTheme = new Telerik.Windows.Controls.Windows8Theme(); //Telerik
                    // SciChart.Charting.ThemeManager.DefaultTheme = "ExpressionLight";
                }
                else
                {
                    DevExpress.Xpf.Core.ApplicationThemeHelper.ApplicationThemeName = DevExpress.Xpf.Core.Theme.MetropolisDarkName;

                    Telerik.Windows.Controls.StyleManager.ApplicationTheme = new Telerik.Windows.Controls.Expression_DarkTheme(); // Telerik
                    // SciChart.Charting.ThemeManager.DefaultTheme = "SciChartv4Dark";
                }

                this.CurrentTheme = theme;

                if (this.CurrentTheme != null)
                {
                    var eventAggregator = ServiceLocator.Current.GetInstance <IEventAggregator>();
                    eventAggregator.GetEvent <ThemeChangedEvent>().Publish(this.CurrentTheme);

                    if (this.ThemeChanged != null)
                    {
                        this.ThemeChanged(this, this.CurrentTheme);
                    }
                }
            }
            else
            {
                throw new Ertis.Themes.ThemeException("CurrentTheme olarak verilen key temalar arasında bulunamadı! (" + key + ")");
            }
        }
Exemplo n.º 10
0
        public StyleSettingsViewModel(IBaseViewModel?parent)
            : base(parent)
        {
            Themes           = StyleSettings.GetThemes().OrderBy(o => o.Name).ToList();
            var(theme, find) = StyleSettings.GetWindowTheme(parent?.Window);
            SelectedTheme    = Themes.FirstOrDefault(t => t == theme) ?? Themes.First();
            IsOnlyThisWindow = find;

            this.WhenAnyValue(w => w.SelectedTheme).Skip(1).Subscribe(s =>
            {
                StyleSettings.SaveWindowTheme(Parent.Window, s, IsOnlyThisWindow);
                ThemeManager.ChangeTheme(Window.Resources, s);
                if (parent?.Window != null)
                {
                    ThemeManager.ChangeTheme(parent.Window.Resources, s);
                    parent.Window.OnChangeTheme();
                }
            });
        }
Exemplo n.º 11
0
        public SettingsViewModel()
        {
            var currentLanguage = ApplicationLanguages.PrimaryLanguageOverride;

            if (string.IsNullOrEmpty(currentLanguage))
            {
                currentLanguage = Windows.System.UserProfile.GlobalizationPreferences.Languages.FirstOrDefault();
            }

            _selectedLocale = Locales.FirstOrDefault(l => l.Code == currentLanguage);
            if (_selectedLocale == null)
            {
                _selectedLocale = Locales.First();
            }

            //theme
            _selectedTheme = Themes.First(t => t.Value == AppState.Theme);

            _selectedColor = ColorSchemes.FirstOrDefault(c => c.Name == AppState.Accent) ?? ColorSchemes.FirstOrDefault();
        }
 public ViewModel()
 {
     SomeData = new List <string>
     {
         "313221",
         "jhrgrjhgrj",
         "HHHJHJHJH",
         "iuyiruy"
     };
     _someDataSelected = SomeData.First();
     TestData          = new List <TestClass>
     {
         new TestClass("First", 15.551, "Some data", SomeData),
         new TestClass("Second", 15.551, "Some data", SomeData),
         new TestClass("Third", 05.578, "Some data", SomeData),
         new TestClass("Any other", 0.111, "Some data", SomeData)
     };
     Themes        = ModPlusStyle.ThemeManager.Themes;
     _currentTheme = Themes.First();
 }
Exemplo n.º 13
0
        public SettingsViewModel()
        {
            var currentLanguage = ApplicationLanguages.PrimaryLanguageOverride;

            if (string.IsNullOrEmpty(currentLanguage))
            {
                currentLanguage = Windows.System.UserProfile.GlobalizationPreferences.Languages.FirstOrDefault();
            }

            _selectedLocale = Locales.FirstOrDefault(l => l.Code == currentLanguage);
            if (_selectedLocale == null)
            {
                _selectedLocale = Locales.First();
            }

            //theme
            if (AppState.Theme != null)
            {
                switch (AppState.Theme)
                {
                case ApplicationTheme.Light:
                    _selectedTheme = Themes.First(t => t.Value == ElementTheme.Light);
                    break;

                case ApplicationTheme.Dark:
                    _selectedTheme = Themes.First(t => t.Value == ElementTheme.Dark);
                    break;
                }
            }
            else
            {
                _selectedTheme = Themes.First(t => t.Value == ElementTheme.Default);
            }

            _selectedColor = ColorSchemes.FirstOrDefault(c => c.Name == AppState.Accent) ?? ColorSchemes.FirstOrDefault();
        }
Exemplo n.º 14
0
 /// <summary>
 /// Class constructor
 /// </summary>
 public Workspace()
 {
     SelectedTheme = Themes.First();
 }
Exemplo n.º 15
0
        private IThemeMeta GetActiveTheme()
        {
            var theme = Themes.FirstOrDefault(x => x.Title == _settings.SelectedTheme) ?? Themes.First();

            return(theme);
        }
Exemplo n.º 16
0
        public SettingsViewModel(MusicDataManager musicDataManager, Action refreshViewAction)
        {
            MusicDataManager   = musicDataManager;
            _refreshViewAction = refreshViewAction;

            SelectedSoundOutDevice = musicDataManager.MusicManager.AudioEngine.SoundOutProvider.CurrentSoundOutDevice;
            AccentColors           =
                ThemeManager.Accents.Select(
                    x => new AccentColorData {
                ColorBrush = x.Resources["AccentColorBrush"] as Brush, Key = x.Name, AccentColor = x
            })
                .ToList();
            Themes = ThemeManager.AppThemes.Select(x => new ThemeData {
                Key = x.Name, Theme = x
            }).ToList();

            SelectedTheme       = Themes.FirstOrDefault(x => x.Key == _settings.Theme) ?? Themes.First();
            SelectedAccentColor = AccentColors.FirstOrDefault(x => x.Key == _settings.AccentColor) ??
                                  AccentColors.First();
        }
Exemplo n.º 17
0
        public SettingsViewModel(ILocalStorageService localStorageService, IRoamingStorageService roamingStorageService)
        {
            _localStorageService   = localStorageService;
            _roamingStorageService = roamingStorageService;

            SelectedTheme     = _localStorageService.Read(StorageConstants.SelectedTheme, Themes.First());
            InvertSuggestions = _localStorageService.Read(StorageConstants.InvertSuggestions, false);
            ShowNewTranslationWidgetOnMainPage = _localStorageService.Read(StorageConstants.ShowNewTranslationWidgetOnMainPage, false);
            EnableDropShadow   = _localStorageService.Read(StorageConstants.EnableDropShadow, false);
            HistoryShowed      = _localStorageService.Read(StorageConstants.HistoryShowed, true);
            InstantTranslation = _localStorageService.Read(StorageConstants.InstantTranslation, true);
        }