diff --git a/src/MDriveSync.Client.WinFormAPI/MDriveSync.Client.WinFormAPI.csproj b/src/MDriveSync.Client.WinFormAPI/MDriveSync.Client.WinFormAPI.csproj
index 3a27eae..3e8f523 100644
--- a/src/MDriveSync.Client.WinFormAPI/MDriveSync.Client.WinFormAPI.csproj
+++ b/src/MDriveSync.Client.WinFormAPI/MDriveSync.Client.WinFormAPI.csproj
@@ -42,6 +42,12 @@
+
+
+ true
+
+
+
diff --git a/src/MDriveSync.Client.WinFormAPI/MainForm.cs b/src/MDriveSync.Client.WinFormAPI/MainForm.cs
index f1162c7..2b98464 100644
--- a/src/MDriveSync.Client.WinFormAPI/MainForm.cs
+++ b/src/MDriveSync.Client.WinFormAPI/MainForm.cs
@@ -1,4 +1,4 @@
-using Microsoft.Extensions.Configuration;
+锘縰sing Microsoft.Extensions.Configuration;
using Microsoft.Web.WebView2.WinForms;
using System.Reflection;
@@ -16,7 +16,7 @@ public MainForm()
{
InitializeComponent();
- // 从配置文件中读取 URL,如果没有则使用默认值
+ // 浠庨厤缃枃浠朵腑璇诲彇 URL锛屽鏋滄病鏈夊垯浣跨敤榛樿鍊
var configuration = Program.Configuration;
apiUrl = configuration.GetValue("urls")?.Replace("*", "localhost") ?? "http://localhost:8080";
@@ -24,7 +24,7 @@ public MainForm()
webView = new WebView2
{
Dock = DockStyle.Fill,
- Source = new Uri($"{apiUrl}") // 指向 Web API 的 URL
+ Source = new Uri($"{apiUrl}") // 鎸囧悜 Web API 鐨 URL
};
this.Controls.Add(webView);
@@ -36,14 +36,14 @@ public MainForm()
Visible = true
};
- // 使用资源中的 PNG 图像
+ // 浣跨敤璧勬簮涓殑 PNG 鍥惧儚
this.Icon = LoadIconFromResource("MDriveSync.Client.WinFormAPI.Resources.logo.png", 64, 64);
notifyIcon.DoubleClick += NotifyIcon_DoubleClick;
// Initialize ContextMenuStrip
contextMenuStrip = new ContextMenuStrip();
- exitMenuItem = new ToolStripMenuItem("退出", null, ExitMenuItem_Click);
+ exitMenuItem = new ToolStripMenuItem("閫鍑", null, ExitMenuItem_Click);
contextMenuStrip.Items.Add(exitMenuItem);
notifyIcon.ContextMenuStrip = contextMenuStrip;
@@ -70,17 +70,17 @@ protected override void OnFormClosing(FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing)
{
- e.Cancel = true; // 取消关闭操作
- this.WindowState = FormWindowState.Minimized; // 最小化窗口
- this.Hide(); // 隐藏窗口
- notifyIcon.Visible = true; // 显示 NotifyIcon
+ e.Cancel = true; // 鍙栨秷鍏抽棴鎿嶄綔
+ this.WindowState = FormWindowState.Minimized; // 鏈灏忓寲绐楀彛
+ this.Hide(); // 闅愯棌绐楀彛
+ notifyIcon.Visible = true; // 鏄剧ず NotifyIcon
}
}
private void ExitMenuItem_Click(object sender, EventArgs e)
{
notifyIcon.Visible = false;
- notifyIcon.Dispose(); // 确保图标被释放
+ notifyIcon.Dispose(); // 纭繚鍥炬爣琚噴鏀
Application.Exit();
}
@@ -121,4 +121,4 @@ private Icon LoadIconFromResource(string resourceName)
}
}
}
-}
+}
\ No newline at end of file
diff --git a/src/MDriveSync.Client.WinFormAPI/Program.cs b/src/MDriveSync.Client.WinFormAPI/Program.cs
index fd29cb3..a1833f8 100644
--- a/src/MDriveSync.Client.WinFormAPI/Program.cs
+++ b/src/MDriveSync.Client.WinFormAPI/Program.cs
@@ -1,4 +1,4 @@
-using Microsoft.AspNetCore.Hosting;
+锘縰sing Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
@@ -30,11 +30,11 @@ public static IHostBuilder CreateHostBuilder() =>
{
var env = context.HostingEnvironment;
- // 添加 appsettings.json 配置文件
+ // 娣诲姞 appsettings.json 閰嶇疆鏂囦欢
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
- // 添加环境变量
+ // 娣诲姞鐜鍙橀噺
config.AddEnvironmentVariables();
})
.ConfigureWebHostDefaults(webBuilder =>
@@ -54,4 +54,4 @@ public static IHostBuilder CreateHostBuilder() =>
}
});
}
-}
\ No newline at end of file
+}