/// <summary> /// NurseryType: Operation /// 子进程退出时调用 /// </summary> /// <param name="pathName"></param> /// <param name="processName"></param> public static void OnProcessStopped(string pathName, string processName) { NurseryToNoform.SetNurseryItemCheckState(pathName, CheckState.Unchecked); NurseryManager.Send(new OperationStruct { type = OperationType.Stop, code = OperationCode.OK, pathName = pathName, processName = processName }); }
public static void AddProcess(string pathName) { bool ac = ProcessManager.Add(pathName); bool success = NurseryToNoform.AddNurseryItem(pathName); NurseryManager.Send(new OperationStruct { type = OperationType.Add, code = ac && success ? OperationCode.OK : OperationCode.Failed, pathName = pathName, }); }
/// <summary> /// NurseryType: Operation /// 删除进程 /// </summary> /// <param name="pathName"></param> /// <param name="processName"></param> public static void RemoveProcess(string pathName) { ProcessManager.Remove(pathName); bool success = NurseryToNoform.RemoveNurseryItem(pathName); NurseryManager.Send(new OperationStruct { type = OperationType.Remove, code = success ? OperationCode.OK : OperationCode.Failed, pathName = pathName }); }
/// <summary> /// NurseryType: Operation /// </summary> /// <param name="pathName"></param> /// <param name="args"></param> public static void StartProcess(string pathName, string args = "") { string processName = ProcessManager.Start(pathName, args); bool uni = NurseryToNoform.UpdateNurseryItem(pathName, processName); bool scics = NurseryToNoform.SetNurseryItemCheckState(pathName, CheckState.Checked); NurseryManager.Send(new OperationStruct { type = OperationType.Start, code = processName != null && uni && scics ? OperationCode.OK : OperationCode.Failed, pathName = pathName, processName = processName }); }