TriggerScope _Add(bool not, AWnd.Finder f) { if (f == null) { throw new ArgumentNullException(); } Used = true; return(Current = new TriggerScope(f, not)); }
TriggerScope _Add(bool not, AWnd.Finder[] a) { if (a.Length == 0) { return(_Add(not, a[0])); } foreach (var v in a) { if (v == null) { throw new ArgumentNullException(); } } Used = true; return(Current = new TriggerScope(a, not)); }
readonly TriggerFunc[] _funcAfter, _funcBefore; //Triggers.FuncOf. _funcAfter used by all triggers; _funcBefore - like scope. internal ActionTrigger(ActionTriggers triggers, Delegate action, bool usesWindowScope) { this.action = action; this.triggers = triggers; var to = triggers.options_; options = to.Current; EnabledAlways = to.EnabledAlways; if (usesWindowScope) { scope = triggers.scopes_.Current; } var tf = triggers.funcs_; _funcBefore = _Func(tf.commonBefore, tf.nextBefore); tf.nextBefore = null; _funcAfter = _Func(tf.nextAfter, tf.commonAfter); tf.nextAfter = null; TriggerFunc[] _Func(TFunc f1, TFunc f2) { var f3 = f1 + f2; if (f3 == null) { return(null); } var a1 = f3.GetInvocationList(); var r1 = new TriggerFunc[a1.Length]; for (int i = 0; i < a1.Length; i++) { var f4 = a1[i] as TFunc; if (!tf.perfDict.TryGetValue(f4, out var fs)) { tf.perfDict[f4] = fs = new TriggerFunc { f = f4 } } ; r1[i] = fs; } return(r1); } }
/// <summary> /// Sets (reuses) a previously specified scope. /// </summary> /// <remarks> /// Example in class help. /// </remarks> /// <param name="scope">The return value of function <b>Window</b>, <b>NotWindow</b>, <b>Windows</b> or <b>NotWindows</b>.</param> public void Again(TriggerScope scope) => Current = scope;
/// <summary> /// Sets scope "all windows" again. Hotkey, autotext and mouse triggers added afterwards will work with all windows. /// </summary> /// <remarks> /// Example in class help. /// </remarks> public void AllWindows() => Current = null;