public void AlwaysOnTop_Key(object sender, EventArgs e) { AlwaysOnTop.IsChecked = !AlwaysOnTop.IsChecked; IntPtr wasActive = WindowsServices.GetForegroundWindow(); // hack for activating overparse window WindowState = WindowState.Minimized; Show(); WindowState = WindowState.Normal; Topmost = AlwaysOnTop.IsChecked; AlwaysOnTop_Click(null, null); WindowsServices.SetForegroundWindow(wasActive); }
private void AlwaysOnTop_Key(object sender, HotkeyEventArgs e) { // Console.WriteLine("Always-on-top hotkey pressed"); AlwaysOnTop.IsChecked = !AlwaysOnTop.IsChecked; IntPtr wasActive = WindowsServices.GetForegroundWindow(); // hack for activating overparse window this.WindowState = WindowState.Minimized; this.Show(); this.WindowState = WindowState.Normal; this.Topmost = AlwaysOnTop.IsChecked; AlwaysOnTop_Click(null, null); WindowsServices.SetForegroundWindow(wasActive); e.Handled = true; }