Beispiel #1
0
 private void LoadAgent(string pathToAcsFile)
 {
     try { axAgent1.Characters.Unload("CharacterID"); }
     catch { }
     try
     {
         SetLastAgent(pathToAcsFile);
         axAgent1.Characters.Load("CharacterID", (object)pathToAcsFile);
         Character = axAgent1.Characters["CharacterID"];
         Character.Show(null);
         Character.Balloon.Style = 0;
         Character.Left          = Convert.ToInt16(this.Right);
         //Character.Left = Convert.ToInt16(right - Character.Width);
         Character.Top = Convert.ToInt16(this.bottom);
         //Character.Top = Convert.ToInt16(bottom + Character.Height);
         //
         Character.Speak("Hello, i wanna chat with you", null);
         enabledAgent = true;
         if (pi != null)
         {
             pi.isSpeaking = false;
         }
         //menuSettingsSpeak.Checked = false;
         statusBar.Text = "Loaded MsAgent: " + Character.Name;
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("Uh uh, i encountered an error: " + ex.ToString());
     }
 }
Beispiel #2
0
        private void frmAgent_Load(object sender, EventArgs e)
        {
            // acsPath
            String acsPath = System.Configuration.ConfigurationSettings.AppSettings["acsPath"];
            // agentName
            String agentName = System.Configuration.ConfigurationSettings.AppSettings["agentName"];

            // load agent
            this.axAgent.Characters.Load(agentName, acsPath);
            Character = axAgent.Characters[agentName];
            Character.LanguageID = 0x409;
            Character.Show(null);
        }
Beispiel #3
0
        public AgentController(AxAgentObjects.AxAgent agentHost, string character)
        {
            agentHost.Characters.Load(character, null);
            agentChar = agentHost.Characters[character];

            characterName = character;

            //You could put your own options in this menu, if desired.
            agentChar.AutoPopupMenu = false;

            //Set balloon style.
            agentChar.Balloon.Style = agentChar.Balloon.Style | BalloonOn;
            agentChar.Balloon.Style = agentChar.Balloon.Style | SizeToText;
            agentChar.Balloon.Style = agentChar.Balloon.Style | AutoHide;
        }
		public AgentController(AxAgentObjects.AxAgent agentHost, 
			string character)
		{
			agentHost.Characters.Load(character, null);
			agentChar = agentHost.Characters[character];

			characterName = character;

			// You could put your own options in this menu, if desired.
			agentChar.AutoPopupMenu = false;

			// Set balloon style.
			agentChar.Balloon.Style = agentChar.Balloon.Style | BalloonOn;
			agentChar.Balloon.Style = agentChar.Balloon.Style | SizeToText;
			agentChar.Balloon.Style = agentChar.Balloon.Style | AutoHide;		
		}
Beispiel #5
0
 private void cmbCharacter_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     if (loaded)
     {
         agentHost.Characters.Unload("Character");
     }
     settings.SelectedCharacter = (string)cmbCharacter.SelectedItem;
     agentHost.Characters.Load("Character", settings.SelectedCharacter + ".acs");
     agent = agentHost.Characters["Character"];
     agent.Commands.Add("Show Options", "Show Options", "Show Options", true, true);
     agent.Show(null);
     agent.MoveTo((short)settings.Location.X, (short)settings.Location.Y, null);
     animations = new ArrayList();
     foreach (string name in agent.AnimationNames)
     {
         if (name.ToLower() != "hide")
         {
             animations.Add(name);
         }
     }
     if (!loaded)
     {
         if (agent.TTSModeID == null || agent.TTSModeID == string.Empty)
         {
             request = agent.Speak("Hello! "
                                   + "To hear my voice, you must have the proper speech drivers installed on your system. "
                                   + "Please visit the ljArchive web site to read how to set them up.", null);
         }
         else
         {
             request = agent.Speak("Hello! "
                                   + "I can read your journal entries to you. "
                                   + "Left click on me to have me start or stop reading the current entry. "
                                   + "For more options, right click on me and select Show Options.", null);
         }
         loaded = true;
     }
 }
Beispiel #6
0
        private void frmMain_Load(object sender, System.EventArgs e)
        {
            //app path
            appPath=Application.StartupPath+@"\";	//to use from the debuger "\..\..\"

            //initialize SAPI objects
            initSAPI();

            //loading initial grammar
            SAPIGrammarFromFile("XMLActivate.xml");

            //notify user
            label1.Text="Deactivate";

            //reposition frmMain
            this.Left=(short)(Screen.GetBounds(this).Width-Width);
            this.Top=(short)(Screen.GetBounds(this).Height-Height-50);

            //loading character
            try
            {
                axAgent1.Characters.Load("agentAssistant",appPath+"merlin.acs");
                agent1=axAgent1.Characters.Character("agentAssistant");
            }
            catch
            {
                MessageBox.Show("Error loading character\nThe agent will be disabled...","Error - character");
                menuItem14.Checked=false;
            }

            //Only if agent enabled
            if (menuItem14.Checked==true)
            {
                //reposition character
                agent1.Left=(short)this.Left;
                agent1.Top=(short)this.Top;

                //show character
                agent1.Show(false);
                agent1.Play("Greet");
                agent1.Play("Explain");
                agent1.Speak("I'm under your control.","");
                agent1.Play("Acknowledge");
                agent1.Speak("just activate me when ever you want...","");
                agent1.Play("Wave");
                agent1.Hide(false);
            }

            //hide the program from the taskbar
            this.ShowInTaskbar=false;

            //Only if agent enabled
            if (menuItem14.Checked==true)
            {
                //Deactivate AutoPopupMenu, we'll use our context menu ...
                agent1.AutoPopupMenu=false;
            }
        }
Beispiel #7
0
        /// <summary>
        /// "Change character" pressed from context menu
        /// </summary>
        private void menuItem6_Click(object sender, System.EventArgs e)
        {
            if (openFileDialog1.ShowDialog()==DialogResult.OK)
            {
                //Only if agent enabled
                if (menuItem14.Checked==true)
                {
                    //unload first character
                    axAgent1.Characters.Unload("agentAssistant");
                }

                //loading new character
                try
                {
                    axAgent1.Characters.Load("agentAssistant",openFileDialog1.FileName);
                    agent1=axAgent1.Characters.Character("agentAssistant");

                    //reposition character
                    agent1.Left=(short)this.Left;
                    agent1.Top=(short)this.Top;

                    //show character
                    agent1.Show(false);
                    agent1.Play("Greet");
                    agent1.Play("Explain");
                    agent1.Speak("I'm under your control.","");
                    agent1.Play("Acknowledge");
                    agent1.Speak("just activate me when ever you want...","");

                    agent1.Play("Wave");
                    agent1.Hide(false);

                    //update context menu
                    menuItem14.Checked=true;

                    //loading initial grammar
                    SAPIGrammarFromFile("XMLActivate.xml");

                    //notify user
                    label1.Text="Deactivate";
                    label2.Text="Accuracy 0%";
                }
                catch
                {
                    MessageBox.Show("Error loading character\nThe agent will be disabled...","Error - character");
                    menuItem14.Checked=false;
                }
            }
        }