/// <summary> /// 新增流程項目 /// </summary> /// <param name="flowBase"></param> /// <returns></returns> public bool AddFlowBase(FlowBase flowBase, bool autoReplaceInstance = true) { lock (_key) { if (_totalFlow.ContainsKey(flowBase.Name)) { if (autoReplaceInstance) { if (_totalFlow[flowBase.Name].IsRunning) { _totalFlow[flowBase.Name].Stop(); } flowBase.FlowControl = this; _totalFlow[flowBase.Name] = flowBase; } //throw new ArgumentException(string.Format("FlowControl exists same FlowBase {0}.", flowBase.Name)); return(false); } else { flowBase.FlowControl = this; _totalFlow.Add(flowBase.Name, flowBase); return(true); } } }
public FlowMonitorForm(FlowBase obj, string name) { InitializeComponent(); inputObject = obj; hiddenProperties = new List <string>(); this.Name = name; }
/// <summary> /// 初始化所有項目 /// </summary> public void InitializeAll() { lock (_key) { foreach (var item in _totalFlow) { FlowBase instance = item.Value; instance.Initialize(); } } }
/// <summary> /// 中斷所有流程項目 /// </summary> /// <param name="description"></param> public void FailAll(string description = "") { lock (_key) { foreach (var item in _totalFlow) { FlowBase instance = item.Value; instance.Fail(description); } } }
/// <summary> /// 流程項目是否在執行 /// </summary> /// <param name="flowControlName">流程控制名稱</param> /// <param name="flowBaseName">流程項目名稱</param> /// <returns></returns> public bool IsRunning(string flowControlName, string flowBaseName) { bool isRunning = false; FlowControl flowControl = GetFlowControl(flowControlName); if (flowControl != null) { FlowBase flowBase = flowControl.GetFlowBase(flowBaseName); isRunning = flowBase.IsRunning; } return(isRunning); }
/// <summary> /// 得到所有流程項目資訊 /// </summary> public List <string> GetAllFlowBaseInfo() { string time = DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss"); List <string> flowBaseInfos = new List <string>(); lock (_key) { foreach (var item in _totalFlow) { FlowBase fbVar = item.Value; flowBaseInfos.Add(string.Format("{0},{1}", time, fbVar.GetFlowInfo())); } } return(flowBaseInfos); }
public FlowMonitorForm(FlowBase obj, string name, bool hideControlButton) : this(obj, name) { if (hideControlButton) { btnStart.Visible = false; btnPause.Visible = false; btnStop.Visible = false; } else { btnStart.Visible = true; btnPause.Visible = true; btnStop.Visible = true; } }
private void FlowAction() { lock (_key) { foreach (var item in _totalFlow) { FlowBase eachFlow = item.Value; try { eachFlow.FlowAction(); } catch (Exception ex) { ScannerStop(ex.Message + "\r\n" + ex.StackTrace); } } } }
/// <summary> /// 刪除流程項目 /// </summary> /// <param name="flowBase"></param> /// <returns></returns> public bool DeleteFlowBase(FlowBase flowBase) { lock (_key) { if (_totalFlow.ContainsKey(flowBase.Name)) { if (_totalFlow[flowBase.Name].IsRunning) { _totalFlow[flowBase.Name].Stop(); } _totalFlow.Remove(flowBase.Name); return(false); } else { return(false); } } }
/// <summary> /// 得到流程項目 /// </summary> /// <param name="name">FlowBase Name</param> /// <param name="autoAddNewInstance">當找不到FlowBase是否要自動產生</param> /// <returns>FlowBase</returns> public FlowBase GetFlowBase(string name, bool autoAddNewInstance = true) { FlowBase flowBase = null; if (!_totalFlow.ContainsKey(name)) { if (autoAddNewInstance) { flowBase = new FlowBase(name); flowBase.FlowControl = this; lock (_key) { _totalFlow.Add(name, flowBase); } } //throw new ArgumentException(string.Format("The FlowBase {0} doesn't exist.", name)); } else { flowBase = _totalFlow[name]; } return(flowBase); }
public FlowMonitorForm(FlowBase obj, string name, int userPermissions, Size dialogSize) : this(obj, name) { this.userPermissions = userPermissions; this.Size = dialogSize; }
public FlowMonitorForm(FlowBase obj, string name, Size dialogSize) : this(obj, name) { this.Size = dialogSize; }
public FlowMonitorForm(FlowBase obj, string name, int userPermissions) : this(obj, name) { this.userPermissions = userPermissions; }
public FlowMonitorForm(FlowBase obj, string name, int userPermissions, Size dialogSize, bool hideControlButton) : this(obj, name, hideControlButton) { this.userPermissions = userPermissions; this.Size = dialogSize; }
public FlowMonitorForm(FlowBase obj, string name, Size dialogSize, bool hideControlButton) : this(obj, name, hideControlButton) { this.Size = dialogSize; }
/// <summary> /// 重新啟動流程項目 /// </summary> /// <param name="name"></param> /// <param name="description"></param> public void Restart(string name, string description = "") { FlowBase instance = GetFlowBase(name); instance.Restart(description); }
/// <summary> /// 暫停流程項目 /// </summary> /// <param name="name"></param> /// <param name="description"></param> public void Pause(string name, string description = "") { FlowBase instance = GetFlowBase(name); instance.Pause(description); }
/// <summary> /// 停止流程項目 /// </summary> /// <param name="name"></param> /// <param name="description"></param> public void Stop(string name, string description = "") { FlowBase instance = GetFlowBase(name); instance.Stop(description); }
/// <summary> /// 初始化項目 /// </summary> public void Initialize(string name) { FlowBase instance = GetFlowBase(name); instance.Initialize(); }
/// <summary> /// 中斷流程項目 /// </summary> /// <param name="name"></param> /// <param name="description"></param> public void Fail(string name, string description = "") { FlowBase instance = GetFlowBase(name); instance.Fail(description); }
/// <summary> /// 顯示流程項目監控 /// </summary> /// <param name="name"></param> /// <param name="hideControlButton"></param> public void ShowMonitor(string name, bool hideControlButton) { FlowBase flowBase = GetFlowBase(name); flowBase.ShowMonitor(hideControlButton); }