/// <summary> /// 从处理状态中获得其字面意思 /// </summary> /// <param name="status">处理状态</param> /// <returns></returns> public static string GetTip(ProcessStatus status) { foreach (MemberInfo mi in status.GetType().GetMembers()) { if (mi.Name == status.ToString()) { return(ProcessCustomAttributes(mi)); } } return(string.Empty); }
public void Log(string affectedItem, string message, ProcessStatus pResult = ProcessStatus.Info, string fieldName = "", string fieldValue1 = "", string fieldValue2 = "") { if (pResult.ToString().ToLower().Contains("error")) { LoggedError = true; } //log for ui messaging log.AppendFormat("{0} : {1}", pResult, message).AppendLine(); //records are for csv file logging string fileName = pResult.ToString(); if (!LogRecords.ContainsKey(fileName)) { LogRecords.Add(fileName, new List <ImportRow>()); } LogRecords[fileName].Add(new ImportRow { AffectedItem = affectedItem, ErrorMessage = message, FieldName = fieldName, FieldValue1 = fieldValue1, FieldValue2 = fieldValue2 }); }
internal void SetStatus(ProcessStatus newStatus) { if (Status == newStatus) { return; } Status = newStatus; switch (newStatus) { case ProcessStatus.Working: // If this task has just been set to working, initialize it. Initialize(); break; case ProcessStatus.Successful: OnSuccess(); CleanUp(); break; case ProcessStatus.Aborted: OnAbort(); CleanUp(); break; case ProcessStatus.Failed: OnFail(); CleanUp(); break; // These states are only relevant for the process manager, so we can ignore them here. case ProcessStatus.Detached: case ProcessStatus.Pending: break; default: throw new ArgumentOutOfRangeException(newStatus.ToString(), newStatus, null); } }
// Always called when process is locked private void SetExited() { if (status == ProcessStatus.Queued || status == ProcessStatus.Completed) { logger.Log(String.Format("process {0} in unexpected state {1} while setting exited", id, status.ToString())); } else if (status == ProcessStatus.Running) { exitCode = process.ExitCode; logger.Log("setting running process " + id + " to completed exit code " + exitCode); } else { exitCode = unchecked ((int)Constants.DrError_VertexReceivedTermination); logger.Log("setting canceling process " + id + " to completed exit code " + exitCode + " real code " + process.ExitCode); } SetCompletedStatus(); UnblockMailboxes(); }
public void SetStatus(ProcessStatus status) { ssMsg.Text = status.ToString(); Global.ProcessStatus = status.ToString(); Application.DoEvents(); }