Ejemplo n.º 1
0
        private void doChatting()
        {
            idleControl.Stop();
            string output = "";

            presentLine++;
            string cleanInputText = inputBox.Text.Trim('\n');

            output = pi.chatWithPrelude(cleanInputText);
            outputBox.AppendText("You: \t" + cleanInputText);
            GoToLineAndColumn(outputBox, presentLine, 0);
            outputBox.SelectionColor = Color.Orange;
            outputBox.AppendText("\n");
            presentLine++;
            if (Character != null && lastAgent != "")
            {
                outputBox.AppendText(Character.Name + ": \t" + output);
            }
            else
            {
                outputBox.AppendText("CPU: \t" + output);
            }
            GoToLineAndColumn(outputBox, presentLine, 0);
            outputBox.SelectionColor = Color.Blue;
            outputBox.AppendText("\n");
            outputBox.Focus();
            inputBox.Text = "";
            inputBox.Focus();
            try
            {
                if (this.Character != null && enabledAgent == true)
                {
                    charReq = this.Character.Speak(output, null);
                }
            }
            catch (System.Exception e)
            {
                MessageBox.Show("Error occured: " + e.ToString());
            }
            idleControl.Start();
        }
Ejemplo n.º 2
0
 private void doChatting()
 {
     idleControl.Stop();
      	string output = "";
      	presentLine++;
     string cleanInputText = inputBox.Text.Trim('\n');
     output = pi.chatWithPrelude(cleanInputText);
     outputBox.AppendText("You: \t" + cleanInputText);
     GoToLineAndColumn(outputBox, presentLine, 0);
     outputBox.SelectionColor = Color.Orange;
     outputBox.AppendText("\n");
     presentLine++;
     if(Character != null && lastAgent != "")
         outputBox.AppendText(Character.Name + ": \t" + output);
     else
         outputBox.AppendText("CPU: \t" + output);
     GoToLineAndColumn(outputBox, presentLine, 0);
     outputBox.SelectionColor = Color.Blue;
     outputBox.AppendText("\n");
     outputBox.Focus();
     inputBox.Text   = "";
     inputBox.Focus();
     try
     {
         if(this.Character != null && enabledAgent == true)
         {
             charReq = this.Character.Speak(output, null);
         }
     }
     catch(System.Exception e)
     {
         MessageBox.Show("Error occured: " + e.ToString());
     }
     idleControl.Start();
 }