public SettingsWindow() { Title = Application.Current.Resources["SettingsWindow"] + " - PicView"; MaxHeight = WindowSizing.MonitorInfo.WorkArea.Height; Width *= WindowSizing.MonitorInfo.DpiScaling; InitializeComponent(); 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; }; CtrlZoom.IsChecked = Properties.Settings.Default.CtrlZoom; ScrollZoom.IsChecked = !Properties.Settings.Default.CtrlZoom; CtrlZoom.Checked += (_, _) => Properties.Settings.Default.CtrlZoom = true; ScrollZoom.Checked += (_, _) => Properties.Settings.Default.CtrlZoom = false; ThemeRestart.MouseLeftButtonDown += (_, _) => GeneralSettings.RestartApp(); LanguageRestart.MouseLeftButtonDown += (_, _) => GeneralSettings.RestartApp(); TopmostRadio.Checked += (_, _) => ConfigureWindows.IsMainWindowTopMost = !Properties.Settings.Default.TopMost; TopmostRadio.Unchecked += (_, _) => ConfigureWindows.IsMainWindowTopMost = false; TopmostRadio.IsChecked = Properties.Settings.Default.TopMost; CenterRadio.Checked += (_, _) => Properties.Settings.Default.KeepCentered = true; CenterRadio.Unchecked += (_, _) => Properties.Settings.Default.KeepCentered = false; CenterRadio.IsChecked = Properties.Settings.Default.KeepCentered; fileAssocWin = new FileAssociationsWindow { Owner = this, Width = ActualWidth, Height = ActualHeight }; SetAsDefaultTxt.MouseLeftButtonDown += delegate { if (fileAssocWin.Visibility == Visibility.Visible) { fileAssocWin.Focus(); } else { // Show it with animation Effect = new BlurEffect { RenderingBias = RenderingBias.Quality, KernelType = KernelType.Gaussian, Radius = 9 }; fileAssocWin.BeginAnimation(OpacityProperty, new DoubleAnimation { From = 0, To = 1, Duration = TimeSpan.FromSeconds(.3) }); // Make it stay centered fileAssocWin.Left = Left + (Width - fileAssocWin.Width) / 2; fileAssocWin.Top = Top + (Height - fileAssocWin.Height) / 2; fileAssocWin.ShowDialog(); } }; IsVisibleChanged += (_, e) => { if (!(bool)e.NewValue && fileAssocWin.IsVisible) { fileAssocWin.HideLogic(); } }; 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; } }; }
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; } }; }
public SettingsWindow() { Width = 500 * WindowLogic.MonitorInfo.DpiScaling; MaxHeight = WindowLogic.MonitorInfo.Height - (70 * WindowLogic.MonitorInfo.DpiScaling); InitializeComponent(); ContentRendered += (s, x) => { Top = 5; KeyDown += KeysDown; AddGenericEvents(); SetCheckedColorEvent(); // 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; } // Fill Fill.Click += delegate { SetWallpaper(WallpaperStyle.Fill); }; // Fit Fit.Click += delegate { SetWallpaper(WallpaperStyle.Fit); }; // Center Center.Click += delegate { SetWallpaper(WallpaperStyle.Center); }; // Tile Tile.Click += delegate { SetWallpaper(WallpaperStyle.Tile); }; // Stretch Stretch.Click += delegate { SetWallpaper(WallpaperStyle.Stretch); }; SlideshowSlider.Value = Properties.Settings.Default.SlideTimer / 1000; SlideshowSlider.ValueChanged += SlideshowSlider_ValueChanged; LightThemeRadio.IsChecked = Properties.Settings.Default.LightTheme; DarkThemeRadio.IsChecked = !Properties.Settings.Default.LightTheme; 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 }); } LanguageBox.SelectedIndex = 0; LanguageBox.SelectionChanged += delegate { GeneralSettings.ChangeLanguage((LanguageBox.SelectedIndex)); }; RestartButton.Click += delegate { GeneralSettings.RestartApp(); }; // DarkThemeRadio DarkThemeRadio.PreviewMouseLeftButtonDown += delegate { PreviewMouseButtonDownAnim(DarkThemeText); }; DarkThemeRadio.MouseEnter += delegate { ButtonMouseOverAnim(DarkThemeText); }; DarkThemeRadio.MouseEnter += delegate { AnimationHelper.MouseEnterBgTexColor(DarkThemeBrush); }; DarkThemeRadio.MouseLeave += delegate { ButtonMouseLeaveAnim(DarkThemeText); }; DarkThemeRadio.MouseLeave += delegate { AnimationHelper.MouseLeaveBgTexColor(DarkThemeBrush); }; // LightThemeRadio LightThemeRadio.PreviewMouseLeftButtonDown += delegate { PreviewMouseButtonDownAnim(LightThemeText); }; LightThemeRadio.MouseEnter += delegate { ButtonMouseOverAnim(LightThemeText); }; LightThemeRadio.MouseEnter += delegate { AnimationHelper.MouseEnterBgTexColor(LightThemeBrush); }; LightThemeRadio.MouseLeave += delegate { ButtonMouseLeaveAnim(LightThemeText); }; LightThemeRadio.MouseLeave += delegate { AnimationHelper.MouseLeaveBgTexColor(LightThemeBrush); }; // SubDirRadio SubDirRadio.PreviewMouseLeftButtonDown += delegate { PreviewMouseButtonDownAnim(SubDirText); }; SubDirRadio.MouseEnter += delegate { ButtonMouseOverAnim(SubDirText); }; SubDirRadio.MouseEnter += delegate { AnimationHelper.MouseEnterBgTexColor(SubDirBrush); }; SubDirRadio.MouseLeave += delegate { ButtonMouseLeaveAnim(SubDirText); }; SubDirRadio.MouseLeave += delegate { AnimationHelper.MouseLeaveBgTexColor(SubDirBrush); }; // BorderRadio BorderRadio.PreviewMouseLeftButtonDown += delegate { PreviewMouseButtonDownAnim(BorderBrushText); }; BorderRadio.MouseEnter += delegate { ButtonMouseOverAnim(BorderBrushText); }; BorderRadio.MouseEnter += delegate { AnimationHelper.MouseEnterBgTexColor(BorderBrushColor); }; BorderRadio.MouseLeave += delegate { ButtonMouseLeaveAnim(BorderBrushText); }; BorderRadio.MouseLeave += delegate { AnimationHelper.MouseLeaveBgTexColor(BorderBrushColor); }; // Fill Fill.PreviewMouseLeftButtonDown += delegate { PreviewMouseButtonDownAnim(FillText); }; Fill.MouseEnter += delegate { ButtonMouseOverAnim(FillText); }; Fill.MouseEnter += delegate { AnimationHelper.MouseEnterBgTexColor(FillBrush); }; Fill.MouseLeave += delegate { ButtonMouseLeaveAnim(FillText); }; Fill.MouseLeave += delegate { AnimationHelper.MouseLeaveBgTexColor(FillBrush); }; // Center Center.PreviewMouseLeftButtonDown += delegate { PreviewMouseButtonDownAnim(CenterText); }; Center.MouseEnter += delegate { ButtonMouseOverAnim(CenterText); }; Center.MouseEnter += delegate { AnimationHelper.MouseEnterBgTexColor(CenterBrush); }; Center.MouseLeave += delegate { ButtonMouseLeaveAnim(CenterText); }; Center.MouseLeave += delegate { AnimationHelper.MouseLeaveBgTexColor(CenterBrush); }; // Fit Fit.PreviewMouseLeftButtonDown += delegate { PreviewMouseButtonDownAnim(FitText); }; Fit.MouseEnter += delegate { ButtonMouseOverAnim(FitText); }; Fit.MouseEnter += delegate { AnimationHelper.MouseEnterBgTexColor(FitBrush); }; Fit.MouseLeave += delegate { ButtonMouseLeaveAnim(FitText); }; Fit.MouseLeave += delegate { AnimationHelper.MouseLeaveBgTexColor(FitBrush); }; // Tile Tile.PreviewMouseLeftButtonDown += delegate { PreviewMouseButtonDownAnim(TileText); }; Tile.MouseEnter += delegate { ButtonMouseOverAnim(TileText); }; Tile.MouseEnter += delegate { AnimationHelper.MouseEnterBgTexColor(TileBrush); }; Tile.MouseLeave += delegate { ButtonMouseLeaveAnim(TileText); }; Tile.MouseLeave += delegate { AnimationHelper.MouseLeaveBgTexColor(TileBrush); }; // Stretch Stretch.PreviewMouseLeftButtonDown += delegate { PreviewMouseButtonDownAnim(StretchText); }; Stretch.MouseEnter += delegate { ButtonMouseOverAnim(StretchText); }; Stretch.MouseEnter += delegate { AnimationHelper.MouseEnterBgTexColor(StretchBrush); }; Stretch.MouseLeave += delegate { ButtonMouseLeaveAnim(StretchText); }; Stretch.MouseLeave += delegate { AnimationHelper.MouseLeaveBgTexColor(StretchBrush); }; // Restart RestartButton.PreviewMouseLeftButtonDown += delegate { PreviewMouseButtonDownAnim(RestartText); }; RestartButton.MouseEnter += delegate { ButtonMouseOverAnim(RestartText); }; RestartButton.MouseEnter += delegate { AnimationHelper.MouseEnterBgTexColor(RestartBrush); }; RestartButton.MouseLeave += delegate { ButtonMouseLeaveAnim(RestartText); }; RestartButton.MouseLeave += delegate { AnimationHelper.MouseLeaveBgTexColor(RestartBrush); }; }; }