static void Main(string[] args) { Task task1 = Task.Factory.StartNew(() => InterceptKeyboard.Start()); Task task2 = Task.Factory.StartNew(() => InterceptMouse.Start()); Task.WaitAll(task1, task2); Console.WriteLine("All threads complete"); }
private void Form_Load(object sender, EventArgs e) { setComponents(); //TimeStamp.Logic.KeyboardHook.Start(); var interceptKeyboard = new InterceptKeyboard(); interceptKeyboard.KeyDownEvent += InterceptKeyboard_KeyDownEvent; //interceptKeyboard.KeyUpEvent += InterceptKeyboard_KeyUpEvent; interceptKeyboard.Hook(); //ショートカットリストの初期化 InputKeyCheckLogic.ShortcutKeyListInit(); DateTime datetime = DateTime.Now; var pasteFormat = ConfigurationManager.AppSettings["pasteFormat"]; textBox3.Text = datetime.ToString(pasteFormat); var selected = ConfigurationManager.AppSettings["selected"]; if (selected.Equals(radioButton1.Name)) { radioButton1.Select(); } else if (selected.Equals(radioButton2.Name)) { radioButton2.Select(); } else if (selected.Equals(radioButton3.Name)) { radioButton3.Select(); } else if (selected.Equals(radioButton4.Name)) { radioButton4.Select(); } textBox1.Text = ConfigurationManager.AppSettings["freeformat"]; textBox2.Text = ConfigurationManager.AppSettings["inputkey"]; //隠しショートカットラベルの表示有無 //設定の切り替えはconfigファイルを直接編集する //設定値がtrueだとラベルが表示される bool hiddenShrotcut; if (bool.TryParse(ConfigurationManager.AppSettings["hiddenShrotcutFlag"], out hiddenShrotcut)) { hiddenShortcut.Visible = hiddenShrotcut; } else { hiddenShortcut.Visible = false; } hiddenShortcut.Text = ConfigurationManager.AppSettings["hiddenShrotcut"]; }
private void InitializeHooks() { this.interceptKeyboard = new InterceptKeyboard(); this.interceptKeyboard.KeyDownEvent += InterceptKeyboard_KeyDownEvent; //this.interceptKeyboard.KeyUpEvent += InterceptKeyboard_KeyUpEvent; this.interceptKeyboard.Hook(); this.traceWindow = new TraceWindow(); this.traceWindow.ShowEvent += TraceWindow_ShowEvent; this.traceWindow.HideEvent += TraceWindow_HideEvent; this.traceWindow.LocationChangeEvent += TraceWindow_LocationChangeEvent; this.traceWindow.ActivateEvent += TraceWindow_ActivateEvent; this.traceWindow.Hook(); this.monitorManager = new MonitorManager(this.traceWindow); }