private void FrmMain_FormClosing(object sender, FormClosingEventArgs e) { UnBindUpdateEvents(); if (_config.DetectEnabled && _config.KeepUpdaterRunning) { UpdateHelper.KillRunningApps(_mainAppPath); } }
private void UpdateApp(string msg) { var appRunning = UpdateHelper.IsAppRunning(_mainAppPath); if (appRunning) { UpdateHelper.KillRunningApps(_mainAppPath); StopUpdateDetect(); StopMainAppActiveDetect(); } ShowAsNormal(appRunning ? "准备更新,正在关闭程序..." : null); UpdateHelper.Update(msg, appRunning ? 5000 : 0); }
/// <summary> /// 运行服务端命令 /// </summary> /// <param name="cmd"></param> /// <param name="localRunInfo"></param> private void OnServerCommandRequest(ClientCommand cmd, LocalRunInfo localRunInfo) { switch (cmd.Type) { case ClientCommandType.Start: if (!UpdateHelper.IsAppRunning(_mainAppPath)) { UpdateHelper.RunMainApp(localRunInfo, "由服务端启动"); } break; case ClientCommandType.Stop: if (UpdateHelper.IsAppRunning(_mainAppPath)) { UpdateHelper.KillRunningApps(_mainAppPath); } break; default: break; } }