private void btn_image_shotcut_Click(object sender, RoutedEventArgs e) { ShortCutEntitys shortcut = new ShortCutEntitys(); KeyEntity keyEntity = new KeyEntity(); keyEntity.Key = System.Windows.Forms.Keys.D; shortcut.Add(keyEntity); keyEntity = new KeyEntity(); keyEntity.Key = System.Windows.Forms.Keys.D; shortcut.Add(keyEntity); this.image.GetImgOperate().RegisterPartShotCut(shortcut); }
public MainWindow() { InitializeComponent(); this.DataContext = _vm; // Todo :双击大小写切换 ShortCutEntitys s = new ShortCutEntitys(); KeyEntity k = new KeyEntity(); k.Key = Keys.LShiftKey; s.Add(k); KeyEntity c = new KeyEntity(); c.Key = Keys.LShiftKey; s.Add(c); ShortCutHookService.Instance.RegisterCommand(s, RefreshVisible); }
/// <summary> 此方法的说明 </summary> public void RegisterApi() { // Todo :双击大小写切换 ShortCutEntitys s = new ShortCutEntitys(); KeyEntity k = new KeyEntity(); k.Key = Keys.Capital; s.Add(k); KeyEntity c = new KeyEntity(); c.Key = Keys.Capital; s.Add(c); ShortCutHookService.Instance.RegisterCommand(s, RefreshVisible); // Todo :双击Ctrl键 ShortCutEntitys d = new ShortCutEntitys(); KeyEntity c1 = new KeyEntity(); c1.Key = Keys.LControlKey; d.Add(c1); KeyEntity c2 = new KeyEntity(); c2.Key = Keys.LControlKey; d.Add(c2); Action action = () => { // HTodo :双击ctrl 模拟delete按键 KeyHelper.OnKeyPress((byte)Keys.Delete); }; ShortCutHookService.Instance.RegisterCommand(d, action); // Todo :复制当前时间 ShortCutEntitys tt = new ShortCutEntitys(); KeyEntity t1 = new KeyEntity(); t1.Key = Keys.E; tt.Add(t1); KeyEntity t2 = new KeyEntity(); t2.Key = Keys.D; tt.Add(t2); Action actiont = () => { // Todo :复制当前时间格式 System.Windows.Clipboard.SetText(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")); }; ShortCutHookService.Instance.RegisterCommand(tt, actiont); ShortCutEntitys ed = new ShortCutEntitys(); KeyEntity e = new KeyEntity(); e.Key = Keys.E; ed.Add(e); KeyEntity dd = new KeyEntity(); dd.Key = Keys.D; ed.Add(dd); ShortCutHookService.Instance.RegisterCommand(ed, actiont); }