public static Action <RecognitionResult> OpenForm(Form F, string Reply = null) { Action <RecognitionResult> Outcome; if (F != null) { if (!String.IsNullOrEmpty(Reply)) { Outcome = delegate(RecognitionResult r) { AnimaEventArgs e = new AnimaEventArgs(F); AnimaCentral.SendUpdate(e); Anima.Core.AnimaCentral.Speak(Reply); }; } else { Outcome = delegate(RecognitionResult r) { AnimaEventArgs e = new AnimaEventArgs(F); AnimaCentral.SendUpdate(e); }; } return(Outcome); } throw new Exception("Error creating Command"); }
public static void SendUpdate(AnimaEventArgs e) { EventHandler <AnimaEventArgs> handler = AnimaCentral.AnimaUpdate; if (handler != null) { ISynchronizeInvoke target = handler.Target as ISynchronizeInvoke; if (target != null && target.InvokeRequired) { target.Invoke(handler, new object[] { null, e }); } else { handler(null, e); } } }