internal virtual void Run(Action pre, Action post) { pre.Call(); if (Kean.Error.Log.CatchErrors) try { this.Method.Call(); } catch (Exception) { Console.Write("F"); } else this.Method.Call(); post.Call(); }
public static RepeatThread Start(string name, Action task, Action<RepeatThread, Action> run) { RepeatThread result = new RepeatThread(); Action wrappedTask = Error.Log.Wrap(string.Format("Thread \"{0}\" Failed.", name), () => { try { task.Call(); } catch (System.Threading.ThreadInterruptedException) { result.End = true; } catch (System.Threading.ThreadAbortException) { result.End = true; } }); run(result, () => { result.Running = true; while (!result.End) wrappedTask(); result.Running = false; }); return result; }
public bool Resolve(Uri.Locator locator, Action<object> set) { bool result; object target = this.targets[locator]; if (result = target.NotNull()) set.Call(target); else { Action<object> looseEnd = this.looseEnds[locator]; if (looseEnd.NotNull()) looseEnd += set; else this.looseEnds[locator] = set; } return result; }
public void Add(char shortIdentifier, string longIdentifier, Action<string, string, string, string> handler) { this.Add(shortIdentifier, longIdentifier, 4, s => handler.Call(s[0], s[1], s[2], s[3])); }
/// <summary> /// Adds a new argument handler to the parser. /// Used for arguments with 0 parameters. /// </summary> /// <param name="shortIdentifier">Argument short form character (for example v for -v).</param> /// <param name="longIdentifier">Argument long form string (for example version for --version).</param> /// <param name="handler">Function to call when argument is found during parsing.</param> public void Add(char shortIdentifier, string longIdentifier, Action handler) { this.Add(shortIdentifier, longIdentifier, 0, s => handler.Call()); }
public static void Dirty(UnityEngine.Object obj, System.Action ff) { Undo.RecordObject(obj, "obj"); ff.Call(); EditorUtility.SetDirty(obj); }
public static Tween TwFade(this Image p, float f, DOTweenEaseTime t, System.Action complete = null) { return(p.DOFade(f, t.time).SetEase(t.ease).OnComplete(() => { complete.Call(); })); }
/* Image */ public static Tween TwFade(this Image p, DOTweenFloat tf, System.Action complete = null) { p.SetAlpha(tf.start); return(p.DOFade(tf.end, tf.time).SetEase(tf.ease).OnComplete(() => { complete.Call(); })); }