Skip to content

Commit 944c4d3

Browse files
committed
Tray status window added
1 parent b126fab commit 944c4d3

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

Source/NETworkManager/MainWindow.xaml.cs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ private async void CloseSettings()
865865
if (_notifyIcon != null)
866866
_notifyIcon.Visible = SettingsManager.Current.TrayIcon_AlwaysShowIcon;
867867

868-
MetroWindowMain.HideOverlay();
868+
MetroMainWindow.HideOverlay();
869869
}
870870

871871
// Ask the user to restart (if he has changed the language)
@@ -1017,6 +1017,7 @@ private void InitNotifyIcon()
10171017
}
10181018

10191019
_notifyIcon.Text = Title;
1020+
_notifyIcon.Click += NotifyIcon_Click;
10201021
_notifyIcon.DoubleClick += NotifyIcon_DoubleClick;
10211022
_notifyIcon.MouseDown += NotifyIcon_MouseDown;
10221023
_notifyIcon.Visible = SettingsManager.Current.TrayIcon_AlwaysShowIcon;
@@ -1031,6 +1032,32 @@ private void NotifyIcon_MouseDown(object sender, System.Windows.Forms.MouseEvent
10311032
trayMenu.IsOpen = true;
10321033
}
10331034

1035+
StatusWindow statusWindow;
1036+
1037+
private void NotifyIcon_Click(object sender, EventArgs e)
1038+
{
1039+
System.Windows.Forms.MouseEventArgs mouse = (System.Windows.Forms.MouseEventArgs)e;
1040+
1041+
if (mouse.Button != MouseButtons.Left)
1042+
return;
1043+
1044+
if (statusWindow == null)
1045+
statusWindow = new StatusWindow();
1046+
1047+
1048+
1049+
System.Drawing.Point cursor = System.Windows.Forms.Cursor.Position;
1050+
1051+
Screen screen = Screen.FromPoint(new System.Drawing.Point(cursor.X, cursor.Y));
1052+
1053+
statusWindow.Left = screen.WorkingArea.Right - statusWindow.Width - 10;
1054+
statusWindow.Top = screen.WorkingArea.Bottom - statusWindow.Height - 10;
1055+
1056+
statusWindow.Show();
1057+
1058+
statusWindow.Activate();
1059+
}
1060+
10341061
private void NotifyIcon_DoubleClick(object sender, EventArgs e)
10351062
{
10361063
ShowWindowAction();

0 commit comments

Comments
 (0)