public ActionController(IntPtr hookedInstance, IActionView actionView, RecordStrategies recordStrategy) { try { switch (recordStrategy) { case RecordStrategies.Mouse: actionStrategy = new MActionStrategy(); break; case RecordStrategies.Keyboard: actionStrategy = new KBActionStrategy(); break; case RecordStrategies.MouseAndKeyboard: actionStrategy = new KBMActionStrategy(); break; default: break; } this.actionView = actionView; } catch (Exception ex) { ExceptionLogger.LogException(ex); } }
private void rdb_Click(object sender, RoutedEventArgs e) { if (rdbMouseAndKeyboard.IsChecked == true) { this.recordStrategy = RecordStrategies.MouseAndKeyboard; } else if (rdbMouse.IsChecked == true) { this.recordStrategy = RecordStrategies.Mouse; } else if (rdbKeyboard.IsChecked == true) { this.recordStrategy = RecordStrategies.Keyboard; } }
public ActionController(IActionView actionView, RecordStrategies recordStrategy) : this(Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]), actionView,recordStrategy) { }
private void Window_Loaded(object sender, RoutedEventArgs e) { recordStrategy = RecordStrategies.MouseAndKeyboard; IntPtr hwnd = new WindowInteropHelper(this).Handle; if (hwnd != IntPtr.Zero) { HwndSource.FromHwnd(hwnd).AddHook(new HwndSourceHook(this.MessageHookHandler)); } Win32API.RegisterHotKey((new WindowInteropHelper(this)).Handle, 247696411, 0, (UInt32)Keys.F10); //注册热键 }