Exemple #1
0
 private void OnCloseWindow(object target, ExecutedRoutedEventArgs e)
 {
     SystemCommands.CloseWindow(this);
 }
Exemple #2
0
 private void OnCancel()
 {
     dlg.Result = false;
     SystemCommands.CloseWindow(dlg);
 }
 private void CommandBinding_Executed_Close(object sender, ExecutedRoutedEventArgs e)
 {
     SystemCommands.CloseWindow(this);
 }
 private void btnClose_Click(object sender, RoutedEventArgs e)
 {
     SystemCommands.CloseWindow(this);
 }
 private void SpecialCloseButton_Click(object sender, RoutedEventArgs e)
 {
     SystemCommands.CloseWindow(Window.GetWindow(this));
 }
 /// <summary>The close button click.</summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The e.</param>
 private void CloseButtonClick(object sender, RoutedEventArgs e)
 {
     sender.ForWindowFromTemplate(w => SystemCommands.CloseWindow(w));
 }
Exemple #7
0
 /// <summary>
 /// 閉じるボタン押下時に実行されるメソッド
 /// </summary>
 private void Window_Close()
 {
     SystemCommands.CloseWindow(this._OwnerWindow);
 }
 private void _OnSystemCommandCloseWindow(object sender, ExecutedRoutedEventArgs e)
 {
     SystemCommands.CloseWindow((Window)e.Parameter);
 }
