private void OnHotKeyPressed(object sender, KeyPressedEventArgs e) { var kc = new KeyConverter(); if (e.HotKey.Key == (Key)kc.ConvertFromString(Settings.Default.hotKeyQ)) { ForegroundW.SetForeground("Shell_TrayWnd"); textBox.Focus(); textBox.Clear(); } if (e.HotKey.Key == (Key)kc.ConvertFromString(Settings.Default.hotKeyW)) { if (Shower == null) { Shower = new QShower(); } Shower.ShowOrHide(ActualHeight, ActualWidth, PointToScreen(new Point()).X); } if (e.HotKey.Key == (Key)kc.ConvertFromString(Settings.Default.hotKeyB)) { Sim.Keyboard.ModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_C); Thread.Sleep(20); string str = ClipboardGetText(); Process.Start("https://www.baidu.com/s?ie=UTF-8&wd=" + str); } if (e.HotKey.Key == (Key)kc.ConvertFromString(Settings.Default.hotKeyG)) { Sim.Keyboard.ModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_C); Thread.Sleep(20); string str = ClipboardGetText(); Process.Start("http://google.com#q=" + str); } }
// 打开/关闭 翻译详情 private void Logo_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (Shower == null) { Shower = new QShower(); } Shower.ShowOrHide(ActualHeight, ActualWidth, PointToScreen(new Point()).X); }