/// <summary> /// Executes the method action by wrapping it with /// 1. Logging of start / end time. /// 2. Status updates. /// </summary> /// <param name="methodName">The name of the method being executed.</param> /// <param name="taskName">Option name to use for the TaskName for StatusUpdates.</param /// <param name="action">Action to execute.</param> public void Execute(string methodName, string taskName, ActionVoid action) { DateTime startTime = DateTime.Now; HandleStart(methodName, startTime); action(); HandleEnd(methodName, startTime); }
public Application() { startCallback = ProxyStart; exitCallback = ProxyExit; _handle = Application_new(startCallback, exitCallback); _current = this; }
private void ExecuteAction(MouseButton button, ButtonState3 state) { ActionVoid action = _bindingMap.GetAction(button, state); if (action != null) { action.Execute(); } }
private void ExecuteAction(Keys key, ButtonState3 state) { ActionVoid action = _bindingMap.GetAction(key, state); if (action != null) { action.Execute(); } }
public static BComponent BuildComponent(XmlNode xmlDoc, BComponent parent, Behaviors behavior) { string name = xmlDoc.Name; if (ActionBool.NAME == name) { return(ActionBool.Build(xmlDoc, parent, behavior)); } else if (ActionProperty.NAME == name) { return(ActionProperty.Build(xmlDoc, parent, behavior)); } else if (ActionVoid.NAME == name) { return(ActionVoid.Build(xmlDoc, parent, behavior)); } else if (ActionEnumerator.NAME == name) { return(ActionEnumerator.Build(xmlDoc, parent, behavior)); } else if (RandomSelector.NAME == name) { return(RandomSelector.Build(xmlDoc, parent, behavior)); } else if (RootSelector.NAME == name) { return(RootSelector.Build(xmlDoc, parent, behavior)); } else if (Selector.NAME == name) { return(Selector.Build(xmlDoc, parent, behavior)); } else if (Sequence.NAME == name) { return(Sequence.Build(xmlDoc, parent, behavior)); } else if (Inverter.NAME == name) { return(Inverter.Build(xmlDoc, parent, behavior)); } else if (UntilTrue.NAME == name) { return(UntilTrue.Build(xmlDoc, parent, behavior)); } else if (UntilFalse.NAME == name) { return(UntilFalse.Build(xmlDoc, parent, behavior)); } else { Debug.LogErrorFormat("I did not find the item: {0}", name); return(null); } }
/// <summary> /// Executes an action inside a try catch and logs any exceptions. /// </summary> /// <param name="action"></param> public static void TryCatchLog(string errorMessage, ILog log, ActionVoid action) { try { action(); } catch (Exception ex) { if (log != null) { log.Error(errorMessage, ex, null); } } }
/// <summary> /// Executes an action inside a try catch and logs any exceptions. /// </summary> /// <param name="action"></param> public static void TryCatch(ActionVoid action, Action <Exception> exceptionHandler) { try { action(); } catch (Exception ex) { if (exceptionHandler != null) { exceptionHandler(ex); } } }
/// <summary> /// Executes the method action by wrapping it with /// 1. Logging of start / end time. /// 2. Status updates. /// </summary> /// <param name="methodName">The name of the method being executed.</param> /// <param name="taskName">Option name to use for the TaskName for StatusUpdates.</param> /// <param name="wrapTryCatch">Whether or not to wrap the call inside a try catch.</param> /// <param name="action">Action to execute.</param> public void Execute(string methodName, string taskName, bool wrapTryCatch, ActionVoid action) { Execute(methodName, taskName, () => { if (!wrapTryCatch) { action(); } else { ExecuteHelper.TryCatchLog(action); } }); }
/// <summary> /// Exectutes the action under a write operation after /// aquiring the writer lock. /// </summary> /// <param name="executor"></param> protected void ExecuteWrite(ActionVoid executor) { AcquireWriterLock(); try { executor(); } catch (Exception ex) { } finally { ReleaseWriterLock(); } }
public CustomActionList(Game game, GraphicSettings setting, CustomWorld world, Tracker tracker) : base(game, setting) { _world = world; _tracker = tracker; PlayerForward = new ActionVoid(this.PlayerMoveForward); PlayerRight = new ActionVoid(this.PlayerMoveRight); PlayerBackward = new ActionVoid(this.PlayerMoveBackward); PlayerLeft = new ActionVoid(this.PlayerMoveLeft); CameraRotation = new ActionFloatFloat(this.RotateCamera); RotateCameraHorizontally = new ActionFloat(this.M_RotateCameraX); RotateCameraVertically = new ActionFloat(this.M_RotateCameraY); Pause = new ActionVoid(this.M_Pause); Shoot = new ActionVoid(this.MethodShoot); }
/// <summary> /// Exectutes the action under a write operation after /// aquiring the writer lock. /// </summary> /// <param name="executor"></param> protected static void ExecuteWrite(ActionVoid executor) { AcquireWriterLock(); try { executor(); } catch (Exception ex) { Console.WriteLine("Unable to execute write action in Logger." + ex.Message); } finally { ReleaseWriterLock(); } }
/// <summary> /// Executes an action inside a try catch and logs any exceptions. /// </summary> /// <param name="action"></param> public static void TryCatchFinallySafe(string errorMessage, ActionVoid action, Action <Exception> exceptionHandler, ActionVoid finallyHandler) { try { action(); } catch (Exception ex) { if (exceptionHandler != null) { exceptionHandler(ex); } } finally { if (finallyHandler != null) { TryCatchHandle(() => finallyHandler()); } } }
public RRLine(ActionVoid voidfunc) : this() { _voidFuncs.Add(voidfunc); }
public static extern IntPtr Application_new(ActionVoid start, ActionVoid exit);
/// <summary> /// Executes an action inside a try catch and does not do anything when /// an exception occurrs. /// </summary> /// <param name="action"></param> public static void TryCatch(ActionVoid action) { TryCatchLog(string.Empty, null, action); }
/// <summary> /// Executes an action inside a try catch and logs any exceptions. /// </summary> /// <param name="action"></param> public static void TryCatchLog(ActionVoid action) { ILog log = Logger.GetNew <ExecuteHelper>(); TryCatchLog(string.Empty, log, action); }
protected void BindButton(MouseButton button, ButtonState3 state, ActionVoid action) { buttonActionMap[state].Add(button, action); }
/// <summary> /// Executes an action inside a try catch and logs any exceptions. /// </summary> /// <param name="action"></param> public static void TryCatchLog(string errorMessage, ActionVoid action) { ILog log = Logger.GetNew <ExecuteHelper>(); TryCatchLog(errorMessage, log, action); }
public RequestTread(ActionVoid action) { OnAction = action; RequestManager.AddRequest(this); Uri = "Action"; }
/// <summary> /// Executes an action inside a try catch and does not do anything when /// an exception occurrs. /// </summary> /// <param name="action"></param> public static void TryCatchHandle(ActionVoid actionCode, ActionVoid finallyCode) { TryCatchFinallySafe(string.Empty, actionCode, (ex) => HandleException(ex), finallyCode); }
protected void Bind(Keys key, ButtonState3 state, ActionVoid action) { keyMap[state].Add(key, action); }
//methods public void Add(ActionVoid av) { _voidFuncs.Add(av); }
//constructors public ConLine(ActionVoid voidfunc, ConToken preset) : base(voidfunc) { _preset = preset; }