Exemple #9
0
        internal static void MainWindow_KeysDown(object sender, KeyEventArgs e)
        {
            // Don't allow keys when typing in text
            if (GetMainWindow.TitleText.IsKeyboardFocusWithin)
            {
                return;
            }

            var ctrlDown  = (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control;
            var altDown   = (Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt;
            var shiftDown = (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift;

            #region CroppingKeys

            if (GetCropppingTool != null)
            {
                if (GetCropppingTool.IsVisible)
                {
                    if (e.Key == Key.Escape)
                    {
                        CropFunctions.CloseCrop();
                        e.Handled = true;
                        return;
                    }

                    if (e.Key == Key.Enter)
                    {
                        CropFunctions.PerformCrop();
                        e.Handled = true;
                        return;
                    }
                    e.Handled = true;
                    return;
                }
            }

            #endregion CroppingKeys

            #region Keys where it can be held down

            switch (e.Key)
            {
            case Key.BrowserForward:
            case Key.Right:
            case Key.D:
                if (GetPicGallery != null)
                {
                    if (GalleryFunctions.IsOpen)
                    {
                        return;
                    }
                }
                if (!e.IsRepeat)
                {
                    // Go to first if Ctrl held down
                    if (ctrlDown && !GalleryFunctions.IsOpen)
                    {
                        Pic(true, true);
                    }
                    else
                    {
                        Pic();
                    }
                }
                else if (CanNavigate)
                {
                    FastPic(true);
                }
                return;

            case Key.BrowserBack:
            case Key.Left:
            case Key.A:
                if (GetPicGallery != null)
                {
                    if (GalleryFunctions.IsOpen)
                    {
                        return;
                    }
                }
                if (!e.IsRepeat)
                {
                    // Go to last if Ctrl held down
                    if (ctrlDown && !GalleryFunctions.IsOpen)
                    {
                        Pic(false, true);
                    }
                    else
                    {
                        Pic(false);
                    }
                }
                else if (CanNavigate)
                {
                    FastPic(false);
                }
                return;

            case Key.PageUp:
                if (GetPicGallery != null)
                {
                    if (GalleryFunctions.IsOpen)
                    {
                        GalleryNavigation.ScrollTo(true, ctrlDown);
                        return;
                    }
                }
                if (Properties.Settings.Default.ScrollEnabled)
                {
                    GetMainWindow.Scroller.ScrollToVerticalOffset(GetMainWindow.Scroller.VerticalOffset - 30);
                }

                return;

            case Key.PageDown:
                if (GetPicGallery != null)
                {
                    if (GalleryFunctions.IsOpen)
                    {
                        GalleryNavigation.ScrollTo(false, (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control);
                        return;
                    }
                }
                if (Properties.Settings.Default.ScrollEnabled)
                {
                    GetMainWindow.Scroller.ScrollToVerticalOffset(GetMainWindow.Scroller.VerticalOffset + 30);
                }

                return;

            case Key.Up:
            case Key.W:
                if (GetPicGallery != null)
                {
                    if (GalleryFunctions.IsOpen)
                    {
                        GalleryNavigation.ScrollTo(true, ctrlDown);
                    }
                    else
                    {
                        Rotate(true);
                    }
                }
                else
                {
                    Rotate(false);
                }
                if (Properties.Settings.Default.ScrollEnabled)
                {
                    GetMainWindow.Scroller.ScrollToVerticalOffset(GetMainWindow.Scroller.VerticalOffset - 30);
                }
                return;

            case Key.Down:
                if (GetPicGallery != null)
                {
                    if (GalleryFunctions.IsOpen)
                    {
                        GalleryNavigation.ScrollTo(false, ctrlDown);
                    }
                    else
                    {
                        Rotate(true);
                    }
                }
                else if (Properties.Settings.Default.ScrollEnabled)
                {
                    GetMainWindow.Scroller.ScrollToVerticalOffset(GetMainWindow.Scroller.VerticalOffset + 30);
                }
                else
                {
                    Rotate(true);
                }
                return;

            case Key.S:
                if (ctrlDown && !GalleryFunctions.IsOpen)
                {
                    SaveFiles();
                }
                else if (GetPicGallery != null)
                {
                    if (GalleryFunctions.IsOpen)
                    {
                        GalleryNavigation.ScrollTo(false, ctrlDown);
                    }
                    else
                    {
                        Rotate(false);
                    }
                }
                else if (Properties.Settings.Default.ScrollEnabled)
                {
                    GetMainWindow.Scroller.ScrollToVerticalOffset(GetMainWindow.Scroller.VerticalOffset + 30);
                }
                else
                {
                    Rotate(false);
                }
                return;

            // Zoom
            case Key.Add:
            case Key.OemPlus:
                Zoom(true);
                return;

            case Key.Subtract:
            case Key.OemMinus:
                Zoom(false);
                return;

            default: break;
            }

            #endregion Keys where it can be held down

            #region Key is not held down

            if (!e.IsRepeat)
            {
                switch (e.Key)
                {
                // Esc
                case Key.Escape:
                    if (UserControls_Open())
                    {
                        Close_UserControls();
                    }
                    else if (Properties.Settings.Default.Fullscreen)
                    {
                        if (GalleryFunctions.IsOpen)
                        {
                            GalleryToggle.Toggle();
                        }
                        else
                        {
                            Fullscreen_Restore();
                        }
                    }
                    else if (Slideshow.SlideTimer != null && Slideshow.SlideTimer.Enabled)
                    {
                        Slideshow.StopSlideshow();
                    }
                    else if (GalleryFunctions.IsOpen)
                    {
                        GalleryToggle.Toggle();
                    }
                    else if (IsDialogOpen)
                    {
                        IsDialogOpen = false;
                    }
                    else if (Color_Picking.IsRunning)
                    {
                        Color_Picking.StopRunning(false);
                    }
                    else if (GetResizeAndOptimize != null && GetResizeAndOptimize.IsVisible)
                    {
                        GetResizeAndOptimize.Hide();
                    }
                    else if (GetEffectsWindow != null && GetEffectsWindow.IsVisible)
                    {
                        GetEffectsWindow.Hide();
                    }
                    else if (GetImageInfoWindow != null && GetImageInfoWindow.IsVisible)
                    {
                        GetImageInfoWindow.Hide();
                    }
                    else if (GetInfoWindow != null && GetInfoWindow.IsVisible)
                    {
                        GetInfoWindow.Hide();
                    }
                    else if (GetSettingsWindow != null && GetSettingsWindow.IsVisible)
                    {
                        GetSettingsWindow.Hide();
                    }
                    else if (!cm.IsVisible)
                    {
                        SystemCommands.CloseWindow(GetMainWindow);
                    }
                    break;

                // Ctrl + Q
                case Key.Q:
                    if (ctrlDown)
                    {
                        SystemCommands.CloseWindow(GetMainWindow);
                    }
                    break;

                // O, Ctrl + O
                case Key.O:
                    Open();
                    break;

                // X, Ctrl + X
                case Key.X:
                    if (ctrlDown && !GalleryFunctions.IsOpen)
                    {
                        Cut(Pics[FolderIndex]);
                    }
                    else
                    {
                        ConfigureSettings.UpdateUIValues.SetScrolling(sender, e);
                    }
                    break;

                // F
                case Key.F:
                    if (!GalleryFunctions.IsOpen)
                    {
                        Flip();
                    }
                    break;

                // Delete, Shift + Delete
                case Key.Delete:
                    if (!GalleryFunctions.IsOpen)
                    {
                        DeleteFile(!shiftDown);
                    }
                    break;

                // Ctrl + C, Ctrl + Shift + C, Ctrl + Alt + C
                case Key.C:
                    if (ctrlDown && !GalleryFunctions.IsOpen)
                    {
                        if (GetResizeAndOptimize != null)
                        {
                            if (GetResizeAndOptimize.IsVisible)
                            {
                                return;     // Prevent paste errors
                            }
                        }

                        if (shiftDown)
                        {
                            Copyfile();
                        }
                        else if (altDown)
                        {
                            System.Threading.Tasks.Task task = Base64.SendToClipboard();
                        }
                        else
                        {
                            CopyBitmap();
                        }
                    }
                    else if (!GalleryFunctions.IsOpen)
                    {
                        CropFunctions.StartCrop();
                    }
                    break;

                // Ctrl + V
                case Key.V:
                    if (ctrlDown && !GalleryFunctions.IsOpen)
                    {
                        Paste();
                    }
                    break;

                // Ctrl + I
                case Key.I:
                    if (ctrlDown && !GalleryFunctions.IsOpen)
                    {
                        SystemIntegration.NativeMethods.ShowFileProperties(Pics[FolderIndex]);
                    }
                    break;

                // Ctrl + P
                case Key.P:
                    if (ctrlDown && !GalleryFunctions.IsOpen)
                    {
                        Print(Pics[FolderIndex]);
                    }
                    break;

                // Ctrl + R
                case Key.R:
                    if (ctrlDown && !GalleryFunctions.IsOpen)
                    {
                        Reload();
                    }
                    break;

                // L
                case Key.L:
                    ConfigureSettings.UpdateUIValues.SetLooping(sender, e);
                    break;

                // E
                case Key.E:
                    if (!GalleryFunctions.IsOpen)
                    {
                        OpenWith(Pics[FolderIndex]);
                    }
                    break;

                // T
                case Key.T:
                    if (!GalleryFunctions.IsOpen)
                    {
                        ConfigureSettings.ConfigColors.ChangeBackground(sender, e);
                    }
                    break;

                // G
                case Key.G:
                    if (Properties.Settings.Default.FullscreenGallery == false &&
                        !GetQuickSettingsMenu.IsVisible &&
                        !GetToolsAndEffectsMenu.IsVisible &&
                        !GetFileMenu.IsVisible &&
                        !GetImageSettingsMenu.IsVisible)
                    {
                        GalleryToggle.Toggle();
                    }
                    break;

                // Space
                case Key.Space:
                    if (GetPicGallery != null)
                    {
                        if (GalleryFunctions.IsOpen)
                        {
                            GalleryNavigation.ScrollTo();
                            return;
                        }
                    }
                    CenterWindowOnScreen();
                    break;

                // 1
                case Key.D1:
                    if (QuickSettingsMenuOpen || GalleryFunctions.IsOpen ||
                        Properties.Settings.Default.Fullscreen)
                    {
                        break;
                    }

                    Tooltip.ShowTooltipMessage(Application.Current.Resources["CenterImageInWindow"]);
                    ConfigureSettings.UpdateUIValues.SetScalingBehaviour(false, false);
                    break;

                // 2
                case Key.D2:
                    if (QuickSettingsMenuOpen || GalleryFunctions.IsOpen ||
                        Properties.Settings.Default.Fullscreen)
                    {
                        break;
                    }

                    Tooltip.ShowTooltipMessage(Application.Current.Resources["CenterImageInWindowFillHeight"]);
                    ConfigureSettings.UpdateUIValues.SetScalingBehaviour(false, true);
                    break;

                // 3
                case Key.D3:
                    if (QuickSettingsMenuOpen || GalleryFunctions.IsOpen ||
                        Properties.Settings.Default.Fullscreen)
                    {
                        break;
                    }

                    Tooltip.ShowTooltipMessage(Application.Current.Resources["CenterApplicationToWindow"]);
                    ConfigureSettings.UpdateUIValues.SetScalingBehaviour(true, false);
                    break;

                // 4
                case Key.D4:
                    if (QuickSettingsMenuOpen || GalleryFunctions.IsOpen ||
                        Properties.Settings.Default.Fullscreen)
                    {
                        break;
                    }

                    Tooltip.ShowTooltipMessage(Application.Current.Resources["CenterApplicationToWindowFillHeight"]);
                    ConfigureSettings.UpdateUIValues.SetScalingBehaviour(true, true);
                    break;

                // F1
                case Key.F1:
                    InfoWindow();
                    break;

                // F2
                case Key.F2:
                    EditTitleBar.EditTitleBar_Text();
                    break;

                // F3
                case Key.F3:
                    Open_In_Explorer();
                    break;

                // F4
                case Key.F4:
                    AllSettingsWindow();
                    break;

                // F5
                case Key.F5:
                    if (!GalleryFunctions.IsOpen)
                    {
                        Slideshow.StartSlideshow();
                    }
                    break;

                // F6
                case Key.F6:
                    EffectsWindow();
                    break;

                // F7
                case Key.F7:
                    ResetZoom();
                    break;

#if DEBUG
                // F8
                case Key.F8:
                    Unload();
                    break;
#endif
                // F11
                case Key.F11:
                    Fullscreen_Restore();
                    break;

                // Home
                case Key.Home:
                    GetMainWindow.Scroller.ScrollToHome();
                    break;

                // End
                case Key.End:
                    GetMainWindow.Scroller.ScrollToEnd();
                    break;

                default: break;
                }
            }

            #endregion Key is not held down

            #region Alt + keys

            // Alt doesn't work in switch? Waiting for key up is confusing in this case

            if (altDown && !e.IsRepeat)
            {
                // Alt + Z
                if ((e.SystemKey == Key.Z) && !GalleryFunctions.IsOpen)
                {
                    HideInterfaceLogic.ToggleInterface();
                }

                // Alt + Enter
                else if ((e.SystemKey == Key.Enter))
                {
                    if (Properties.Settings.Default.FullscreenGallery == false)
                    {
                        Fullscreen_Restore();
                    }
                }
            }

            #endregion Alt + keys
        }
Exemple #10
0
        internal static void EnableBlur(Window win)
        {
            // ウィンドウに半透明のアクリル効果を適用する
            var state = AcrylicWindow.GetAcrylicAccentState(win);

            SetBlur(win, state);

            if (!_internalStateTable.TryGetValue(win, out var _))
            {
                var windowHelper = new WindowInteropHelper(win);
                var source       = HwndSource.FromHwnd(windowHelper.Handle);
                source.AddHook(WndProc);

                // タイトルバーの各種ボタンで利用するコマンドの設定
                var closeBinding    = new CommandBinding(SystemCommands.CloseWindowCommand, (_, __) => { SystemCommands.CloseWindow(win); });
                var minimizeBinding = new CommandBinding(SystemCommands.MinimizeWindowCommand, (_, __) => { SystemCommands.MinimizeWindow(win); });
                var maximizeBinding = new CommandBinding(SystemCommands.MaximizeWindowCommand, (_, __) => { SystemCommands.MaximizeWindow(win); });
                var restoreBinding  = new CommandBinding(SystemCommands.RestoreWindowCommand, (_, __) => { SystemCommands.RestoreWindow(win); });
                win.CommandBindings.Add(closeBinding);
                win.CommandBindings.Add(minimizeBinding);
                win.CommandBindings.Add(maximizeBinding);
                win.CommandBindings.Add(restoreBinding);

                var internalState = new AcrylicWindowInternalState()
                {
                    RestoringState  = WindowRestoringState.Default,
                    CloseCommand    = closeBinding,
                    MinimizeCommand = minimizeBinding,
                    MaximizeCommand = maximizeBinding,
                    RestoreCommand  = restoreBinding,
                };
                _internalStateTable.Add(win, internalState);


                // フルスクリーン状態だったら、ウィンドウサイズの訂正をする
                if (win.WindowState == WindowState.Maximized)
                {
                    FixMaximizedWindowSize(windowHelper.Handle);
                }

                // WPFのSizeToContentのバグ対策
                // (WindowChrome使用時に、SizeToContentのウィンドウサイズ計算が正しく行われない)
                void onContentRendered(object sender, EventArgs e)
                {
                    if (win.SizeToContent != SizeToContent.Manual)
                    {
                        win.InvalidateMeasure();
                    }

                    win.ContentRendered -= onContentRendered;
                    InvalidateRect(windowHelper.Handle, IntPtr.Zero, true);
                }

                win.ContentRendered += onContentRendered;
                InvalidateRect(windowHelper.Handle, IntPtr.Zero, true);
            }
        }
Exemple #11
0
 protected virtual void OnCloseWindowExecuted(object sender, ExecutedRoutedEventArgs e)
 {
     SystemCommands.CloseWindow(this);
 }
Exemple #12
0
 private void MenuItem_Exit(object sender, RoutedEventArgs e)
 {
     SystemCommands.CloseWindow(this);
 }
Exemple #13
0
 private void OnOk()
 {
     dlg.Result = true;
     SystemCommands.CloseWindow(dlg);
 }
Exemple #14
0
        private void OnCloseWindowCommand(object sender, ExecutedRoutedEventArgs e)
        {
            var w = Window.GetWindow(this);

            SystemCommands.CloseWindow(w);
        }
Exemple #15
0
        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;
        }
Exemple #16
0
 private void CloseWindow(object sender, RoutedEventArgs e)
 {
     SystemCommands.CloseWindow(Window.GetWindow((Button)sender));
 }
 private void Yes_Click(object sender, RoutedEventArgs e)
 {
     DialogResult = true;
     SystemCommands.CloseWindow(this);
 }
Exemple #18
0
        /// <summary>
        /// Start adding events
        /// </summary>
        internal static void Go()
        {
            // keyboard and Mouse_Keys Keys
            ConfigureWindows.GetMainWindow.KeyDown   += MainWindow_KeysDown;
            ConfigureWindows.GetMainWindow.KeyUp     += MainWindow_KeysUp;
            ConfigureWindows.GetMainWindow.MouseDown += MainWindow_MouseDown;

            // MinButton
            ConfigureWindows.GetMainWindow.MinButton.TheButton.Click += (_, _) => SystemCommands.MinimizeWindow(ConfigureWindows.GetMainWindow);

            // CloseButton
            ConfigureWindows.GetMainWindow.CloseButton.TheButton.Click += (_, _) => SystemCommands.CloseWindow(ConfigureWindows.GetMainWindow);

            // FileMenuButton
            ConfigureWindows.GetMainWindow.FileMenuButton.PreviewMouseLeftButtonDown += (_, _) => PreviewMouseButtonDownAnim(ConfigureWindows.GetMainWindow.FolderFill);
            ConfigureWindows.GetMainWindow.FileMenuButton.MouseEnter += (_, _) => ButtonMouseOverAnim(ConfigureWindows.GetMainWindow.FolderFill);
            ConfigureWindows.GetMainWindow.FileMenuButton.MouseEnter += (_, _) => AnimationHelper.MouseEnterBgTexColor(ConfigureWindows.GetMainWindow.FileMenuBg);
            ConfigureWindows.GetMainWindow.FileMenuButton.MouseLeave += (_, _) => ButtonMouseLeaveAnim(ConfigureWindows.GetMainWindow.FolderFill);
            ConfigureWindows.GetMainWindow.FileMenuButton.MouseLeave += (_, _) => AnimationHelper.MouseLeaveBgTexColor(ConfigureWindows.GetMainWindow.FileMenuBg);
            ConfigureWindows.GetMainWindow.FileMenuButton.Click      += Toggle_open_menu;

            GetFileMenu.Open.Click         += (_, _) => Open();
            GetFileMenu.FileLocation.Click += (_, _) => Open_In_Explorer();
            GetFileMenu.Print.Click        += (_, _) => Print(Pics[FolderIndex]);
            GetFileMenu.SaveButton.Click   += (_, _) => SaveFiles();

            GetFileMenu.OpenBorder.MouseLeftButtonUp         += (_, _) => Open();
            GetFileMenu.FileLocationBorder.MouseLeftButtonUp += (_, _) => Open_In_Explorer();
            GetFileMenu.PrintBorder.MouseLeftButtonUp        += (_, _) => Print(Pics[FolderIndex]);
            GetFileMenu.SaveBorder.MouseLeftButtonUp         += (_, _) => SaveFiles();

            // image_button
            ConfigureWindows.GetMainWindow.image_button.PreviewMouseLeftButtonDown += (_, _) => PreviewMouseButtonDownAnim(ConfigureWindows.GetMainWindow.ImagePath1Fill, ConfigureWindows.GetMainWindow.ImagePath2Fill, ConfigureWindows.GetMainWindow.ImagePath3Fill);
            ConfigureWindows.GetMainWindow.image_button.MouseEnter += (_, _) => ButtonMouseOverAnim(ConfigureWindows.GetMainWindow.ImagePath1Fill, ConfigureWindows.GetMainWindow.ImagePath2Fill, ConfigureWindows.GetMainWindow.ImagePath3Fill);
            ConfigureWindows.GetMainWindow.image_button.MouseEnter += (_, _) => AnimationHelper.MouseEnterBgTexColor(ConfigureWindows.GetMainWindow.ImageMenuBg);
            ConfigureWindows.GetMainWindow.image_button.MouseLeave += (_, _) => ButtonMouseLeaveAnim(ConfigureWindows.GetMainWindow.ImagePath1Fill, ConfigureWindows.GetMainWindow.ImagePath2Fill, ConfigureWindows.GetMainWindow.ImagePath3Fill);
            ConfigureWindows.GetMainWindow.image_button.MouseLeave += (_, _) => AnimationHelper.MouseLeaveBgTexColor(ConfigureWindows.GetMainWindow.ImageMenuBg);
            ConfigureWindows.GetMainWindow.image_button.Click      += Toggle_image_menu;

            // imageSettingsMenu Buttons

            GetImageSettingsMenu.Contained_Gallery.Click += delegate
            {
                Close_UserControls();
                GalleryToggle.OpenHorizontalGallery();
            };
            GetImageSettingsMenu.Fullscreen_Gallery.Click += delegate
            {
                Close_UserControls();
                GalleryToggle.OpenFullscreenGallery();
            };

            // SettingsButton
            ConfigureWindows.GetMainWindow.SettingsButton.PreviewMouseLeftButtonDown += (_, _) => PreviewMouseButtonDownAnim(ConfigureWindows.GetMainWindow.SettingsButtonFill);
            ConfigureWindows.GetMainWindow.SettingsButton.MouseEnter += (_, _) => ButtonMouseOverAnim(ConfigureWindows.GetMainWindow.SettingsButtonFill);
            ConfigureWindows.GetMainWindow.SettingsButton.MouseEnter += (_, _) => AnimationHelper.MouseEnterBgTexColor(ConfigureWindows.GetMainWindow.SettingsMenuBg);
            ConfigureWindows.GetMainWindow.SettingsButton.MouseLeave += (_, _) => ButtonMouseLeaveAnim(ConfigureWindows.GetMainWindow.SettingsButtonFill);
            ConfigureWindows.GetMainWindow.SettingsButton.MouseLeave += (_, _) => AnimationHelper.MouseLeaveBgTexColor(ConfigureWindows.GetMainWindow.SettingsMenuBg);
            ConfigureWindows.GetMainWindow.SettingsButton.Click      += Toggle_quick_settings_menu;

            //FunctionButton
            var MagicBrush = ConfigureWindows.GetMainWindow.TryFindResource("MagicBrush") as SolidColorBrush;

            ConfigureWindows.GetMainWindow.FunctionMenuButton.PreviewMouseLeftButtonDown += (_, _) => PreviewMouseButtonDownAnim(MagicBrush);
            ConfigureWindows.GetMainWindow.FunctionMenuButton.MouseEnter += (_, _) => ButtonMouseOverAnim(MagicBrush);
            ConfigureWindows.GetMainWindow.FunctionMenuButton.MouseEnter += (_, _) => AnimationHelper.MouseEnterBgTexColor(ConfigureWindows.GetMainWindow.EffectsMenuBg);
            ConfigureWindows.GetMainWindow.FunctionMenuButton.MouseLeave += (_, _) => ButtonMouseLeaveAnim(MagicBrush);
            ConfigureWindows.GetMainWindow.FunctionMenuButton.MouseLeave += (_, _) => AnimationHelper.MouseLeaveBgTexColor(ConfigureWindows.GetMainWindow.EffectsMenuBg);
            ConfigureWindows.GetMainWindow.FunctionMenuButton.Click      += Toggle_Functions_menu;

            // ClickArrows
            GetClickArrowLeft.MouseLeftButtonDown += (_, _) => PicButton(true, false);

            GetClickArrowRight.MouseLeftButtonDown += (_, _) => PicButton(true, true);

            // x2
            Getx2.MouseLeftButtonDown += (_, _) => SystemCommands.CloseWindow(ConfigureWindows.GetMainWindow);

            // Minus
            GetMinus.MouseLeftButtonDown += (_, _) => SystemCommands.MinimizeWindow(ConfigureWindows.GetMainWindow);

            // GalleryShortcut
            GetGalleryShortcut.MouseLeftButtonDown += (_, _) => GalleryToggle.OpenHorizontalGallery();

            // TitleText
            ConfigureWindows.GetMainWindow.TitleText.GotKeyboardFocus            += EditTitleBar.EditTitleBar_Text;
            ConfigureWindows.GetMainWindow.TitleText.InnerTextBox.PreviewKeyDown += CustomTextBoxShortcuts.CustomTextBox_KeyDown;
            ConfigureWindows.GetMainWindow.TitleText.PreviewMouseLeftButtonDown  += EditTitleBar.Bar_PreviewMouseLeftButtonDown;
            ConfigureWindows.GetMainWindow.TitleText.PreviewMouseRightButtonDown += EditTitleBar.Bar_PreviewMouseRightButtonDown;

            // MainImage
            ConfigureWindows.GetMainWindow.MainImage.PreviewMouseLeftButtonDown += DragAndDrop.DragToExplorer.DragFile;
            ConfigureWindows.GetMainWindow.MainImage.MouseLeftButtonDown        += MainImage_MouseLeftButtonDown;
            ConfigureWindows.GetMainWindow.MainImage.MouseLeftButtonUp          += MainImage_MouseLeftButtonUp;
            ConfigureWindows.GetMainWindow.MainImage.MouseMove += MainImage_MouseMove;

            // ParentContainer
            ConfigureWindows.GetMainWindow.ParentContainer.MouseLeftButtonDown += Bg_MouseLeftButtonDown;
            ConfigureWindows.GetMainWindow.ParentContainer.Drop              += Image_Drop;
            ConfigureWindows.GetMainWindow.ParentContainer.DragEnter         += Image_DragEnter;
            ConfigureWindows.GetMainWindow.ParentContainer.DragLeave         += Image_DragLeave;
            ConfigureWindows.GetMainWindow.ParentContainer.MouseMove         += Interface_MouseMove;
            ConfigureWindows.GetMainWindow.ParentContainer.MouseLeave        += Interface_MouseLeave;
            ConfigureWindows.GetMainWindow.ParentContainer.PreviewMouseWheel += MainImage_MouseWheel;

            // TooltipStyle
            GetToolTipMessage.MouseWheel += MainImage_MouseWheel;

            // TitleBar
            ConfigureWindows.GetMainWindow.TitleBar.MouseLeftButtonDown += ConfigureWindows.Move;
            ConfigureWindows.GetMainWindow.TitleBar.MouseLeave          += ConfigureWindows.Restore_From_Move;

            // Lower Bar
            ConfigureWindows.GetMainWindow.LowerBar.Drop += Image_Drop;
            ConfigureWindows.GetMainWindow.LowerBar.MouseLeftButtonDown += ConfigureWindows.MoveAlt;

            // This
            ConfigureWindows.GetMainWindow.Closing      += ConfigureWindows.Window_Closing;
            ConfigureWindows.GetMainWindow.StateChanged += ConfigureWindows.MainWindow_StateChanged;

            //LocationChanged += MainWindow_LocationChanged;
            Microsoft.Win32.SystemEvents.DisplaySettingsChanged += ConfigureWindows.SystemEvents_DisplaySettingsChanged;

#if DEBUG
            Trace.WriteLine("Events loaded");
#endif
        }
Exemple #19
0
        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 BtnDialogCancel_Click(object sender, RoutedEventArgs e)
 {
     m_response = false;
     SystemCommands.CloseWindow(this);
 }
 private void CloseCommand_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     SystemCommands.CloseWindow(this);
 }
 private void Button_Click_Exit(object sender, RoutedEventArgs e)
 {
     SystemCommands.CloseWindow(this);
 }
 private void Accept_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     Value        = TextBox.Text;
     DialogResult = true;
     SystemCommands.CloseWindow(this);
 }
Exemple #24
0
 static void OnCloseWindow(object sender, ExecutedRoutedEventArgs e)
 {
     SystemCommands.CloseWindow(sender as Window);
 }
 /// <summary>
 /// Closes the application on click, mimics the X button on a normal window
 /// </summary>
 public static void CloseWindow(Window window)
 {
     SystemCommands.CloseWindow(window);
 }
Exemple #26
0
 public void CancelButton_Click(object sender, RoutedEventArgs e)
 {
     SystemCommands.CloseWindow(this);
 }
Exemple #27
0
 protected virtual void Close()
 {
     SystemCommands.CloseWindow(_mainWindow);
 }
Exemple #28
0
 private void ExecuteCloseWindow(object obj)
 {
     SystemCommands.CloseWindow(obj as Window);
 }
Exemple #29
0
        internal static void AddContextMenus()
        {
            // Add main contextmenu
            cm = new ContextMenu();
            var scbf = (SolidColorBrush)Application.Current.Resources["MainColorFadedBrush"];

            ///////////////////////////
            ///////////////////////////
            ///     Open           \\\\
            ///////////////////////////
            ///////////////////////////
            var opencm = new MenuItem
            {
                Header           = Application.Current.Resources["Open"] as string,
                InputGestureText = $"{Application.Current.Resources["Ctrl"] as string} + O"
            };
            var opencmIcon = new System.Windows.Shapes.Path
            {
                Data    = Geometry.Parse(SVGiconFile),
                Stretch = Stretch.Fill
            };

            opencmIcon.Width = opencmIcon.Height = 12;
            opencmIcon.Fill  = scbf;
            opencm.Icon      = opencmIcon;
            opencm.Click    += (s, x) => Open();
            cm.Items.Add(opencm);

            ///////////////////////////
            ///////////////////////////
            ///     Save           \\\\
            ///////////////////////////
            ///////////////////////////
            var savecm = new MenuItem()
            {
                Header           = Application.Current.Resources["Save"] as string,
                InputGestureText = $"{Application.Current.Resources["Ctrl"] as string} + S"
            };
            var savecmIcon = new System.Windows.Shapes.Path
            {
                Data    = Geometry.Parse(SVGiconSave),
                Stretch = Stretch.Fill
            };

            savecmIcon.Width = savecmIcon.Height = 12;
            savecmIcon.Fill  = scbf;
            savecm.Icon      = savecmIcon;
            savecm.Click    += (s, x) => SaveFiles();
            cm.Items.Add(savecm);

            ///////////////////////////
            ///////////////////////////
            ///     Print          \\\\
            ///////////////////////////
            ///////////////////////////
            var printcm = new MenuItem
            {
                Header           = Application.Current.Resources["Print"] as string,
                InputGestureText = $"{Application.Current.Resources["Ctrl"] as string} + P"
            };
            var printcmIcon = new System.Windows.Shapes.Path
            {
                Data    = Geometry.Parse(SVGiconPrint),
                Stretch = Stretch.Fill
            };

            printcmIcon.Width = printcmIcon.Height = 12;
            printcmIcon.Fill  = scbf;
            printcm.Icon      = printcmIcon;
            printcm.Click    += (s, x) => Print(Pics[FolderIndex]);
            cm.Items.Add(printcm);

            ///////////////////////////
            ///////////////////////////
            ///     Open With      \\\\
            ///////////////////////////
            ///////////////////////////
            var openwcm = new MenuItem
            {
                Header           = Application.Current.Resources["OpenWith"] as string,
                InputGestureText = "E"
            };
            var openwIcon = new System.Windows.Shapes.Path
            {
                Data    = Geometry.Parse(SVGiconSend),
                Stretch = Stretch.Fill
            };

            openwIcon.Width = openwIcon.Height = 12;
            openwIcon.Fill  = scbf;
            openwcm.Icon    = openwIcon;
            openwcm.Click  += (s, x) => OpenWith(Pics[FolderIndex]);
            cm.Items.Add(openwcm);

            ///////////////////////////
            ///////////////////////////
            ///     Recent Files   \\\\
            ///////////////////////////
            ///////////////////////////
            cm.Items.Add(new Separator());
            var recentcm = new MenuItem
            {
                Header = Application.Current.Resources["RecentFiles"] as string,
            };
            var recentcmIcon = new System.Windows.Shapes.Path
            {
                Data    = Geometry.Parse(SVGiconPaper),
                Stretch = Stretch.Fill
            };

            recentcmIcon.Width = recentcmIcon.Height = 12;
            recentcmIcon.Fill  = scbf;
            recentcm.Icon      = recentcmIcon;
            cm.Items.Add(recentcm);

            ///////////////////////////
            ///////////////////////////
            ///     Sort Files     \\\\
            ///////////////////////////
            ///////////////////////////
            var sortcm = new MenuItem
            {
                Header = Application.Current.Resources["SortFilesBy"] as string,
            };
            var sortcmIcon = new System.Windows.Shapes.Path
            {
                Data    = Geometry.Parse(SVGiconSort),
                Stretch = Stretch.Fill
            };

            sortcmIcon.Width = sortcmIcon.Height = 12;
            sortcmIcon.Fill  = scbf;
            sortcm.Icon      = sortcmIcon;

            ///////////////////////////
            ///   File Name        \\\\
            ///////////////////////////
            var sortcmChild0       = new MenuItem();
            var sortcmChild0Header = new RadioButton
            {
                Content         = Application.Current.Resources["FileName"] as string,
                BorderThickness = new Thickness(0, 0, 0, 0),
                MinWidth        = 125,
                IsChecked       = Properties.Settings.Default.SortPreference == 0
            };

            sortcmChild0Header.Click += delegate { ConfigureSettings.UpdateUIValues.ChangeSorting(0); cm.IsOpen = false; };
            sortcmChild0.Click       += delegate { ConfigureSettings.UpdateUIValues.ChangeSorting(0); cm.IsOpen = false; };
            sortcmChild0.Header       = sortcmChild0Header;
            sortcm.Items.Add(sortcmChild0);

            ///////////////////////////
            ///   File Size        \\\\
            ///////////////////////////
            var sortcmChild1       = new MenuItem();
            var sortcmChild1Header = new RadioButton
            {
                Content         = Application.Current.Resources["FileSize"] as string,
                BorderThickness = new Thickness(0, 0, 0, 0),
                MinWidth        = 125,
                IsChecked       = Properties.Settings.Default.SortPreference == 1
            };

            sortcmChild1Header.Click += delegate { ConfigureSettings.UpdateUIValues.ChangeSorting(1); cm.IsOpen = false; };
            sortcmChild1.Click       += delegate { ConfigureSettings.UpdateUIValues.ChangeSorting(1); cm.IsOpen = false; };
            sortcmChild1.Header       = sortcmChild1Header;
            sortcm.Items.Add(sortcmChild1);

            ///////////////////////////
            ///   Creation Time     \\\\
            ///////////////////////////
            var sortcmChild2       = new MenuItem();
            var sortcmChild2Header = new RadioButton
            {
                Content         = Application.Current.Resources["CreationTime"] as string,
                BorderThickness = new Thickness(0, 0, 0, 0),
                MinWidth        = 125,
                IsChecked       = Properties.Settings.Default.SortPreference == 2
            };

            sortcmChild2Header.Click += delegate { ConfigureSettings.UpdateUIValues.ChangeSorting(2); cm.IsOpen = false; };
            sortcmChild2.Click       += delegate { ConfigureSettings.UpdateUIValues.ChangeSorting(2); cm.IsOpen = false; };
            sortcmChild2.Header       = sortcmChild2Header;
            sortcm.Items.Add(sortcmChild2);

            ///////////////////////////
            ///   File extension   \\\\
            ///////////////////////////
            var sortcmChild3       = new MenuItem();
            var sortcmChild3Header = new RadioButton
            {
                Content         = Application.Current.Resources["FileExtension"] as string,
                BorderThickness = new Thickness(0, 0, 0, 0),
                MinWidth        = 125,
                IsChecked       = Properties.Settings.Default.SortPreference == 3
            };

            sortcmChild3Header.Click += delegate { ConfigureSettings.UpdateUIValues.ChangeSorting(3); cm.IsOpen = false; };
            sortcmChild3.Click       += delegate { ConfigureSettings.UpdateUIValues.ChangeSorting(3); cm.IsOpen = false; };
            sortcmChild3.Header       = sortcmChild3Header;
            sortcm.Items.Add(sortcmChild3);

            ///////////////////////////
            ///   Last Access Time \\\\
            ///////////////////////////
            var sortcmChild4       = new MenuItem();
            var sortcmChild4Header = new RadioButton
            {
                Content         = Application.Current.Resources["LastAccessTime"] as string,
                BorderThickness = new Thickness(0, 0, 0, 0),
                MinWidth        = 125,
                IsChecked       = Properties.Settings.Default.SortPreference == 4
            };

            sortcmChild4Header.Click += delegate { ConfigureSettings.UpdateUIValues.ChangeSorting(4); cm.IsOpen = false; };
            sortcmChild4.Click       += delegate { ConfigureSettings.UpdateUIValues.ChangeSorting(4); cm.IsOpen = false; };
            sortcmChild4.Header       = sortcmChild4Header;
            sortcm.Items.Add(sortcmChild4);

            ///////////////////////////
            ///   Last Write Time  \\\\
            ///////////////////////////
            var sortcmChild5       = new MenuItem();
            var sortcmChild5Header = new RadioButton
            {
                Content         = Application.Current.Resources["LastWriteTime"] as string,
                BorderThickness = new Thickness(0, 0, 0, 0),
                MinWidth        = 125,
                IsChecked       = Properties.Settings.Default.SortPreference == 5
            };

            sortcmChild5Header.Click += delegate { ConfigureSettings.UpdateUIValues.ChangeSorting(5); cm.IsOpen = false; };
            sortcmChild5.Click       += delegate { ConfigureSettings.UpdateUIValues.ChangeSorting(5); cm.IsOpen = false; };
            sortcmChild5.Header       = sortcmChild5Header;
            sortcm.Items.Add(sortcmChild5);

            ///////////////////////////
            ///   Random        \\\\
            ///////////////////////////
            var sortcmChild6       = new MenuItem();
            var sortcmChild6Header = new RadioButton
            {
                Content         = Application.Current.Resources["Random"] as string,
                BorderThickness = new Thickness(0, 0, 0, 0),
                MinWidth        = 125,
                IsChecked       = Properties.Settings.Default.SortPreference == 6
            };

            sortcmChild6Header.Click += delegate { ConfigureSettings.UpdateUIValues.ChangeSorting(6); cm.IsOpen = false; };
            sortcmChild6.Click       += delegate { ConfigureSettings.UpdateUIValues.ChangeSorting(6); cm.IsOpen = false; };
            sortcmChild6.Header       = sortcmChild6Header;
            sortcm.Items.Add(sortcmChild6);
            cm.Items.Add(sortcm);

            ///////////////////////////
            ///////////////////////////
            ///     Settings       \\\\
            ///////////////////////////
            ///////////////////////////
            var settingscm = new MenuItem
            {
                Header = Application.Current.Resources["Settings"] as string,
            };
            var settingscmIcon = new System.Windows.Shapes.Path
            {
                Data    = Geometry.Parse(SVGiconWrench),
                Stretch = Stretch.Fill
            };

            settingscmIcon.Width = settingscmIcon.Height = 12;
            settingscmIcon.Fill  = scbf;
            settingscm.Icon      = settingscmIcon;
            cm.Items.Add(settingscm);

            ///////////////////////////
            ///   Looping          \\\\
            ///////////////////////////
            var settingscmLoop = new MenuItem
            {
                InputGestureText = "L"
            };
            var settingscmLoopHeader = new CheckBox
            {
                IsChecked           = Properties.Settings.Default.Looping,
                Content             = Application.Current.Resources["Looping"] as string,
                FontSize            = 13,
                MinWidth            = 125,
                HorizontalAlignment = HorizontalAlignment.Left,
                Width  = double.NaN,
                Height = double.NaN
            };

            settingscmLoop.Header       = settingscmLoopHeader;
            settingscmLoop.Click       += (s, x) => { ConfigureSettings.UpdateUIValues.SetLooping(s, x); };
            settingscmLoopHeader.Click += (s, x) => { ConfigureSettings.UpdateUIValues.SetLooping(s, x); };
            settingscm.Items.Add(settingscmLoop);

            ///////////////////////////
            ///   Scroll         \\\\
            ///////////////////////////
            var settingscmScroll = new MenuItem
            {
                InputGestureText = "X"
            };
            var settingscmScrollHeader = new CheckBox
            {
                IsChecked           = Properties.Settings.Default.ScrollEnabled,
                Content             = Application.Current.Resources["Scrolling"] as string,
                FontSize            = 13,
                MinWidth            = 125,
                HorizontalAlignment = HorizontalAlignment.Left,
                Width  = double.NaN,
                Height = double.NaN
            };

            settingscmScrollHeader.Click += ConfigureSettings.UpdateUIValues.SetScrolling;
            settingscmScroll.Header       = settingscmScrollHeader;
            settingscmScroll.Click       += (s, x) => { ConfigureSettings.UpdateUIValues.SetScrolling(s, x); settingscmScrollHeader.IsChecked = (bool)settingscmScrollHeader.IsChecked ? false : true; };
            settingscm.Items.Add(settingscmScroll);

            ///////////////////////////
            ///   Alt interface    \\\\
            ///////////////////////////
            var altcm = new MenuItem
            {
                InputGestureText = "Alt + Z"
            };
            var altcmHeader = new CheckBox
            {
                Content             = Application.Current.Resources["ShowHideUI"] as string,
                IsChecked           = Properties.Settings.Default.ShowInterface,
                FontSize            = 13,
                MinWidth            = 125,
                HorizontalAlignment = HorizontalAlignment.Left,
                Width  = double.NaN,
                Height = double.NaN
            };

            altcmHeader.Click += delegate
            {
                if (GalleryFunctions.IsOpen)
                {
                    altcmHeader.IsChecked = Properties.Settings.Default.ShowInterface;
                    return;
                }
                HideInterfaceLogic.ToggleInterface();
            };
            altcm.Header = altcmHeader;
            altcm.Click += delegate { HideInterfaceLogic.ToggleInterface(); };
            settingscm.Items.Add(altcm);

            ///////////////////////////
            ///   Transparent bg   \\\\
            ///////////////////////////
            var transcm = new MenuItem
            {
                InputGestureText = "T"
            };
            var transcmHeader = new Button
            {
                Content             = Application.Current.Resources["ChangeBg"] as string,
                ToolTip             = Application.Current.Resources["ChangeBgTooltip"] as string,
                FontSize            = 13,
                Width               = double.NaN,
                Height              = double.NaN,
                HorizontalAlignment = HorizontalAlignment.Left
            };

            transcmHeader.Click += ConfigureSettings.ConfigColors.ChangeBackground;
            transcm.Header       = transcmHeader;
            transcm.Click       += ConfigureSettings.ConfigColors.ChangeBackground;
            settingscm.Items.Add(transcm);

            cm.Items.Add(new Separator());

            ///////////////////////////
            ///////////////////////////
            ///  Set as            \\\\
            ///////////////////////////
            ///////////////////////////

            var setAsCm = new MenuItem
            {
                Header = Application.Current.Resources["SetAs"] as string,
            };

            var setAsCmIcon = new System.Windows.Shapes.Path
            {
                Data    = Geometry.Parse(SVGiconCamera),
                Stretch = Stretch.Fill
            };

            setAsCmIcon.Width = setAsCmIcon.Height = 12;
            setAsCmIcon.Fill  = scbf;
            setAsCm.Icon      = setAsCmIcon;

            var wallcm = new MenuItem
            {
                Header = Application.Current.Resources["SetAsWallpaper"] as string,
            };

            wallcm.Click += (s, x) => SetWallpaper(WallpaperStyle.Fill);
            var wallcmIcon = new System.Windows.Shapes.Path
            {
                Data    = Geometry.Parse(SVGiconCamera),
                Stretch = Stretch.Fill
            };

            wallcmIcon.Width = wallcmIcon.Height = 12;
            wallcmIcon.Fill  = scbf;
            wallcm.Icon      = wallcmIcon;
            setAsCm.Items.Add(wallcm);

            var lockCm = new MenuItem
            {
                Header = Application.Current.Resources["SetAsLockScreenImage"] as string,
            };

            lockCm.Click += async delegate { await Lockscreen.ChangeLockScreenBackground(Pics[FolderIndex]).ConfigureAwait(false); };
            var lockCmIcon = new System.Windows.Shapes.Path
            {
                Data    = Geometry.Parse(SVGiconCamera),
                Stretch = Stretch.Fill
            };

            lockCmIcon.Width = lockCmIcon.Height = 12;
            lockCmIcon.Fill  = scbf;
            lockCm.Icon      = lockCmIcon;
            setAsCm.Items.Add(lockCm);

            cm.Items.Add(setAsCm);

            ///////////////////////////
            ///////////////////////////
            ///   Locate on disk   \\\\
            ///////////////////////////
            ///////////////////////////
            var lcdcm = new MenuItem
            {
                Header           = Application.Current.Resources["ShowInFolder"] as string,
                InputGestureText = "F3"
            };
            var lcdcmIcon = new System.Windows.Shapes.Path
            {
                Data    = Geometry.Parse(SVGiconSearch),
                Stretch = Stretch.Fill
            };

            lcdcmIcon.Width = lcdcmIcon.Height = 12;
            lcdcmIcon.Fill  = scbf;
            lcdcm.Icon      = lcdcmIcon;
            lcdcm.Click    += (s, x) => Open_In_Explorer();
            cm.Items.Add(lcdcm);

            ///////////////////////////
            ///////////////////////////
            ///   Image Info       \\\\
            ///////////////////////////
            ///////////////////////////
            var fildecm = new MenuItem
            {
                Header = Application.Current.Resources["ImageInfo"] as string,
            };
            var fildecmIcon = new System.Windows.Shapes.Path
            {
                Data    = Geometry.Parse(SVGiconPaperDetails),
                Stretch = Stretch.Fill
            };

            fildecmIcon.Width = fildecmIcon.Height = 12;
            fildecmIcon.Fill  = scbf;
            fildecm.Icon      = fildecmIcon;
            fildecm.Click    += (_, _) => ImageInfoWindow();
            cm.Items.Add(fildecm);
            cm.Items.Add(new Separator());

            ///////////////////////////
            ///////////////////////////
            ///   Copy             \\\\
            ///////////////////////////
            ///////////////////////////
            var cpm = new MenuItem
            {
                Header = Application.Current.Resources["Copy"] as string,
            };

            var cpmIcon = new System.Windows.Shapes.Path
            {
                Data    = Geometry.Parse(SVGiconCopy),
                Stretch = Stretch.Fill
            };

            cpmIcon.Width = cpmIcon.Height = 12;
            cpmIcon.Fill  = scbf;
            cpm.Icon      = cpmIcon;

            ///////////////////////////
            ///   Copy file        \\\\
            ///////////////////////////
            var cppcm = new MenuItem
            {
                Header  = Application.Current.Resources["CopyFile"] as string,
                ToolTip = Application.Current.Resources["CopyFile"] as string
                          + $" [{Application.Current.Resources["Ctrl"] as string} + " +
                          $"{Application.Current.Resources["Shift"] as string}  + C]",
            };

            cppcm.Click += (s, x) => Copyfile();
            cpm.Items.Add(cppcm);

            ///////////////////////////
            ///   Copy base64      \\\\
            ///////////////////////////
            var cpxcm = new MenuItem
            {
                Header  = Application.Current.Resources["Copy"] as string + " base64",
                ToolTip = Application.Current.Resources["Copy"] as string + " base64"
                          + $" [{Application.Current.Resources["Ctrl"] as string} + " +
                          $"{Application.Current.Resources["Alt"] as string}  + C]",
            };

            cpxcm.Click += async delegate { await Base64.SendToClipboard().ConfigureAwait(false); };
            cpm.Items.Add(cpxcm);

            ///////////////////////////
            ///   Copy bitmap      \\\\
            ///////////////////////////
            var cpxbm = new MenuItem
            {
                Header  = Application.Current.Resources["CopyImage"] as string,
                ToolTip = Application.Current.Resources["CopyImageTooltip"] as string
                          + $" [{Application.Current.Resources["Ctrl"] as string}  + C]",
            };

            cpxbm.Click += (s, x) => CopyBitmap();
            cpm.Items.Add(cpxbm);

            ///////////////////////////
            ///   Copy file path   \\\\
            ///////////////////////////
            var cppfm = new MenuItem
            {
                Header = Application.Current.Resources["FileCopyPath"] as string,
            };

            cppfm.Click += (s, x) => CopyText();
            cpm.Items.Add(cppfm);

            cm.Items.Add(cpm);

            ///////////////////////////
            ///////////////////////////
            ///   Cut File         \\\\
            ///////////////////////////
            ///////////////////////////
            var cpccm = new MenuItem
            {
                Header           = Application.Current.Resources["FileCut"] as string,
                InputGestureText = $"{Application.Current.Resources["Ctrl"] as string} + X"
            };
            var cpccmIcon = new System.Windows.Shapes.Path
            {
                Data    = Geometry.Parse(SVGiconScissor),
                Stretch = Stretch.Fill
            };

            cpccmIcon.Width = cpccmIcon.Height = 12;
            cpccmIcon.Fill  = scbf;
            cpccm.Icon      = cpccmIcon;
            cpccm.Click    += (s, x) => Cut(Pics[FolderIndex]);
            cm.Items.Add(cpccm);

            ///////////////////////////
            ///////////////////////////
            ///   Paste File       \\\\
            ///////////////////////////
            ///////////////////////////
            var pastecm = new MenuItem
            {
                Header           = Application.Current.Resources["FilePaste"] as string,
                InputGestureText = $"{Application.Current.Resources["Ctrl"] as string} + V"
            };
            var pastecmIcon = new System.Windows.Shapes.Path
            {
                Data    = Geometry.Parse(SVGiconPaste),
                Stretch = Stretch.Fill,
                Width   = 12,
                Height  = 12,
                Fill    = scbf
            };

            pastecm.Icon   = pastecmIcon;
            pastecm.Click += (s, x) => Paste();
            cm.Items.Add(pastecm);

            ///////////////////////////
            ///////////////////////////
            ///   Delete File      \\\\
            ///////////////////////////
            ///////////////////////////
            var MovetoRecycleBin = new MenuItem
            {
                Header           = Application.Current.Resources["DeleteFile"] as string,
                InputGestureText = Application.Current.Resources["Delete"] as string,
            };
            var MovetoRecycleBinIcon = new System.Windows.Shapes.Path
            {
                Data    = Geometry.Parse(SVGiconRecycle),
                Stretch = Stretch.Fill,
                Width   = 12,
                Height  = 12,
                Fill    = scbf
            };

            MovetoRecycleBin.Icon   = MovetoRecycleBinIcon;
            MovetoRecycleBin.Click += delegate { DeleteFile(true); };
            cm.Items.Add(MovetoRecycleBin);

            ///////////////////////////
            ///////////////////////////
            ///   Close            \\\\
            ///////////////////////////
            ///////////////////////////
            cm.Items.Add(new Separator());
            var clcm = new MenuItem
            {
                Header           = Application.Current.Resources["Close"] as string,
                InputGestureText = Application.Current.Resources["Esc"] as string,
                StaysOpenOnClick = false
            };
            var mclcmIcon = new System.Windows.Shapes.Path
            {
                Data    = Geometry.Parse(SVGiconClose),
                Stretch = Stretch.Fill,
                Width   = 12,
                Height  = 12,
                Fill    = scbf
            };

            clcm.Icon   = mclcmIcon;
            clcm.Click += (s, x) => { cm.Visibility = Visibility.Collapsed; SystemCommands.CloseWindow(ConfigureWindows.GetMainWindow); };
            cm.Items.Add(clcm);

            // Add to elements
            ConfigureWindows.GetMainWindow.MainImage.ContextMenu = ConfigureWindows.GetMainWindow.ParentContainer.ContextMenu = cm;
            cm.Opened += (tt, yy) => Recentcm_Opened(recentcm);

#if DEBUG
            Trace.WriteLine("Contextmenu loaded");
#endif
        }