| | |
| | | using SuperSocket.SocketBase; |
| | | using SuperSocket.SocketBase.Protocol; |
| | | using PdmSwPlugin.Main.Tcp; |
| | | using SolidWorks.Interop.swconst; |
| | | using System.Windows.Interop; |
| | | |
| | | namespace PdmSwPlugin.Main |
| | | { |
| | |
| | | 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(() => |
| | | { |
| | |
| | | |
| | | 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); |
| | |
| | | |
| | | private void self_Unloaded(object sender, RoutedEventArgs e) |
| | | { |
| | | StopTcpServer(); |
| | | // StopTcpServer(); |
| | | } |
| | | } |
| | | } |