1- using Microsoft . Extensions . Configuration ;
1+ using Microsoft . Extensions . Configuration ;
22using Microsoft . Web . WebView2 . WinForms ;
33using System . Reflection ;
44
@@ -16,15 +16,15 @@ public MainForm()
1616 {
1717 InitializeComponent ( ) ;
1818
19- // 从配置文件中读取 URL,如果没有则使用默认值
19+ // 从配置文件中读取 URL,如果没有则使用默认值
2020 var configuration = Program . Configuration ;
2121 apiUrl = configuration . GetValue < string > ( "urls" ) ? . Replace ( "*" , "localhost" ) ?? "http://localhost:8080" ;
2222
2323 // Initialize WebView2
2424 webView = new WebView2
2525 {
2626 Dock = DockStyle . Fill ,
27- Source = new Uri ( $ "{ apiUrl } ") // 指向 Web API 的 URL
27+ Source = new Uri ( $ "{ apiUrl } ") // 指向 Web API 的 URL
2828 } ;
2929 this . Controls . Add ( webView ) ;
3030
@@ -36,14 +36,14 @@ public MainForm()
3636 Visible = true
3737 } ;
3838
39- // 使用资源中的 PNG 图像
39+ // 使用资源中的 PNG 图像
4040 this . Icon = LoadIconFromResource ( "MDriveSync.Client.WinFormAPI.Resources.logo.png" , 64 , 64 ) ;
4141
4242 notifyIcon . DoubleClick += NotifyIcon_DoubleClick ;
4343
4444 // Initialize ContextMenuStrip
4545 contextMenuStrip = new ContextMenuStrip ( ) ;
46- exitMenuItem = new ToolStripMenuItem ( "退出" , null , ExitMenuItem_Click ) ;
46+ exitMenuItem = new ToolStripMenuItem ( "退出" , null , ExitMenuItem_Click ) ;
4747 contextMenuStrip . Items . Add ( exitMenuItem ) ;
4848 notifyIcon . ContextMenuStrip = contextMenuStrip ;
4949
@@ -70,17 +70,17 @@ protected override void OnFormClosing(FormClosingEventArgs e)
7070 {
7171 if ( e . CloseReason == CloseReason . UserClosing )
7272 {
73- e . Cancel = true ; // 取消关闭操作
74- this . WindowState = FormWindowState . Minimized ; // 最小化窗口
75- this . Hide ( ) ; // 隐藏窗口
76- notifyIcon . Visible = true ; // 显示 NotifyIcon
73+ e . Cancel = true ; // 取消关闭操作
74+ this . WindowState = FormWindowState . Minimized ; // 最小化窗口
75+ this . Hide ( ) ; // 隐藏窗口
76+ notifyIcon . Visible = true ; // 显示 NotifyIcon
7777 }
7878 }
7979
8080 private void ExitMenuItem_Click ( object sender , EventArgs e )
8181 {
8282 notifyIcon . Visible = false ;
83- notifyIcon . Dispose ( ) ; // 确保图标被释放
83+ notifyIcon . Dispose ( ) ; // 确保图标被释放
8484 Application . Exit ( ) ;
8585 }
8686
@@ -121,4 +121,4 @@ private Icon LoadIconFromResource(string resourceName)
121121 }
122122 }
123123 }
124- }
124+ }
0 commit comments