private void WindowLoadedAction(Window _window) { Window = _window; var handle = new WindowInteropHelper(Window).Handle; WindowManager.Manager.SetDockHwnd(handle); WindowManager.Manager.Start(); ThemeManager.Manager.ThemeWindow(); if (VMLocator.Main.RemoveTaskbar) { TaskbarManager.SetTaskbarVisibility(false); } SetWorkingArea(VMLocator.Main.ReserveScreenSpace); // Subscribe to window events. Application.Current.Exit += Current_Exit; WindowManager.Manager.ActiveWindowChanged += Manager_ActiveWindowChanged; SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged; // Add a hook to receive window events from Windows. HwndSource source = PresentationSource.FromVisual(Window) as HwndSource; source.AddHook(WndProc); // These two lines are necessary to capture the window events in the above hook. WindowInterop.RegisterShellHookWindow(handle); WindowInterop.RegisterWindowMessage("SHELLHOOK"); SetWindowPosition(); // Show the widgets window ShowWidgets(); }
private void Current_Exit(object sender, ExitEventArgs e) { if (VMLocator.Main.RemoveTaskbar) { TaskbarManager.SetTaskbarVisibility(true); } WindowManager.Manager.Stop(); }