private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
eventWatcher.Dispose();
// remove the notify icon
this.NotifyIcon.Visible = false;
this.NotifyIcon.Dispose();
if (this.IsLoaded)
{
HwndSource source = PresentationSource.FromVisual(this) as HwndSource;
source.RemoveHook(this.WndProc);
}
this.ReleaseHandlers();
}