diff --git a/EventHook.Examples/EventHook.WPF.Example/MainWindow.xaml.cs b/EventHook.Examples/EventHook.WPF.Example/MainWindow.xaml.cs index 8d96fcb..9dcf36d 100644 --- a/EventHook.Examples/EventHook.WPF.Example/MainWindow.xaml.cs +++ b/EventHook.Examples/EventHook.WPF.Example/MainWindow.xaml.cs @@ -23,21 +23,21 @@ public MainWindow() Application.Current.Exit += OnApplicationExit; - var keyboardWatcher = eventHookFactory.GetKeyboardWatcher(); + keyboardWatcher = eventHookFactory.GetKeyboardWatcher(); keyboardWatcher.Start(); keyboardWatcher.OnKeyInput += (s, e) => { Console.WriteLine(string.Format("Key {0} event of key {1}", e.KeyData.EventType, e.KeyData.Keyname)); }; - var mouseWatcher = eventHookFactory.GetMouseWatcher(); + mouseWatcher = eventHookFactory.GetMouseWatcher(); mouseWatcher.Start(); mouseWatcher.OnMouseInput += (s, e) => { Console.WriteLine(string.Format("Mouse event {0} at point {1},{2}", e.Message.ToString(), e.Point.x, e.Point.y)); }; - var clipboardWatcher = eventHookFactory.GetClipboardWatcher(); + clipboardWatcher = eventHookFactory.GetClipboardWatcher(); clipboardWatcher.Start(); clipboardWatcher.OnClipboardModified += (s, e) => { @@ -45,14 +45,14 @@ public MainWindow() }; - var applicationWatcher = eventHookFactory.GetApplicationWatcher(); + applicationWatcher = eventHookFactory.GetApplicationWatcher(); applicationWatcher.Start(); applicationWatcher.OnApplicationWindowChange += (s, e) => { Console.WriteLine(string.Format("Application window of '{0}' with the title '{1}' was {2}", e.ApplicationData.AppName, e.ApplicationData.AppTitle, e.Event)); }; - var printWatcher = eventHookFactory.GetPrintWatcher(); + printWatcher = eventHookFactory.GetPrintWatcher(); printWatcher.Start(); printWatcher.OnPrintEvent += (s, e) => { diff --git a/EventHook.Examples/EventHook.WinForms.Example/MainForm.cs b/EventHook.Examples/EventHook.WinForms.Example/MainForm.cs index 6216dcc..8051731 100644 --- a/EventHook.Examples/EventHook.WinForms.Example/MainForm.cs +++ b/EventHook.Examples/EventHook.WinForms.Example/MainForm.cs @@ -27,21 +27,21 @@ public MainForm() InitializeComponent(); - var keyboardWatcher = eventHookFactory.GetKeyboardWatcher(); + keyboardWatcher = eventHookFactory.GetKeyboardWatcher(); keyboardWatcher.Start(); keyboardWatcher.OnKeyInput += (s, e) => { Console.WriteLine(string.Format("Key {0} event of key {1}", e.KeyData.EventType, e.KeyData.Keyname)); }; - var mouseWatcher = eventHookFactory.GetMouseWatcher(); + mouseWatcher = eventHookFactory.GetMouseWatcher(); mouseWatcher.Start(); mouseWatcher.OnMouseInput += (s, e) => { Console.WriteLine(string.Format("Mouse event {0} at point {1},{2}", e.Message.ToString(), e.Point.x, e.Point.y)); }; - var clipboardWatcher = eventHookFactory.GetClipboardWatcher(); + clipboardWatcher = eventHookFactory.GetClipboardWatcher(); clipboardWatcher.Start(); clipboardWatcher.OnClipboardModified += (s, e) => { @@ -49,14 +49,14 @@ public MainForm() }; - var applicationWatcher = eventHookFactory.GetApplicationWatcher(); + applicationWatcher = eventHookFactory.GetApplicationWatcher(); applicationWatcher.Start(); applicationWatcher.OnApplicationWindowChange += (s, e) => { Console.WriteLine(string.Format("Application window of '{0}' with the title '{1}' was {2}", e.ApplicationData.AppName, e.ApplicationData.AppTitle, e.Event)); }; - var printWatcher = eventHookFactory.GetPrintWatcher(); + printWatcher = eventHookFactory.GetPrintWatcher(); printWatcher.Start(); printWatcher.OnPrintEvent += (s, e) => { diff --git a/EventHook/ApplicationWatcher.cs b/EventHook/ApplicationWatcher.cs index 2686721..e34fb7b 100644 --- a/EventHook/ApplicationWatcher.cs +++ b/EventHook/ApplicationWatcher.cs @@ -122,7 +122,7 @@ public void Stop() }, CancellationToken.None, TaskCreationOptions.None, - factory.GetTaskScheduler()).Wait(); + factory.GetTaskScheduler()); appQueue.Enqueue(false); isRunning = false; diff --git a/EventHook/ClipboardWatcher.cs b/EventHook/ClipboardWatcher.cs index 7a5dbb4..2db9bc1 100644 --- a/EventHook/ClipboardWatcher.cs +++ b/EventHook/ClipboardWatcher.cs @@ -104,7 +104,7 @@ public void Stop() }, CancellationToken.None, TaskCreationOptions.None, - factory.GetTaskScheduler()).Wait(); + factory.GetTaskScheduler()); } isRunning = false; diff --git a/EventHook/KeyboardWatcher.cs b/EventHook/KeyboardWatcher.cs index 773ba99..8b88cb2 100644 --- a/EventHook/KeyboardWatcher.cs +++ b/EventHook/KeyboardWatcher.cs @@ -107,7 +107,7 @@ public void Stop() }, CancellationToken.None, TaskCreationOptions.None, - factory.GetTaskScheduler()).Wait(); + factory.GetTaskScheduler()); } keyQueue.Enqueue(false); diff --git a/EventHook/MouseWatcher.cs b/EventHook/MouseWatcher.cs index 74de4ba..bfa7484 100644 --- a/EventHook/MouseWatcher.cs +++ b/EventHook/MouseWatcher.cs @@ -84,9 +84,9 @@ public void Stop() mouseHook.Stop(); mouseHook = null; }, - CancellationToken.None, - TaskCreationOptions.None, - factory.GetTaskScheduler()).Wait(); + CancellationToken.None, + TaskCreationOptions.None, + factory.GetTaskScheduler()); } mouseQueue.Enqueue(false); diff --git a/EventHook/PrintWatcher.cs b/EventHook/PrintWatcher.cs index 6da8963..2314364 100644 --- a/EventHook/PrintWatcher.cs +++ b/EventHook/PrintWatcher.cs @@ -114,7 +114,7 @@ public void Stop() }, CancellationToken.None, TaskCreationOptions.None, - factory.GetTaskScheduler()).Wait(); + factory.GetTaskScheduler()); } } }