static void Main() { try { BindExceptionHandler(); //异常处理 BonusSkins.Register(); //系统主题 SkinManager.EnableFormSkins(); Application.EnableVisualStyles();//程序设置及启动 Application.SetCompatibleTextRenderingDefault(false); Program.AppMutex = new Mutex(true, "AssetsSys", out Program.IsRun); if (Program.IsNeedUpdate()) { StartUpdate(); } else { if (IsRun) { AppMutex.ReleaseMutex(); Application.Run(new MainForm()); } else { MessageBox.Show("已经有一个实例正在运行!", "提示"); } } } catch (Exception ex) { MessageBox.Show(ex.GetType().Name.ToString()); } }
public static void Stop() { if (ReleaseMutex) { AppMutex?.ReleaseMutex(); AppMutex?.Dispose(); } }
static void Main() { try { BindExceptionHandler(); //异常处理 BonusSkins.Register(); //系统主题 SkinManager.EnableFormSkins(); Application.EnableVisualStyles();//程序设置及启动 Application.SetCompatibleTextRenderingDefault(false); Program.AppMutex = new Mutex(true, "RightingSys", out Program.IsRun); //初始化会话信息 Models.SqlHelper.Session = new Models.clsSession(); Models.SqlHelper.Session._IPAddress = clsPublic.getLocalIP(); Models.SqlHelper.Session._MACAddress = clsPublic.getLocalMac(); Models.SqlHelper.Session._IniConigPath = Application.StartupPath + "\\AppConfig.ini"; if (Program.IsNeedUpdate()) { StartUpdate(); } else { if (IsRun) { AppMutex.ReleaseMutex(); Application.Run(new MainForm()); } else { clsPublic.ShowMessage("已经有一个实例正在运行!", "提示"); } } } catch (Exception ex) { clsPublic.ShowMessage(ex.GetType().Name.ToString()); } }