Browse Source

关闭到托盘

陈国伟 3 years ago
parent
commit
a1339cfdf9
1 changed files with 7 additions and 3 deletions
  1. 7 3
      FastGithub.UI/MainWindow.xaml.cs

+ 7 - 3
FastGithub.UI/MainWindow.xaml.cs

@@ -85,11 +85,15 @@ namespace FastGithub.UI
             {
                 const int WM_SYSCOMMAND = 0x112;
                 const int SC_MINIMIZE = 0xf020;
+                const int SC_CLOSE = 0xf060;
 
-                if (msg == WM_SYSCOMMAND && wParam.ToInt32() == SC_MINIMIZE)
+                if (msg == WM_SYSCOMMAND)
                 {
-                    this.Hide();
-                    handled = true;
+                    if (wParam.ToInt32() == SC_MINIMIZE || wParam.ToInt32() == SC_CLOSE)
+                    {
+                        this.Hide();
+                        handled = true;
+                    }
                 }
                 return IntPtr.Zero;
             }