private void Taskbar_Closing(object sender, System.ComponentModel.CancelEventArgs e) { IsClosing = true; if (Startup.IsShuttingDown && Screen.Primary) { // Manually call dispose on window close... (this.DataContext as WindowsTasks.WindowsTasksService).Dispose(); // dispose system tray if it's still running to prevent conflicts when doing AppBar stuff NotificationArea.Instance.Dispose(); if (AppBarHelper.appBars.Contains(this.handle)) { AppBarHelper.RegisterBar(this, Screen, this.ActualWidth * dpiScale, this.ActualHeight * dpiScale); } // show the windows taskbar again AppBarHelper.SetWinTaskbarState(AppBarHelper.WinTaskbarState.OnTop); AppBarHelper.SetWinTaskbarPos((int)NativeMethods.SetWindowPosFlags.SWP_SHOWWINDOW); } else if (Startup.IsSettingScreens || Startup.IsShuttingDown) { if (AppBarHelper.appBars.Contains(this.handle)) { AppBarHelper.RegisterBar(this, Screen, this.ActualWidth, this.ActualHeight); } } else { IsClosing = false; e.Cancel = true; } }
private void OnWindowClosing(object sender, CancelEventArgs e) { IsClosing = true; if (Startup.IsShuttingDown && Screen.Primary) { NotificationArea.Instance.Dispose(); AppBarHelper.RegisterBar(this, Screen, this.ActualWidth * dpiScale, this.ActualHeight * dpiScale); WinSparkle.win_sparkle_cleanup(); if (Startup.IsCairoUserShell) { AppBarHelper.ResetWorkArea(); } } else if (Startup.IsSettingScreens || Startup.IsShuttingDown) { AppBarHelper.RegisterBar(this, Screen, this.ActualWidth, this.ActualHeight); } else { IsClosing = false; e.Cancel = true; } _listener.UnHookKeyboard(); }
private void setupPostInit() { // set initial DPI. We do it here so that we get the correct value when DPI has changed since initial user logon to the system. if (Screen.Primary) { Shell.DpiScale = PresentationSource.FromVisual(Application.Current.MainWindow).CompositionTarget.TransformToDevice.M11; } this.dpiScale = PresentationSource.FromVisual(this).CompositionTarget.TransformToDevice.M11; setPosition(); appbarMessageId = AppBarHelper.RegisterBar(this, Screen, this.ActualWidth * dpiScale, this.ActualHeight * dpiScale, AppBarHelper.ABEdge.ABE_TOP); // register time changed handler to receive time zone updates for the clock to update correctly if (Screen.Primary) { Microsoft.Win32.SystemEvents.TimeChanged += new EventHandler(TimeChanged); } Shell.HideWindowFromTasks(handle); if (Settings.EnableCairoMenuHotKey && Screen.Primary && !isCairoMenuHotkeyRegistered) { HotKeyManager.RegisterHotKey(Settings.CairoMenuHotKey, OnShowCairoMenu); isCairoMenuHotkeyRegistered = true; } // Register Windows key to open Programs menu if (Startup.IsCairoUserShell && Screen.Primary && !isProgramsMenuHotkeyRegistered) { /* * This was modified to fix issue: Cairo incorrectly handles the [Win] key #193 */ // HotKeyManager.RegisterHotKey(new List<string> { "Win", "LWin" }, OnShowProgramsMenu); new HotKey(Key.LWin, KeyModifier.Win | KeyModifier.NoRepeat, OnShowProgramsMenu); // HotKeyManager.RegisterHotKey(new List<string> { "Win", "RWin" }, OnShowProgramsMenu); new HotKey(Key.RWin, KeyModifier.Win | KeyModifier.NoRepeat, OnShowProgramsMenu); isProgramsMenuHotkeyRegistered = true; } /*if (Screen.Primary && keyboardListener == null) * { * keyboardListener = new LowLevelKeyboardListener(); * keyboardListener.OnKeyPressed += keyboardListener_OnKeyPressed; * keyboardListener.HookKeyboard(); * }*/ if (Settings.EnableMenuBarBlur) { Shell.EnableWindowBlur(handle); } FullScreenHelper.Instance.FullScreenApps.CollectionChanged += FullScreenApps_CollectionChanged; }
private void Window_SourceInitialized(object sender, EventArgs e) { helper = new WindowInteropHelper(this); HwndSource source = HwndSource.FromHwnd(helper.Handle); source.AddHook(new HwndSourceHook(WndProc)); handle = helper.Handle; appbarMessageId = AppBarHelper.RegisterBar(this, this.ActualWidth, this.ActualHeight, AppBarHelper.ABEdge.ABE_TOP); }
private void OnWindowClosing(object sender, CancelEventArgs e) { SysTray.DestroySystemTray(); AppBarHelper.RegisterBar(this, this.ActualWidth, this.ActualHeight); WinSparkle.win_sparkle_cleanup(); if (Startup.IsCairoUserShell) { AppBarHelper.ResetWorkArea(); } }
private void setupPostInit() { // set initial DPI. We do it here so that we get the correct value when DPI has changed since initial user logon to the system. if (Screen.Primary) { Shell.DpiScale = PresentationSource.FromVisual(Application.Current.MainWindow).CompositionTarget.TransformToDevice.M11; } this.dpiScale = PresentationSource.FromVisual(this).CompositionTarget.TransformToDevice.M11; setPosition(); appbarMessageId = AppBarHelper.RegisterBar(this, Screen, this.ActualWidth * dpiScale, this.ActualHeight * dpiScale, AppBarHelper.ABEdge.ABE_TOP); Shell.HideWindowFromTasks(handle); if (Settings.EnableCairoMenuHotKey && Screen.Primary && !isCairoMenuHotkeyRegistered) { HotKeyManager.RegisterHotKey(Settings.CairoMenuHotKey, OnShowCairoMenu); isCairoMenuHotkeyRegistered = true; } // Register Windows key to open Programs menu if (Startup.IsCairoUserShell && Screen.Primary && !isProgramsMenuHotkeyRegistered) { HotKeyManager.RegisterHotKey(new List <string> { "Win", "LWin" }, OnShowProgramsMenu); HotKeyManager.RegisterHotKey(new List <string> { "Win", "RWin" }, OnShowProgramsMenu); isProgramsMenuHotkeyRegistered = true; } /*if (Screen.Primary && keyboardListener == null) * { * keyboardListener = new LowLevelKeyboardListener(); * keyboardListener.OnKeyPressed += keyboardListener_OnKeyPressed; * keyboardListener.HookKeyboard(); * }*/ if (Settings.EnableMenuBarBlur) { Shell.EnableWindowBlur(handle); } }
private void TaskbarWindow_SourceInitialized(object sender, EventArgs e) { helper = new WindowInteropHelper(this); HwndSource source = HwndSource.FromHwnd(helper.Handle); source.AddHook(new HwndSourceHook(WndProc)); handle = helper.Handle; setPosition(); if (Settings.TaskbarMode == 0) { appbarMessageId = AppBarHelper.RegisterBar(this, this.ActualWidth, this.ActualHeight, appBarEdge); } }
private void setupPostInit() { setupMenuExtras(); // set initial DPI. We do it here so that we get the correct value when DPI has changed since initial user logon to the system. if (Screen.Primary) { Shell.DpiScale = PresentationSource.FromVisual(Application.Current.MainWindow).CompositionTarget.TransformToDevice.M11; } this.dpiScale = PresentationSource.FromVisual(this).CompositionTarget.TransformToDevice.M11; setPosition(); appbarMessageId = AppBarHelper.RegisterBar(this, Screen, this.ActualWidth * dpiScale, this.ActualHeight * dpiScale, AppBarHelper.ABEdge.ABE_TOP); Shell.HideWindowFromTasks(handle); if (Settings.Instance.EnableCairoMenuHotKey && Screen.Primary && !isCairoMenuHotkeyRegistered) { HotKeyManager.RegisterHotKey(Settings.Instance.CairoMenuHotKey, OnShowCairoMenu); isCairoMenuHotkeyRegistered = true; } // Register L+R Windows key to open Programs menu if (Startup.IsCairoRunningAsShell && Screen.Primary && !isProgramsMenuHotkeyRegistered) { /*if (keyboardListener == null) * keyboardListener = new LowLevelKeyboardListener(); * * keyboardListener.OnKeyPressed += keyboardListener_OnKeyPressed; * keyboardListener.HookKeyboard();*/ new HotKey(Key.LWin, KeyModifier.Win | KeyModifier.NoRepeat, OnShowProgramsMenu); new HotKey(Key.RWin, KeyModifier.Win | KeyModifier.NoRepeat, OnShowProgramsMenu); isProgramsMenuHotkeyRegistered = true; } if (Settings.Instance.EnableMenuBarBlur) { Shell.EnableWindowBlur(handle); } FullScreenHelper.Instance.FullScreenApps.CollectionChanged += FullScreenApps_CollectionChanged; }
private void Taskbar_Closing(object sender, System.ComponentModel.CancelEventArgs e) { // Manually call dispose on window close... (TasksList.DataContext as WindowsTasks.WindowsTasksService).Dispose(); // dispose system tray if it's still running to prevent conflicts when doing AppBar stuff if (Startup.MenuBarWindow != null && Startup.MenuBarWindow.SysTray != null) { Startup.MenuBarWindow.SysTray.DestroySystemTray(); } if (AppBarHelper.appBars.Contains(this.handle)) { AppBarHelper.RegisterBar(this, this.ActualWidth, this.ActualHeight); } // show the windows taskbar again AppBarHelper.SetWinTaskbarState(AppBarHelper.WinTaskbarState.OnTop); AppBarHelper.SetWinTaskbarPos((int)NativeMethods.SetWindowPosFlags.SWP_SHOWWINDOW); }
private void OnWindowClosing(object sender, CancelEventArgs e) { IsClosing = true; if (Startup.IsShuttingDown && Screen.Primary) { NotificationArea.Instance.Dispose(); AppBarHelper.RegisterBar(this, Screen, this.ActualWidth * dpiScale, this.ActualHeight * dpiScale); WinSparkle.win_sparkle_cleanup(); // Currently Unused if (keyboardListener != null) { keyboardListener.UnHookKeyboard(); } if (Startup.IsCairoRunningAsShell) { AppBarHelper.ResetWorkArea(); } FullScreenHelper.Instance.FullScreenApps.CollectionChanged -= FullScreenApps_CollectionChanged; FullScreenHelper.Instance.Dispose(); Microsoft.Win32.SystemEvents.TimeChanged -= new EventHandler(TimeChanged); } else if (Startup.IsSettingScreens || Startup.IsShuttingDown) { AppBarHelper.RegisterBar(this, Screen, this.ActualWidth * dpiScale, this.ActualHeight * dpiScale); FullScreenHelper.Instance.FullScreenApps.CollectionChanged -= FullScreenApps_CollectionChanged; } else { IsClosing = false; e.Cancel = true; } }
private void TaskbarWindow_SourceInitialized(object sender, EventArgs e) { helper = new WindowInteropHelper(this); HwndSource source = HwndSource.FromHwnd(helper.Handle); source.AddHook(new HwndSourceHook(WndProc)); handle = helper.Handle; this.dpiScale = PresentationSource.FromVisual(this).CompositionTarget.TransformToDevice.M11; setPosition(); setTaskButtonSize(); if (Settings.TaskbarMode == 0) { appbarMessageId = AppBarHelper.RegisterBar(this, Screen, this.ActualWidth * dpiScale, this.ActualHeight * dpiScale, appBarEdge); } Shell.HideWindowFromTasks(handle); }