Esempio n. 1
0
        private ThemeService()
        {
            _timer.Elapsed += (l, k) =>
            {
                Application.Current?.Dispatcher.BeginInvoke(DispatcherPriority.SystemIdle, new Action(() =>
                {
                    this.AccentColor = this.SelectColorSource.Colors[_random.Next(this.SelectColorSource.Colors.Count)];
                }));
            };


            #region - 颜色 -

            this.ColorSource.Add(new AccentColorSource()
            {
                DispalyName = "适中", Colors = ColorSourceFactory.Create(0.6).ToObservable()
            });

            this.ColorSource.Add(new AccentColorSource()
            {
                DispalyName = "浅色", Colors = ColorSourceFactory.Create(0.8).ToObservable()
            });

            this.ColorSource.Add(new AccentColorSource()
            {
                DispalyName = "深色", Colors = ColorSourceFactory.Create(0.3).ToObservable()
            });

            this.ColorSource.Add(new AccentColorSource()
            {
                DispalyName = "高亮", Colors = ColorSourceFactory.Create(1.0).ToObservable()
            });

            this.SelectColorSource = this.ColorSource?.FirstOrDefault();

            #endregion

            #region - 主题 -

            this.ColorLinks.Add(new ColorLink {
                ThemeType = ThemeType.Light, DisplayName = "浅色调", Source = ThemeService.LightThemeSource, Color = Brushes.White, Text = Brushes.Black
            });
            this.ColorLinks.Add(new ColorLink {
                ThemeType = ThemeType.Dark, DisplayName = "深色调", Source = ThemeService.DarkThemeSource, Color = Brushes.Black, Text = Brushes.White
            });
            this.ColorLinks.Add(new ColorLink {
                ThemeType = ThemeType.Gray, DisplayName = "灰色调", Source = ThemeService.GrayThemeSource, Color = Brushes.Gray, Text = Brushes.White
            });
            this.ColorLinks.Add(new ColorLink {
                ThemeType = ThemeType.Accent, DisplayName = "主色调", Source = ThemeService.AccentThemeSource, Color = Brushes.White, Text = Brushes.Black
            });

            this.SelectedColorLink = this.ColorLinks?.FirstOrDefault();

            #endregion
        }
Esempio n. 2
0
        private ThemeService()
        {
            _timer.Elapsed += (l, k) =>
            {
                Application.Current?.Dispatcher.BeginInvoke(DispatcherPriority.SystemIdle, new Action(() =>
                {
                    this.AccentColor = _type == 0 ? wpAccentColors[_random.Next(wpAccentColors.Length)] : metroAccentColors[_random.Next(metroAccentColors.Length)];

                    this.AccentColor = _type == 0 ? wpAccentColors[_random.Next(wpAccentColors.Length)] : metroAccentColors[_random.Next(metroAccentColors.Length)];
                }));
            };

            var dark = new AccentColorSource()
            {
                DispalyName = "适中", Colors = ColorSourceFactory.Create(0.6).ToObservable()
            };

            this.ColorSource.Add(dark);

            var light = new AccentColorSource()
            {
                DispalyName = "浅色", Colors = ColorSourceFactory.Create(0.8).ToObservable()
            };

            this.ColorSource.Add(light);

            var deep = new AccentColorSource()
            {
                DispalyName = "深色", Colors = ColorSourceFactory.Create(0.3).ToObservable()
            };

            this.ColorSource.Add(deep);

            var height = new AccentColorSource()
            {
                DispalyName = "高亮", Colors = ColorSourceFactory.Create(1.0).ToObservable()
            };

            this.ColorSource.Add(height);
        }