private void btAction_Click(object sender, EventArgs e)//单步执行一次 { if (null == methodItem) { ShowTips("无效操作!方法对象未设置"); return; } try { bool isOK = methodItem.Action(); if (isOK) { ShowTips("\"" + Name + "\"执行成功,耗时:" + methodItem.Value.GetActionSeconds().ToString("F3")); return; } else { ShowTips(methodItem.ActionErrorInfo()); } } catch (Exception ex) { ShowTips("\"" + Name + "\"执行时异常:" + ex.ToString()); } }
void OnButtonClick_MethodItemAction(object sender, EventArgs e) { for (int i = 0; i < _lstBtAct.Count; i++) { if (sender == _lstBtAct[i]) { JFMethodFlow.MethodItem mi = _methodFlow.GetItem(i); bool isOK = false; try { isOK = mi.Action(); } catch (JFBreakMethodFlowException) { isOK = true; ShowTips("动作节点:" + mi.Name + " Break 退出流程"); UpdateMethodUi(i); UpdatePoolValues(); return; } catch (Exception ex) { ShowTips("动作节点:" + mi.Name + " 执行异常,信息:" + ex.Message); UpdateMethodUi(i); UpdatePoolValues(); return; } if (!isOK) { ShowTips("动作节点:" + mi.Name + " 执行失败,错误信息:" + mi.ActionErrorInfo()); } else { ShowTips("动作节点:" + mi.Name + " 执行完成,耗时:" + mi.Value.GetActionSeconds().ToString("F3") + "秒"); UpdateMethodUi(i); UpdatePoolValues(); } return; } } }