private void AddGenericEvents(ColorAnimation colorAnimation) { KeyDown += (_, e) => Shortcuts.GenericWindowShortcuts.KeysDown(null, e, this); // CloseButton CloseButton.TheButton.Click += delegate { Hide(); }; // MinButton MinButton.TheButton.Click += delegate { SystemCommands.MinimizeWindow(this); }; TitleBar.MouseLeftButtonDown += delegate { DragMove(); }; // BlueRadio BlueRadio.PreviewMouseLeftButtonDown += BlueRadio_PreviewMouseLeftButtonDown; BlueRadio.MouseEnter += BlueRadio_MouseEnter; BlueRadio.MouseLeave += BlueRadio_MouseLeave; BlueRadio.Click += Blue; // PinkRadio PinkRadio.PreviewMouseLeftButtonDown += PinkRadio_PreviewMouseLeftButtonDown; PinkRadio.MouseEnter += PinkRadio_MouseEnter; PinkRadio.MouseLeave += PinkRadio_MouseLeave; PinkRadio.Click += Pink; // OrangeRadio OrangeRadio.PreviewMouseLeftButtonDown += OrangeRadio_PreviewMouseLeftButtonDown; OrangeRadio.MouseEnter += OrangeRadio_MouseEnter; OrangeRadio.MouseLeave += OrangeRadio_MouseLeave; OrangeRadio.Click += Orange; // GreenRadio GreenRadio.PreviewMouseLeftButtonDown += GreenRadio_PreviewMouseLeftButtonDown; GreenRadio.MouseEnter += GreenRadio_MouseEnter; GreenRadio.MouseLeave += GreenRadio_MouseLeave; GreenRadio.Click += Green; // RedRadio RedRadio.PreviewMouseLeftButtonDown += RedRadio_PreviewMouseLeftButtonDown; RedRadio.MouseEnter += RedRadio_MouseEnter; RedRadio.MouseLeave += RedRadio_MouseLeave; RedRadio.Click += Red; // TealRadio TealRadio.PreviewMouseLeftButtonDown += TealRadio_PreviewMouseLeftButtonDown; TealRadio.MouseEnter += TealRadio_MouseEnter; TealRadio.MouseLeave += TealRadio_MouseLeave; TealRadio.Click += Teal; // AquaRadio AquaRadio.PreviewMouseLeftButtonDown += AquaRadio_PreviewMouseLeftButtonDown; AquaRadio.MouseEnter += AquaRadio_MouseEnter; AquaRadio.MouseLeave += AquaRadio_MouseLeave; AquaRadio.Click += Aqua; // GoldenRadio GoldenRadio.PreviewMouseLeftButtonDown += GoldenRadio_PreviewMouseLeftButtonDown; GoldenRadio.MouseEnter += GoldenRadio_MouseEnter; GoldenRadio.MouseLeave += GoldenRadio_MouseLeave; GoldenRadio.Click += Golden; // PurpleRadio PurpleRadio.PreviewMouseLeftButtonDown += PurpleRadio_PreviewMouseLeftButtonDown; PurpleRadio.MouseEnter += PurpleRadio_MouseEnter; PurpleRadio.MouseLeave += PurpleRadio_MouseLeave; PurpleRadio.Click += Purple; // CyanRadio CyanRadio.PreviewMouseLeftButtonDown += CyanRadio_PreviewMouseLeftButtonDown; CyanRadio.MouseEnter += CyanRadio_MouseEnter; CyanRadio.MouseLeave += CyanRadio_MouseLeave; CyanRadio.Click += Cyan; // MagentaRadio MagentaRadio.PreviewMouseLeftButtonDown += MagentaRadio_PreviewMouseLeftButtonDown; MagentaRadio.MouseEnter += MagentaRadio_MouseEnter; MagentaRadio.MouseLeave += MagentaRadio_MouseLeave; MagentaRadio.Click += Magenta; // LimeRadio LimeRadio.Click += Lime; LimeRadio.PreviewMouseLeftButtonDown += LimeRadio_PreviewMouseLeftButtonDown; LimeRadio.MouseEnter += LimeRadio_MouseEnter; LimeRadio.MouseLeave += Lime_MouseLeave; // WallpaperApply WallpaperApply.MouseEnter += delegate { colorAnimation.From = AnimationHelper.GetPrefferedColorOver(); colorAnimation.To = AnimationHelper.GetPrefferedColorDown(); WallpaperApplyBrush.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; WallpaperApply.MouseLeave += delegate { colorAnimation.From = AnimationHelper.GetPrefferedColorDown(); colorAnimation.To = AnimationHelper.GetPrefferedColorOver(); WallpaperApplyBrush.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; // SetAsDefaultTxt SetAsDefaultTxt.MouseEnter += delegate { colorAnimation.From = AnimationHelper.GetPrefferedColorOver(); colorAnimation.To = AnimationHelper.GetPrefferedColorDown(); SetAsDefaultTxtBrush.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; SetAsDefaultTxt.MouseLeave += delegate { colorAnimation.From = AnimationHelper.GetPrefferedColorDown(); colorAnimation.To = AnimationHelper.GetPrefferedColorOver(); SetAsDefaultTxtBrush.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; // RestartTheme ThemeRestart.MouseEnter += delegate { colorAnimation.From = mainColor; colorAnimation.To = AnimationHelper.GetPrefferedColorDown(); ThemeRestartTxt.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; ThemeRestart.MouseLeave += delegate { colorAnimation.From = AnimationHelper.GetPrefferedColorDown(); colorAnimation.To = mainColor; ThemeRestartTxt.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; // LanguageRestart LanguageRestart.MouseEnter += delegate { colorAnimation.From = mainColor; colorAnimation.To = AnimationHelper.GetPrefferedColorDown(); LanguageRestartTxt.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; LanguageRestart.MouseLeave += delegate { colorAnimation.From = AnimationHelper.GetPrefferedColorDown(); colorAnimation.To = mainColor; LanguageRestartTxt.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; // 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.MouseLeave += delegate { ButtonMouseLeaveAnim(SubDirText); }; // TopmostRadio TopmostRadio.PreviewMouseLeftButtonDown += delegate { PreviewMouseButtonDownAnim(TopMostDirText); }; TopmostRadio.MouseEnter += delegate { ButtonMouseOverAnim(TopMostDirText); }; TopmostRadio.MouseLeave += delegate { ButtonMouseLeaveAnim(TopMostDirText); }; // CenterRadio CenterRadio.PreviewMouseLeftButtonDown += delegate { PreviewMouseButtonDownAnim(CenterubDirText); }; CenterRadio.MouseEnter += delegate { ButtonMouseOverAnim(CenterubDirText); }; CenterRadio.MouseLeave += delegate { ButtonMouseLeaveAnim(CenterubDirText); }; // BorderRadio BorderRadio.PreviewMouseLeftButtonDown += delegate { PreviewMouseButtonDownAnim(BorderBrushText); }; BorderRadio.MouseEnter += delegate { ButtonMouseOverAnim(BorderBrushText); }; BorderRadio.MouseLeave += delegate { ButtonMouseLeaveAnim(BorderBrushText); }; // AltUIRadio AltUIRadio.PreviewMouseLeftButtonDown += delegate { PreviewMouseButtonDownAnim(AltUIText); }; AltUIRadio.MouseEnter += delegate { ButtonMouseOverAnim(AltUIText); }; AltUIRadio.MouseLeave += delegate { ButtonMouseLeaveAnim(AltUIText); }; // ScrollZoom ScrollZoom.PreviewMouseLeftButtonDown += delegate { PreviewMouseButtonDownAnim(ScrollZoomText); }; ScrollZoom.MouseEnter += delegate { ButtonMouseOverAnim(ScrollZoomText); }; ScrollZoom.MouseLeave += delegate { ButtonMouseLeaveAnim(ScrollZoomText); }; // CtrlZoom CtrlZoom.PreviewMouseLeftButtonDown += delegate { PreviewMouseButtonDownAnim(CtrlZoomText); }; CtrlZoom.MouseEnter += delegate { ButtonMouseOverAnim(CtrlZoomText); }; CtrlZoom.MouseLeave += delegate { ButtonMouseLeaveAnim(CtrlZoomText); }; if (!Properties.Settings.Default.DarkTheme) { BlueRadio.MouseEnter += delegate { colorAnimation.From = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); colorAnimation.To = Colors.White; BlueText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; BlueRadio.MouseLeave += delegate { colorAnimation.From = Colors.White; colorAnimation.To = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); BlueText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; CyanRadio.MouseEnter += delegate { colorAnimation.From = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); colorAnimation.To = Colors.White; CyanText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; CyanRadio.MouseLeave += delegate { colorAnimation.From = Colors.White; colorAnimation.To = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); CyanText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; AquaRadio.MouseEnter += delegate { colorAnimation.From = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); colorAnimation.To = Colors.White; AquaText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; AquaRadio.MouseLeave += delegate { colorAnimation.From = Colors.White; colorAnimation.To = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); AquaText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; TealRadio.MouseEnter += delegate { colorAnimation.From = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); colorAnimation.To = Colors.White; TealText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; TealRadio.MouseLeave += delegate { colorAnimation.From = Colors.White; colorAnimation.To = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); TealText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; LimeRadio.MouseEnter += delegate { colorAnimation.From = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); colorAnimation.To = Colors.White; LimeText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; LimeRadio.MouseLeave += delegate { colorAnimation.From = Colors.White; colorAnimation.To = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); LimeText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; GreenRadio.MouseEnter += delegate { colorAnimation.From = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); colorAnimation.To = Colors.White; GreenText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; GreenRadio.MouseLeave += delegate { colorAnimation.From = Colors.White; colorAnimation.To = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); GreenText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; GoldenRadio.MouseEnter += delegate { colorAnimation.From = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); colorAnimation.To = Colors.White; GoldenText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; GoldenRadio.MouseLeave += delegate { colorAnimation.From = Colors.White; colorAnimation.To = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); GoldenText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; OrangeRadio.MouseEnter += delegate { colorAnimation.From = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); colorAnimation.To = Colors.White; OrangeText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; OrangeRadio.MouseLeave += delegate { colorAnimation.From = Colors.White; colorAnimation.To = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); OrangeText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; RedRadio.MouseEnter += delegate { colorAnimation.From = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); colorAnimation.To = Colors.White; RedText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; RedRadio.MouseLeave += delegate { colorAnimation.From = Colors.White; colorAnimation.To = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); RedText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; PinkRadio.MouseEnter += delegate { colorAnimation.From = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); colorAnimation.To = Colors.White; PinkText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; PinkRadio.MouseLeave += delegate { colorAnimation.From = Colors.White; colorAnimation.To = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); PinkText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; MagentaRadio.MouseEnter += delegate { colorAnimation.From = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); colorAnimation.To = Colors.White; MagentaText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; MagentaRadio.MouseLeave += delegate { colorAnimation.From = Colors.White; colorAnimation.To = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); MagentaText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; PurpleRadio.MouseEnter += delegate { colorAnimation.From = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); colorAnimation.To = Colors.White; PurpleText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; PurpleRadio.MouseLeave += delegate { colorAnimation.From = Colors.White; colorAnimation.To = Color.FromArgb(mainColor.A, mainColor.R, mainColor.G, mainColor.B); PurpleText.BeginAnimation(SolidColorBrush.ColorProperty, colorAnimation); }; } }
private void MinimizeWindow(Window window) => SystemCommands.MinimizeWindow(window);
private void Button_Click_Minimize(object sender, RoutedEventArgs e) { SystemCommands.MinimizeWindow(this); }
/// <summary> /// ウインドウを最小化します /// </summary> private void MinimizeWindow(object sender, ExecutedRoutedEventArgs e) { SystemCommands.MinimizeWindow(Window); }
/// <summary> /// Start adding events /// </summary> internal static void Go() { // keyboard and Mouse_Keys Keys LoadWindows.GetMainWindow.KeyDown += MainWindow_KeysDown; LoadWindows.GetMainWindow.KeyUp += MainWindow_KeysUp; LoadWindows.GetMainWindow.MouseDown += MainWindow_MouseDown; // MinButton LoadWindows.GetMainWindow.MinButton.TheButton.Click += (s, x) => SystemCommands.MinimizeWindow(LoadWindows.GetMainWindow); // CloseButton LoadWindows.GetMainWindow.CloseButton.TheButton.Click += (s, x) => SystemCommands.CloseWindow(LoadWindows.GetMainWindow); // FileMenuButton LoadWindows.GetMainWindow.FileMenuButton.PreviewMouseLeftButtonDown += (s, x) => PreviewMouseButtonDownAnim(LoadWindows.GetMainWindow.FolderFill); LoadWindows.GetMainWindow.FileMenuButton.MouseEnter += (s, x) => ButtonMouseOverAnim(LoadWindows.GetMainWindow.FolderFill); LoadWindows.GetMainWindow.FileMenuButton.MouseEnter += (s, x) => AnimationHelper.MouseEnterBgTexColor(LoadWindows.GetMainWindow.FileMenuBg); LoadWindows.GetMainWindow.FileMenuButton.MouseLeave += (s, x) => ButtonMouseLeaveAnim(LoadWindows.GetMainWindow.FolderFill); LoadWindows.GetMainWindow.FileMenuButton.MouseLeave += (s, x) => AnimationHelper.MouseLeaveBgTexColor(LoadWindows.GetMainWindow.FileMenuBg); LoadWindows.GetMainWindow.FileMenuButton.Click += Toggle_open_menu; GetFileMenu.Open.Click += (s, x) => Open(); GetFileMenu.FileLocation.Click += (s, x) => Open_In_Explorer(); GetFileMenu.Print.Click += (s, x) => Print(Pics[FolderIndex]); GetFileMenu.SaveButton.Click += (s, x) => SaveFiles(); GetFileMenu.OpenBorder.MouseLeftButtonUp += (s, x) => Open(); GetFileMenu.FileLocationBorder.MouseLeftButtonUp += (s, x) => Open_In_Explorer(); GetFileMenu.PrintBorder.MouseLeftButtonUp += (s, x) => Print(Pics[FolderIndex]); GetFileMenu.SaveBorder.MouseLeftButtonUp += (s, x) => SaveFiles(); // image_button LoadWindows.GetMainWindow.image_button.PreviewMouseLeftButtonDown += (s, x) => PreviewMouseButtonDownAnim(LoadWindows.GetMainWindow.ImagePath1Fill, LoadWindows.GetMainWindow.ImagePath2Fill, LoadWindows.GetMainWindow.ImagePath3Fill); LoadWindows.GetMainWindow.image_button.MouseEnter += (s, x) => ButtonMouseOverAnim(LoadWindows.GetMainWindow.ImagePath1Fill, LoadWindows.GetMainWindow.ImagePath2Fill, LoadWindows.GetMainWindow.ImagePath3Fill); LoadWindows.GetMainWindow.image_button.MouseEnter += (s, x) => AnimationHelper.MouseEnterBgTexColor(LoadWindows.GetMainWindow.ImageMenuBg); LoadWindows.GetMainWindow.image_button.MouseLeave += (s, x) => ButtonMouseLeaveAnim(LoadWindows.GetMainWindow.ImagePath1Fill, LoadWindows.GetMainWindow.ImagePath2Fill, LoadWindows.GetMainWindow.ImagePath3Fill); LoadWindows.GetMainWindow.image_button.MouseLeave += (s, x) => AnimationHelper.MouseLeaveBgTexColor(LoadWindows.GetMainWindow.ImageMenuBg); LoadWindows.GetMainWindow.image_button.Click += Toggle_image_menu; // imageSettingsMenu Buttons GetImageSettingsMenu.Contained_Gallery.Click += delegate { Close_UserControls(); GalleryToggle.OpenContainedGallery(); }; GetImageSettingsMenu.Fullscreen_Gallery.Click += delegate { Close_UserControls(); GalleryToggle.OpenFullscreenGallery(); }; // SettingsButton LoadWindows.GetMainWindow.SettingsButton.PreviewMouseLeftButtonDown += (s, x) => PreviewMouseButtonDownAnim(LoadWindows.GetMainWindow.SettingsButtonFill); LoadWindows.GetMainWindow.SettingsButton.MouseEnter += (s, x) => ButtonMouseOverAnim(LoadWindows.GetMainWindow.SettingsButtonFill); LoadWindows.GetMainWindow.SettingsButton.MouseEnter += (s, x) => AnimationHelper.MouseEnterBgTexColor(LoadWindows.GetMainWindow.SettingsMenuBg); LoadWindows.GetMainWindow.SettingsButton.MouseLeave += (s, x) => ButtonMouseLeaveAnim(LoadWindows.GetMainWindow.SettingsButtonFill); LoadWindows.GetMainWindow.SettingsButton.MouseLeave += (s, x) => AnimationHelper.MouseLeaveBgTexColor(LoadWindows.GetMainWindow.SettingsMenuBg); LoadWindows.GetMainWindow.SettingsButton.Click += Toggle_quick_settings_menu; //FunctionButton var MagicBrush = LoadWindows.GetMainWindow.TryFindResource("MagicBrush") as SolidColorBrush; LoadWindows.GetMainWindow.FunctionMenuButton.PreviewMouseLeftButtonDown += (s, x) => PreviewMouseButtonDownAnim(MagicBrush); LoadWindows.GetMainWindow.FunctionMenuButton.MouseEnter += (s, x) => ButtonMouseOverAnim(MagicBrush); LoadWindows.GetMainWindow.FunctionMenuButton.MouseEnter += (s, x) => AnimationHelper.MouseEnterBgTexColor(LoadWindows.GetMainWindow.EffectsMenuBg); LoadWindows.GetMainWindow.FunctionMenuButton.MouseLeave += (s, x) => ButtonMouseLeaveAnim(MagicBrush); LoadWindows.GetMainWindow.FunctionMenuButton.MouseLeave += (s, x) => AnimationHelper.MouseLeaveBgTexColor(LoadWindows.GetMainWindow.EffectsMenuBg); LoadWindows.GetMainWindow.FunctionMenuButton.Click += Toggle_Functions_menu; // ClickArrows GetClickArrowLeft.MouseLeftButtonDown += (s, x) => PicButton(true, false); GetClickArrowRight.MouseLeftButtonDown += (s, x) => PicButton(true, true); // x2 Getx2.MouseLeftButtonDown += (x, xx) => SystemCommands.CloseWindow(LoadWindows.GetMainWindow); // Minus GetMinus.MouseLeftButtonDown += (s, x) => SystemCommands.MinimizeWindow(LoadWindows.GetMainWindow); // GalleryShortcut GetGalleryShortcut.MouseLeftButtonDown += (s, x) => GalleryToggle.Toggle(); // Bar LoadWindows.GetMainWindow.TitleText.GotKeyboardFocus += EditTitleBar.EditTitleBar_Text; LoadWindows.GetMainWindow.TitleText.InnerTextBox.PreviewKeyDown += CustomTextBoxShortcuts.CustomTextBox_KeyDown; LoadWindows.GetMainWindow.TitleText.PreviewMouseLeftButtonDown += EditTitleBar.Bar_PreviewMouseLeftButtonDown; LoadWindows.GetMainWindow.TitleText.PreviewMouseRightButtonDown += EditTitleBar.Bar_PreviewMouseRightButtonDown; // img LoadWindows.GetMainWindow.MainImage.PreviewMouseLeftButtonDown += DragAndDrop.DragToExplorer.DragFile; LoadWindows.GetMainWindow.MainImage.MouseLeftButtonDown += MainImage_MouseLeftButtonDown; LoadWindows.GetMainWindow.MainImage.MouseLeftButtonUp += MainImage_MouseLeftButtonUp; LoadWindows.GetMainWindow.MainImage.MouseMove += MainImage_MouseMove; LoadWindows.GetMainWindow.MainImage.MouseWheel += MainImage_MouseWheel; // bg LoadWindows.GetMainWindow.ParentContainer.MouseLeftButtonDown += Bg_MouseLeftButtonDown; LoadWindows.GetMainWindow.ParentContainer.Drop += Image_Drop; LoadWindows.GetMainWindow.ParentContainer.DragEnter += Image_DragEnter; LoadWindows.GetMainWindow.ParentContainer.DragLeave += Image_DragLeave; LoadWindows.GetMainWindow.ParentContainer.MouseEnter += Interface_MouseEnter; LoadWindows.GetMainWindow.ParentContainer.MouseMove += Interface_MouseMove; LoadWindows.GetMainWindow.ParentContainer.MouseLeave += Interface_MouseLeave; // TooltipStyle GetToolTipMessage.MouseWheel += MainImage_MouseWheel; // TitleBar LoadWindows.GetMainWindow.TitleBar.MouseLeftButtonDown += Move; LoadWindows.GetMainWindow.TitleBar.MouseLeave += Restore_From_Move; // Lower Bar LoadWindows.GetMainWindow.LowerBar.Drop += Image_Drop; LoadWindows.GetMainWindow.LowerBar.MouseLeftButtonDown += MoveAlt; // This LoadWindows.GetMainWindow.Closing += Window_Closing; LoadWindows.GetMainWindow.StateChanged += MainWindow_StateChanged; //LocationChanged += MainWindow_LocationChanged; Microsoft.Win32.SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged; #if DEBUG Trace.WriteLine("Events loaded"); #endif }
// Minimize Window private void MainWindow_Minimize(object sender, System.Windows.RoutedEventArgs e) { SystemCommands.MinimizeWindow(this); }
/// <summary>The min button click.</summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> private void MinButtonClick(object sender, RoutedEventArgs e) { sender.ForWindowFromTemplate(w => SystemCommands.MinimizeWindow(w)); }
protected void MinimizeButton_Click(object sender, RoutedEventArgs e) { SystemCommands.MinimizeWindow(this); }
/// <summary> /// 最小化ボタン押下時に実行されるメソッド /// </summary> private void Window_Minimize() { SystemCommands.MinimizeWindow(this._OwnerWindow); }
private void HideWindow_Click(object sender, RoutedEventArgs e) { SystemCommands.MinimizeWindow(this); }
private CaptionButtonViewModel Create(CaptionButtonType type) { switch (type) { case CaptionButtonType.Close: return(CreateButton(type, PackIconKind.Close, "Close", () => SystemCommands.CloseWindow(_window))); case CaptionButtonType.Maximize: return(CreateButton(type, PackIconKind.WindowMaximize, "Maximize", () => SystemCommands.MaximizeWindow(_window))); case CaptionButtonType.Minimize: return(CreateButton(type, PackIconKind.WindowMinimize, "Minimize", () => SystemCommands.MinimizeWindow(_window))); case CaptionButtonType.Restore: return(CreateButton(type, PackIconKind.WindowRestore, "Restore", () => SystemCommands.RestoreWindow(_window))); case CaptionButtonType.EnterFullScreen: return(CreateButton(type, PackIconKind.Fullscreen, "Fullscreen", () => GoToState(AppWindowState.FullScreen))); case CaptionButtonType.ExitFullScreen: return(CreateButton(type, PackIconKind.FullscreenExit, "Exit fullscreen", () => GoToState(_stateBeforeFullscreen))); case CaptionButtonType.DockLeft: return(CreateButton(type, PackIconKind.ArrowCollapseLeft, "Dock left", () => DockLeft())); case CaptionButtonType.DockRight: return(CreateButton(type, PackIconKind.ArrowCollapseRight, "Dock right", () => DockRight())); case CaptionButtonType.CompactView: return(CreateButton(type, PackIconKind.Crop, "Compact View", () => GoToState(AppWindowState.Compact))); case CaptionButtonType.NormalView: return(CreateButton(type, PackIconKind.FilePresentationBox, "Normal View", () => GoToState(AppWindowState.Normal))); default: throw new Exception(); } }
private void Svern(object sender, RoutedEventArgs e) { SystemCommands.MinimizeWindow(this); }
private void MinimizeCommandHandler(object sender, ExecutedRoutedEventArgs e) { SystemCommands.MinimizeWindow(this); }
private void MinimizeWindow() { SystemCommands.MinimizeWindow(this); }
private void MinimizeExecuted(object sender, ExecutedRoutedEventArgs e) => SystemCommands.MinimizeWindow(this);
private void Window_ContentRendered(object sender, EventArgs e) { KeyUp += (_, e) => { if (e.Key == Key.Escape) { Hide(); ConfigureWindows.GetMainWindow.Focus(); } else if (e.Key == Key.Q) { if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) { Environment.Exit(0); } } }; // Hack to deselect border on mouse click MouseLeftButtonDown += delegate { FocusManager.SetFocusedElement(FocusManager.GetFocusScope(this), null); Keyboard.ClearFocus(); Focus(); }; // CloseButton CloseButton.TheButton.Click += delegate { Hide(); ConfigureWindows.GetMainWindow.Focus(); }; // MinButton MinButton.TheButton.Click += delegate { SystemCommands.MinimizeWindow(this); }; TitleBar.MouseLeftButtonDown += delegate { DragMove(); }; MainBackground.MouseLeftButtonDown += delegate { DragMove(); }; // FileProperties FileProperties.PreviewMouseLeftButtonDown += delegate { PreviewMouseButtonDownAnim(FilePropertiesFill); }; FileProperties.MouseEnter += delegate { ButtonMouseOverAnim(FilePropertiesFill); }; FileProperties.MouseEnter += delegate { AnimationHelper.MouseEnterBgTexColor(FilePropertiesBrush); }; FileProperties.MouseLeave += delegate { ButtonMouseLeaveAnim(FilePropertiesFill); }; FileProperties.MouseLeave += delegate { AnimationHelper.MouseLeaveBgTexColor(FilePropertiesBrush); }; FileProperties.Click += delegate { SystemIntegration.NativeMethods.ShowFileProperties(Pics[FolderIndex]); }; // Print Print.PreviewMouseLeftButtonDown += delegate { PreviewMouseButtonDownAnim(PrintFill); }; Print.MouseEnter += delegate { ButtonMouseOverAnim(PrintFill); }; Print.MouseEnter += delegate { AnimationHelper.MouseEnterBgTexColor(PrintBrush); }; Print.MouseLeave += delegate { ButtonMouseLeaveAnim(PrintFill); }; Print.MouseLeave += delegate { AnimationHelper.MouseLeaveBgTexColor(PrintBrush); }; Print.Click += delegate { FileHandling.Open_Save.Print(Pics[FolderIndex]); }; // OpenWith OpenWith.PreviewMouseLeftButtonDown += delegate { PreviewMouseButtonDownAnim(OpenWithFill); }; OpenWith.MouseEnter += delegate { ButtonMouseOverAnim(OpenWithFill); }; OpenWith.MouseEnter += delegate { AnimationHelper.MouseEnterBgTexColor(OpenWithBrush); }; OpenWith.MouseLeave += delegate { ButtonMouseLeaveAnim(OpenWithFill); }; OpenWith.MouseLeave += delegate { AnimationHelper.MouseLeaveBgTexColor(OpenWithBrush); }; OpenWith.Click += delegate { FileHandling.Open_Save.OpenWith(Pics[FolderIndex]); }; // ShowInFoler ShowInFoler.PreviewMouseLeftButtonDown += delegate { PreviewMouseButtonDownAnim(ShowInFolerFill); }; ShowInFoler.MouseEnter += delegate { ButtonMouseOverAnim(ShowInFolerFill); }; ShowInFoler.MouseEnter += delegate { AnimationHelper.MouseEnterBgTexColor(ShowInFolerBrush); }; ShowInFoler.MouseLeave += delegate { ButtonMouseLeaveAnim(ShowInFolerFill); }; ShowInFoler.MouseLeave += delegate { AnimationHelper.MouseLeaveBgTexColor(ShowInFolerBrush); }; ShowInFoler.Click += delegate { FileHandling.Open_Save.Open_In_Explorer(); }; FilenameCopy.TheButton.Click += delegate { Clipboard.SetText(FilenameBox.Text); }; FolderCopy.TheButton.Click += delegate { Clipboard.SetText(FolderBox.Text); }; FullpathCopy.TheButton.Click += delegate { Clipboard.SetText(FullPathBox.Text); }; CreatedCopy.TheButton.Click += delegate { Clipboard.SetText(CreatedBox.Text); }; ModifiedCopy.TheButton.Click += delegate { Clipboard.SetText(ModifiedBox.Text); }; SizePxCopy.TheButton.Click += delegate { Clipboard.SetText(SizePxBox.Text); }; SizeMpCopy.TheButton.Click += delegate { Clipboard.SetText(SizeMpBox.Text); }; DpiCopy.TheButton.Click += delegate { Clipboard.SetText(ResolutionBox.Text); }; PrintSizeCmCopy.TheButton.Click += delegate { Clipboard.SetText(PrintSizeCmBox.Text); }; PrintSizeInCopy.TheButton.Click += delegate { Clipboard.SetText(PrintSizeInBox.Text); }; AspectRatioCopy.TheButton.Click += delegate { Clipboard.SetText(AspectRatioBox.Text); }; if (Pics.Count > 0) { UpdateValues(); } }
internal static void EnableBlur(Window win) { var windowHelper = new WindowInteropHelper(win); // ウィンドウに半透明のアクリル効果を適用する AcrylicHelper.EnableBlur(windowHelper.Handle); // タイトルバーの各種ボタンで利用するコマンドの設定 win.CommandBindings.Add(new CommandBinding(SystemCommands.CloseWindowCommand, (_, __) => { SystemCommands.CloseWindow(win); })); win.CommandBindings.Add(new CommandBinding(SystemCommands.MinimizeWindowCommand, (_, __) => { SystemCommands.MinimizeWindow(win); })); win.CommandBindings.Add(new CommandBinding(SystemCommands.MaximizeWindowCommand, (_, __) => { SystemCommands.MaximizeWindow(win); })); win.CommandBindings.Add(new CommandBinding(SystemCommands.RestoreWindowCommand, (_, __) => { SystemCommands.RestoreWindow(win); })); // WPFのSizeToContentのバグ対策 // (WindowChrome使用時に、SizeToContentのウィンドウサイズ計算が正しく行われない) void onContentRendered(object sender, EventArgs e) { if (win.SizeToContent != SizeToContent.Manual) { win.InvalidateMeasure(); } win.ContentRendered -= onContentRendered; } win.ContentRendered += onContentRendered; }
private void MinimizeImage_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { SystemCommands.MinimizeWindow(this); }
private void OnMinimizeWindow(object target, ExecutedRoutedEventArgs e) { SystemCommands.MinimizeWindow(this); }
/// <summary> /// Overridable event handler for the event raised when Minimize button is clicked /// </summary> /// <param name="sender">Sender</param> /// <param name="e">RoutedEventArgs</param> protected virtual void OnMinimize(object sender, RoutedEventArgs e) { SystemCommands.MinimizeWindow(this); }
private void button_minimize_Click(object sender, RoutedEventArgs e) { SystemCommands.MinimizeWindow(Application.Current.MainWindow); }
private void minimizebtn_PreviewMouseDown(object sender, MouseButtonEventArgs e) { SystemCommands.MinimizeWindow(this); }
// Minimize protected void CommandBinding_Executed_Minimize(object sender, ExecutedRoutedEventArgs e) { SystemCommands.MinimizeWindow(this); }
void MinButton_Click(object Sender, RoutedEventArgs Args) => SystemCommands.MinimizeWindow(this);
private void MinimazeButton_MouseDown(object sender, MouseButtonEventArgs e) { SystemCommands.MinimizeWindow(this); }
private void MinimizeButtonClick(object sender, RoutedEventArgs e) { AssignWindow(sender); SystemCommands.MinimizeWindow(window); }
internal static void EnableBlur(Window win) { var windowHelper = new WindowInteropHelper(win); var accent = new AccentPolicy(); var accentStructSize = Marshal.SizeOf(accent); // ウィンドウ背景のぼかしを行うのはWindows10の場合のみ // OSのバージョンに従い、AccentStateを切り替える var currentVersion = SystemInfo.Version.Value; if (currentVersion >= VersionInfos.Windows10_1809) { accent.AccentState = AccentState.ACCENT_ENABLE_ACRYLICBLURBEHIND; } else if (currentVersion >= VersionInfos.Windows10) { accent.AccentState = AccentState.ACCENT_ENABLE_BLURBEHIND; } else { accent.AccentState = AccentState.ACCENT_ENABLE_TRANSPARENTGRADIENT; } accent.AccentFlags = 2; //accent.GradientColor = 0x99FFFFFF; // 60%の透明度が基本 accent.GradientColor = 0x00FFFFFF; // Tint Colorはここでは設定せず、Bindingで外部から変えられるようにXAML側のレイヤーとして定義 var accentPtr = Marshal.AllocHGlobal(accentStructSize); Marshal.StructureToPtr(accent, accentPtr, false); var data = new WindowCompositionAttributeData(); data.Attribute = WindowCompositionAttribute.WCA_ACCENT_POLICY; data.SizeOfData = accentStructSize; data.Data = accentPtr; SetWindowCompositionAttribute(windowHelper.Handle, ref data); Marshal.FreeHGlobal(accentPtr); win.CommandBindings.Add(new CommandBinding(SystemCommands.CloseWindowCommand, (_, __) => { SystemCommands.CloseWindow(win); })); win.CommandBindings.Add(new CommandBinding(SystemCommands.MinimizeWindowCommand, (_, __) => { SystemCommands.MinimizeWindow(win); })); win.CommandBindings.Add(new CommandBinding(SystemCommands.MaximizeWindowCommand, (_, __) => { SystemCommands.MaximizeWindow(win); })); win.CommandBindings.Add(new CommandBinding(SystemCommands.RestoreWindowCommand, (_, __) => { SystemCommands.RestoreWindow(win); })); }
private void MinimizeWindow() { SystemCommands.MinimizeWindow(this.GetParentWindow()); }
/// <summary> /// Custom command binding for managing Minimizing the application /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CommandBindingMinimize_Executed(object sender, ExecutedRoutedEventArgs e) { SystemCommands.MinimizeWindow(this); }
private void SpecialMinimizeButton_Click(object sender, RoutedEventArgs e) { SystemCommands.MinimizeWindow(Window.GetWindow(this)); }