Beispiel #1
0
        public SettingsWindow()
        {
            MaxHeight = WindowSizing.MonitorInfo.WorkArea.Height;
            InitializeComponent();
            Width *= WindowSizing.MonitorInfo.DpiScaling;

            ContentRendered += delegate
            {
                var colorAnimation = new ColorAnimation {
                    Duration = TimeSpan.FromSeconds(.1)
                };

                AddGenericEvents(colorAnimation);

                // SubDirRadio
                SubDirRadio.IsChecked = Properties.Settings.Default.IncludeSubDirectories;
                SubDirRadio.Click    += delegate
                {
                    Properties.Settings.Default.IncludeSubDirectories = !Properties.Settings.Default.IncludeSubDirectories;
                    Error_Handling.Reload();
                };

                // BorderColorRadio
                BorderRadio.Click += UpdateUIValues.SetBorderColorEnabled;
                if (Properties.Settings.Default.WindowBorderColorEnabled)
                {
                    BorderRadio.IsChecked = true;
                }

                WallpaperApply.MouseLeftButtonDown += delegate
                {
                    var x = WallpaperStyle.Fill;
                    if (Fit.IsSelected)
                    {
                        x = WallpaperStyle.Fit;
                    }
                    if (Center.IsSelected)
                    {
                        x = WallpaperStyle.Center;
                    }
                    if (Tile.IsSelected)
                    {
                        x = WallpaperStyle.Tile;
                    }
                    if (Fit.IsSelected)
                    {
                        x = WallpaperStyle.Fit;
                    }

                    SetWallpaper(x);
                };

                SlideshowSlider.Value         = Properties.Settings.Default.SlideTimer / 1000;
                SlideshowSlider.ValueChanged += (_, e) => Properties.Settings.Default.SlideTimer = e.NewValue * 1000;

                ZoomSlider.Value         = Properties.Settings.Default.ZoomSpeed;
                ZoomSlider.ValueChanged += (_, e) => Properties.Settings.Default.ZoomSpeed = e.NewValue;

                LightThemeRadio.IsChecked = !Properties.Settings.Default.DarkTheme;
                DarkThemeRadio.IsChecked  = Properties.Settings.Default.DarkTheme;

                DarkThemeRadio.Click += delegate
                {
                    ChangeToDarkTheme();
                    LightThemeRadio.IsChecked = false;
                };
                LightThemeRadio.Click += delegate
                {
                    ChangeToLightTheme();
                    DarkThemeRadio.IsChecked = false;
                };

                foreach (var language in Enum.GetValues(typeof(Languages)))
                {
                    LanguageBox.Items.Add(new ComboBoxItem
                    {
                        Content    = new CultureInfo(language.ToString()).DisplayName,
                        IsSelected = language.ToString() == Properties.Settings.Default.UserLanguage,
                    });
                }

                LanguageBox.SelectionChanged += delegate
                {
                    GeneralSettings.ChangeLanguage((LanguageBox.SelectedIndex));
                };

                AltUIRadio.IsChecked = Properties.Settings.Default.ShowAltInterfaceButtons;
                AltUIRadio.Click    += delegate
                {
                    Properties.Settings.Default.ShowAltInterfaceButtons = !Properties.Settings.Default.ShowAltInterfaceButtons;
                };

                RestartButton.Click += delegate
                {
                    GeneralSettings.RestartApp();
                };

                TopmostRadio.IsChecked  = Properties.Settings.Default.TopMost;
                TopmostRadio.Checked   += (_, _) => ConfigureWindows.IsMainWindowTopMost = !Properties.Settings.Default.TopMost;
                TopmostRadio.Unchecked += (_, _) => ConfigureWindows.IsMainWindowTopMost = false;

                CenterRadio.IsChecked  = Properties.Settings.Default.KeepCentered;
                CenterRadio.Checked   += (_, _) => Properties.Settings.Default.KeepCentered = true;
                CenterRadio.Unchecked += (_, _) => Properties.Settings.Default.KeepCentered = false;

                SetAsDefaultTxt.MouseLeftButtonDown += (_, _) => GeneralSettings.ElevateProcess(Process.GetCurrentProcess());


                switch (Properties.Settings.Default.ColorTheme)
                {
                case 1:
                    BlueRadio.IsChecked = true;
                    break;

                case 2:
                    PinkRadio.IsChecked = true;
                    break;

                case 3:
                    OrangeRadio.IsChecked = true;
                    break;

                case 4:
                    GreenRadio.IsChecked = true;
                    break;

                case 5:
                    RedRadio.IsChecked = true;
                    break;

                case 6:
                    TealRadio.IsChecked = true;
                    break;

                case 7:
                    AquaRadio.IsChecked = true;
                    break;

                case 8:
                    GoldenRadio.IsChecked = true;
                    break;

                case 9:
                    PurpleRadio.IsChecked = true;
                    break;

                case 10:
                    CyanRadio.IsChecked = true;
                    break;

                case 11:
                    MagentaRadio.IsChecked = true;
                    break;

                case 12:
                    LimeRadio.IsChecked = true;
                    break;
                }
            };
        }