コード例 #1
0
 public static void ExecuteThread()
 {
     NMTalk talk = new NMTalk(AppDomain.CurrentDomain.BaseDirectory + @"\Apps\Aer\Sounds\");
     NMDB data = new NMDB(AppDomain.CurrentDomain.BaseDirectory + @"\Apps\AER\json\");
     Personality person = new Personality(talk, data);
     _AerHandler = new NMHandler(data, person);
     _AerInput = new NMInput(AppDomain.CurrentDomain.BaseDirectory + @"\Apps\AER\Grammars\", person.GrammarLoaded_Handler);
     //Settings pluginp = new Settings(AppDomain.CurrentDomain.BaseDirectory + @"\Apps\AER\");
     while(_RunWorker)
     {
         if (_AerInput.NewInput)
         {
             _AerInput.NewInput = false;
             _AerHandler.InputHandler(_AerInput.LastResult);
         }
     }
 }
コード例 #2
0
        public void ExecuteThread()
        {
            NMDB data = new NMDB(@"json\");
            NMTalk talk = new NMTalk();

            Personality person = new Personality(talk, data);
            NMHandler handler = new NMHandler(data, person);
            //I know this is bad, but there's no good way to get the delegate surfaced out of AerInput in to AerTalk yet.
            // This could be solved with a service registry, but I haven't thought that through yet
            NMInput input = new NMInput(@"Grammars\", person.GrammarLoaded_Handler);

            while (_RunWorker)
            {
                if (input.NewInput)
                {
                    input.NewInput = false;
                    handler.InputHandler(input.LastResult);
                }
                Thread.Sleep(10); //Keep CPU usage down until we handle responses async
            }
        }