private void InitWindowsMouseEvents() { Point previousWindowPos = new Point(this.Left, this.Top); Point actualWindowsPos = previousWindowPos; MouseLeftButtonUp += (object sender, MouseButtonEventArgs e) => { actualWindowsPos = new Point(this.Left, this.Top); if (actualWindowsPos.Equals(previousWindowPos)) { ShowActivity(ActivityEnum.Allowed); ClickableIcon.Source = ICON_NORMAL; if (WindowState.Minimized == notifierWindow.WindowState) { notifierWindow.RestoreWindowState(); } else { notifierWindow.HideWindowState(); } } else { previousWindowPos = actualWindowsPos; Settings.Default.ActivityWindow_Position = actualWindowsPos; Settings.Default.Save(); } }; MouseLeftButtonDown += (object sender, MouseButtonEventArgs e) => { DragMove(); }; }
private void TrayIcon_Click(object Sender, EventArgs e) { if (WinForms::MouseButtons.Left.Equals(((WinForms::MouseEventArgs)e).Button)) { if (notifierWindow.WindowState == WindowState.Minimized) { notifierWindow.RestoreWindowState(); } else { notifierWindow.HideWindowState(); } } }