Esempio n. 1
0
        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 void ModuleStart()
        {
            Command LoadOrderOpen      = new Command("I would like to change the Load Order", Utilities.OpenForm(new LoadOrderManager(), "Of Course"));
            Command VoiceSelectOpen    = new Command("I would like to change your voice", Utilities.OpenForm(new Forms.VoiceSelection(), "Of Course"));
            Command ProgramOpenManager = new Command("I would like to change my program opens", Utilities.OpenForm(POM, "Of Course"));
            Command ShowCommandList    = new Command("Show the Command List", Utilities.OpenForm(new Forms.Command_List(), "Here's the commands"));

            GrammarBuilder gb = new GrammarBuilder(GooglePhrase);

            gb.AppendDictation();
            Grammar googlegrammar = new Grammar(gb);
            Command Google        = new Command(GooglePhrase + "...", googlegrammar, this.Google, 0.8);

            Command Reply = new Command("I wish to hear your voice", Utilities.GiveReply("Of course, This is my voice, The Quick Brown Fox Jumped Over The Lazy Dog"));

            AnimaCentral.RegisterCommand(LoadOrderOpen, VoiceSelectOpen, ProgramOpenManager, ShowCommandList, Google, Reply);

            //Registers existing custom Programs
            AnimaCentral.SendUpdate(new AnimaEventArgs(POM));
            POM.Show();
            POM.Hide();
        }