internal MainWindowTransparent()
        {
            // this object should be initialized before loading UI components, because many of which are binding to it.
            ContextObject = new ContextObject();

            InitializeComponent();

            SourceInitialized += (sender, e) =>
            {
                if (AllowsTransparency)
                {
                    BlurWindow.EnableWindowBlur(this);
                }
            };

            buttonCloseWindow.MouseLeftButtonUp += (sender, e) =>
                                                   ViewWindowManager.GetInstance().ClosePreview();

            buttonOpenWith.Click += (sender, e) =>
                                    ViewWindowManager.GetInstance().RunAndClosePreview();
        }
        internal MainWindowTransparent()
        {
            // this object should be initialized before loading UI components, because many of which are binding to it.
            ContextObject = new ContextObject();

            InitializeComponent();

            FontFamily = new FontFamily(TranslationHelper.GetString("UI_FontFamily", failsafe: "Segoe UI"));

            SourceInitialized += (sender, e) =>
            {
                if (AllowsTransparency)
                {
                    BlurWindow.EnableWindowBlur(this);
                }
            };

            buttonPin.MouseLeftButtonUp += (sender, e) =>
            {
                if (Pinned)
                {
                    buttonCloseWindow.RaiseEvent(
                        new MouseButtonEventArgs(Mouse.PrimaryDevice, 0, MouseButton.Left)
                    {
                        RoutedEvent = MouseLeftButtonUpEvent
                    });
                    return;
                }
                Pinned = true;
                ViewWindowManager.GetInstance().ForgetCurrentWindow();
            };

            buttonCloseWindow.MouseLeftButtonUp += (sender, e) =>
            {
                if (Pinned)
                {
                    BeginClose();
                }
                else
                {
                    ViewWindowManager.GetInstance().ClosePreview();
                }
            };

            buttonOpenWith.Click += (sender, e) =>
            {
                if (Pinned)
                {
                    RunAndClose();
                }
                else
                {
                    ViewWindowManager.GetInstance().RunAndClosePreview();
                }
            };

            buttonWindowStatus.MouseLeftButtonUp += (sender, e) =>
                                                    WindowState = WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;

            buttonShare.MouseLeftButtonUp +=
                (sender, e) => RunWith("rundll32.exe", $"shell32.dll,OpenAs_RunDLL {Path}");
        }
Example #3
0
 private void DisableBtn_OnClick(object sender, RoutedEventArgs e)
 {
     EnableBtn.IsEnabled  = true;
     DisableBtn.IsEnabled = false;
     BlurWindow.DisableWindowBlur(this);
 }