private void SafeExecute(Definition child) { try { child.StartTime = DateTime.Now; if (child.Enabled) { child.ExecutionStatus = ExecStatus.Running; if (IsAsyncAppliedToDelegate(child.Fn)) { child.Fn1 = async () => { child.Fn(); }; asyncExecute(child); } else { execute(child); } child.RanSuccesfully = true; } else { child.RanSuccesfully = false; } } catch (Exception e) { child.ExecutionResult = e.Message; child.RanSuccesfully = false; child.Parent.RanSuccesfully = false; child.StackTrace = e.StackTrace; } finally { child.EndTime = DateTime.Now; child.ExecutionStatus = ExecStatus.Completed; } }
private void execute(Definition child) { child.Fn(); }