| | |
| | | using System.Net; |
| | | using System.Reflection; |
| | | using System.Runtime.InteropServices; |
| | | using System.Security.Principal; |
| | | using System.Text; |
| | | using System.Timers; |
| | | using System.Windows; |
| | |
| | | // WinAPI_Interop.ShowServiceMessage(msg, "提示"); |
| | | // ShowMessageBox(msg, "提示"); |
| | | string exeDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); |
| | | string alertPath = Path.GetFullPath(Path.Combine(exeDir,"..","Alert.exe")); |
| | | string alertPath = Path.GetFullPath(Path.Combine(exeDir, "..", "Alert.exe")); |
| | | if (File.Exists(alertPath)) |
| | | { |
| | | Process.Start(alertPath); |
| | |
| | | private bool IsSwRunning() |
| | | { |
| | | Process[] ps = Process.GetProcessesByName("SLDWORKS"); |
| | | bool IsRunning = (ps != null && ps.Length > 0); |
| | | bool IsRunning = false; |
| | | if (ps == null || ps.Length <= 0) |
| | | { |
| | | log.Debug($"Sw Is Running: {IsRunning}"); |
| | | return false; |
| | | } |
| | | IsRunning = true; |
| | | string username = WindowsIdentity.GetCurrent().Name; |
| | | log.Debug($"Sw Is Running: {IsRunning}"); |
| | | return IsRunning; |
| | | return false; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | private void HandleErr() |
| | | { |
| | | log.Debug($"err_count: {err_count}"); |
| | | if (++err_count > 3) |
| | | if (++err_count > 5) |
| | | { |
| | | if (IsSwRunning()) |
| | | { |