From b5234c5ab1e9e6826b8d8fc1e95fa752aaa40b74 Mon Sep 17 00:00:00 2001
From: chr <chr@mailcom>
Date: 星期六, 02 十一月 2024 10:56:50 +0800
Subject: [PATCH] 优化程序
---
PdmSwPlugin.Main/MainControl.xaml.cs | 44 ++++++++++++++++++++++++++++++++++++++++----
1 files changed, 40 insertions(+), 4 deletions(-)
diff --git a/PdmSwPlugin.Main/MainControl.xaml.cs b/PdmSwPlugin.Main/MainControl.xaml.cs
index f2ed4ac..8f0049f 100644
--- a/PdmSwPlugin.Main/MainControl.xaml.cs
+++ b/PdmSwPlugin.Main/MainControl.xaml.cs
@@ -18,6 +18,8 @@
using SuperSocket.SocketBase;
using SuperSocket.SocketBase.Protocol;
using PdmSwPlugin.Main.Tcp;
+using SolidWorks.Interop.swconst;
+using System.Windows.Interop;
namespace PdmSwPlugin.Main
{
@@ -121,6 +123,20 @@
string updaterPath = "AutoUpdater\\AutoUpdater.exe";
string exePath = new DirectoryInfo(Assembly.GetExecutingAssembly().Location).Parent.FullName;
string exeFileName = $"{exePath}\\{updaterPath}";
+ //if (SwApp.SendMsgToUser2("妫�娴嬪埌鎻掍欢鏇存柊锛屾槸鍚︾珛鍒绘洿鏂帮紵锛堣娉ㄦ剰淇濆瓨褰撳墠宸ヤ綔锛�", (int)swMessageBoxIcon_e.swMbInformation, (int)swMessageBoxBtn_e.swMbYesNo)
+ // == (int)swMessageBoxResult_e.swMbHitYes)
+ //{
+ // Process updaterProcess = new Process
+ // {
+ // StartInfo = new ProcessStartInfo
+ // {
+ // FileName = exeFileName,
+ // Arguments = mainProcessId + ""
+ // }
+ // };
+ // updaterProcess.Start();
+ //}
+
// 闈炲繀瑕佹洿鏂�
new Task(() =>
{
@@ -209,9 +225,29 @@
public void Logout()
{
- string binPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData), "HengXin", "PdmSwPlugin", "bin");
- File.Delete(binPath);
- DeActiveHandler();
+ try
+ {
+ // 鍒犻櫎缂撳瓨bin鏂囦欢
+ string binPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData), "HengXin", "PdmSwPlugin", "bin");
+ File.Delete(binPath);
+ }
+ catch (Exception ex)
+ {
+ //SwApp.SendMsgToUser2("鐢ㄦ埛缂撳瓨娓呯悊澶辫触锛�", (int)swMessageBoxIcon_e.swMbWarning, (int)swMessageBoxBtn_e.swMbOk);
+ Logger.Error("Delete User Bin File Failed.", ex);
+ }
+
+ try
+ {
+ // 娓呴櫎UserControl浜嬩欢
+ DeActiveHandler();
+ }
+ catch (Exception ex)
+ {
+ SwApp.SendMsgToUser2("鍙戠敓鏈煡寮傚父锛岃鎯呰瑙佹棩蹇楋紒", (int)swMessageBoxIcon_e.swMbWarning, (int)swMessageBoxBtn_e.swMbOk);
+ Logger.Error("DeActiveHandler Failed.", ex);
+ }
+
mainTab.tabControl.Items.Clear();
PdmUser.SetLoginUser(null);
mainBorder.Child = new LoginControl(LoginSuccess);
@@ -238,7 +274,7 @@
private void self_Unloaded(object sender, RoutedEventArgs e)
{
- StopTcpServer();
+ // StopTcpServer();
}
}
}
--
Gitblit v1.9.1