Skip to content
This repository has been archived by the owner on Apr 21, 2021. It is now read-only.

Commit

Permalink
rm wait
Browse files Browse the repository at this point in the history
  • Loading branch information
justcoding121 committed Apr 13, 2018
1 parent 49acd35 commit 46937af
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions EventHook.Examples/EventHook.WPF.Example/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,36 @@ 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) =>
{
Console.WriteLine(string.Format("Clipboard updated with data '{0}' of format {1}", e.Data, e.DataFormat.ToString()));
};


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) =>
{
Expand Down
10 changes: 5 additions & 5 deletions EventHook.Examples/EventHook.WinForms.Example/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,36 @@ 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) =>
{
Console.WriteLine(string.Format("Clipboard updated with data '{0}' of format {1}", e.Data, e.DataFormat.ToString()));
};


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) =>
{
Expand Down
2 changes: 1 addition & 1 deletion EventHook/ApplicationWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void Stop()
},
CancellationToken.None,
TaskCreationOptions.None,
factory.GetTaskScheduler()).Wait();
factory.GetTaskScheduler());

appQueue.Enqueue(false);
isRunning = false;
Expand Down
2 changes: 1 addition & 1 deletion EventHook/ClipboardWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void Stop()
},
CancellationToken.None,
TaskCreationOptions.None,
factory.GetTaskScheduler()).Wait();
factory.GetTaskScheduler());
}

isRunning = false;
Expand Down
2 changes: 1 addition & 1 deletion EventHook/KeyboardWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void Stop()
},
CancellationToken.None,
TaskCreationOptions.None,
factory.GetTaskScheduler()).Wait();
factory.GetTaskScheduler());
}

keyQueue.Enqueue(false);
Expand Down
6 changes: 3 additions & 3 deletions EventHook/MouseWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion EventHook/PrintWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void Stop()
},
CancellationToken.None,
TaskCreationOptions.None,
factory.GetTaskScheduler()).Wait();
factory.GetTaskScheduler());
}
}
}
Expand Down

0 comments on commit 46937af

Please sign in to comment.