using System.Collections; using System.ComponentModel; using System.Windows.Forms;
{
/// <summary>
/// Summary description for AgentTryout.
/// </summary>
{
internal System.Windows.Forms.Button cmdClose
; internal System.Windows.Forms.GroupBox GroupBox3
; internal System.Windows.Forms.Label Label2
; internal System.Windows.Forms.Label Label1
; internal System.Windows.Forms.TextBox txtY
; internal System.Windows.Forms.TextBox txtX
; internal System.Windows.Forms.Button cmdMove
; internal System.Windows.Forms.GroupBox GroupBox2
; internal System.Windows.Forms.Button cmdSpeak
; internal System.Windows.Forms.TextBox txtSpeak
; internal System.Windows.Forms.GroupBox GroupBox1
; internal System.Windows.Forms.Button cmdStop
; internal System.Windows.Forms.Button cmdPlay
; internal System.Windows.Forms.ListBox lstAnimations
; private AxAgentObjects
.AxAgent axAgent1
; /// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components
= null;
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
{
{
{
components.Dispose();
}
}
base.Dispose( disposing
); }
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
{
System.Resources.ResourceManager resources
= new System.Resources.ResourceManager(typeof(AgentTryout
)); this.cmdClose = new System.Windows.Forms.Button(); this.GroupBox3 = new System.Windows.Forms.GroupBox(); this.Label2 = new System.Windows.Forms.Label(); this.Label1 = new System.Windows.Forms.Label(); this.txtY = new System.Windows.Forms.TextBox(); this.txtX = new System.Windows.Forms.TextBox(); this.cmdMove = new System.Windows.Forms.Button(); this.GroupBox2 = new System.Windows.Forms.GroupBox(); this.cmdSpeak = new System.Windows.Forms.Button(); this.txtSpeak = new System.Windows.Forms.TextBox(); this.GroupBox1 = new System.Windows.Forms.GroupBox(); this.axAgent1 = new AxAgentObjects
.AxAgent(); this.cmdStop = new System.Windows.Forms.Button(); this.cmdPlay = new System.Windows.Forms.Button(); this.lstAnimations = new System.Windows.Forms.ListBox(); this.GroupBox3.SuspendLayout(); this.GroupBox2.SuspendLayout(); this.GroupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.axAgent1)).BeginInit(); //
// cmdClose
//
this.cmdClose.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right); this.cmdClose.FlatStyle = System.Windows.Forms.FlatStyle.System; this.cmdClose.Location = new System.Drawing.Point(295,
331); this.cmdClose.Name = "cmdClose"; this.cmdClose.Size = new System.Drawing.Size(96,
24); this.cmdClose.TabIndex = 12; this.cmdClose.Text = "Close"; this.cmdClose.Click += new System.EventHandler(this.cmdClose_Click); //
// GroupBox3
//
this.GroupBox3.Anchor = ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right);
this.GroupBox3.Controls.AddRange(new System.Windows.Forms.Control[] { this.GroupBox3.FlatStyle = System.Windows.Forms.FlatStyle.System; this.GroupBox3.Location = new System.Drawing.Point(8,
251); this.GroupBox3.Name = "GroupBox3"; this.GroupBox3.Size = new System.Drawing.Size(384,
64); this.GroupBox3.TabIndex = 11; this.GroupBox3.Text = "Move"; //
// Label2
//
this.Label2.Location = new System.Drawing.Point(84,
28); this.Label2.Name = "Label2"; this.Label2.Size = new System.Drawing.Size(20,
16); this.Label2.TabIndex = 11; //
// Label1
//
this.Label1.Location = new System.Drawing.Point(16,
28); this.Label1.Name = "Label1"; this.Label1.Size = new System.Drawing.Size(20,
16); this.Label1.TabIndex = 10; //
// txtY
//
this.txtY.Location = new System.Drawing.Point(104,
24); this.txtY.Size = new System.Drawing.Size(36,
20); //
// txtX
//
this.txtX.Location = new System.Drawing.Point(36,
24); this.txtX.Size = new System.Drawing.Size(36,
20); //
// cmdMove
//
this.cmdMove.FlatStyle = System.Windows.Forms.FlatStyle.System; this.cmdMove.Location = new System.Drawing.Point(248,
24); this.cmdMove.Name = "cmdMove"; this.cmdMove.Size = new System.Drawing.Size(72,
20); this.cmdMove.TabIndex = 7; this.cmdMove.Text = "Move"; this.cmdMove.Click += new System.EventHandler(this.cmdMove_Click); //
// GroupBox2
//
this.GroupBox2.Anchor = ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right);
this.GroupBox2.Controls.AddRange(new System.Windows.Forms.Control[] { this.GroupBox2.FlatStyle = System.Windows.Forms.FlatStyle.System; this.GroupBox2.Location = new System.Drawing.Point(8,
163); this.GroupBox2.Name = "GroupBox2"; this.GroupBox2.Size = new System.Drawing.Size(384,
80); this.GroupBox2.TabIndex = 10; this.GroupBox2.Text = "Speak"; //
// cmdSpeak
//
this.cmdSpeak.FlatStyle = System.Windows.Forms.FlatStyle.System; this.cmdSpeak.Location = new System.Drawing.Point(248,
20); this.cmdSpeak.Name = "cmdSpeak"; this.cmdSpeak.Size = new System.Drawing.Size(72,
20); this.cmdSpeak.TabIndex = 6; this.cmdSpeak.Text = "Speak"; this.cmdSpeak.Click += new System.EventHandler(this.cmdSpeak_Click); //
// txtSpeak
//
this.txtSpeak.Location = new System.Drawing.Point(8,
20); this.txtSpeak.Name = "txtSpeak"; this.txtSpeak.Size = new System.Drawing.Size(232,
48); this.txtSpeak.TabIndex = 4; //
// GroupBox1
//
this.GroupBox1.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right);
this.GroupBox1.Controls.AddRange(new System.Windows.Forms.Control[] { this.GroupBox1.FlatStyle = System.Windows.Forms.FlatStyle.System; this.GroupBox1.Location = new System.Drawing.Point(8,
11); this.GroupBox1.Name = "GroupBox1"; this.GroupBox1.Size = new System.Drawing.Size(384,
144); this.GroupBox1.TabIndex = 9; this.GroupBox1.Text = "Animate"; //
// axAgent1
//
this.axAgent1.Location = new System.Drawing.Point(336,
32); this.axAgent1.Name = "axAgent1"; this.axAgent1.OcxState = ((System.Windows.Forms.AxHost.State)(resources
.GetObject("axAgent1.OcxState"))); this.axAgent1.Size = new System.Drawing.Size(32,
32); this.axAgent1.TabIndex = 7; //
// cmdStop
//
this.cmdStop.FlatStyle = System.Windows.Forms.FlatStyle.System; this.cmdStop.Location = new System.Drawing.Point(248,
48); this.cmdStop.Name = "cmdStop"; this.cmdStop.Size = new System.Drawing.Size(72,
20); this.cmdStop.TabIndex = 6; this.cmdStop.Text = "Stop"; this.cmdStop.Click += new System.EventHandler(this.cmdStop_Click); //
// cmdPlay
//
this.cmdPlay.FlatStyle = System.Windows.Forms.FlatStyle.System; this.cmdPlay.Location = new System.Drawing.Point(248,
24); this.cmdPlay.Name = "cmdPlay"; this.cmdPlay.Size = new System.Drawing.Size(72,
20); this.cmdPlay.TabIndex = 5; this.cmdPlay.Text = "Play"; this.cmdPlay.Click += new System.EventHandler(this.cmdPlay_Click); //
// lstAnimations
//
this.lstAnimations.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left);
this.lstAnimations.Location = new System.Drawing.Point(8,
22); this.lstAnimations.Name = "lstAnimations"; this.lstAnimations.Size = new System.Drawing.Size(232,
109); this.lstAnimations.TabIndex = 4; //
// AgentTryout
//
this.AutoScaleBaseSize = new System.Drawing.Size(5,
13); this.ClientSize = new System.Drawing.Size(400,
366); this.Controls.AddRange(new System.Windows.Forms.Control[] { this.Name = "AgentTryout"; this.Text = "AgentTryout"; this.Load += new System.EventHandler(this.AgentTryout_Load); ((System.ComponentModel.ISupportInitialize)(this.axAgent1)).EndInit();
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
{
Application
.Run(new AgentTryout
()); }
private AgentController controller
;
{
controller
= new AgentController
(axAgent1,
"Genie");
lstAnimations.DataSource=controller.GetAnimations();
controller.Show();
}
{
controller.Animate(lstAnimations.Text);
}
{
controller.StopAll();
}
{
controller.Speak(txtSpeak.Text);
}
{
controller
.MoveTo(short.Parse(txtX
.Text),
short.Parse(txtY
.Text)); }
{
}
}
}
//================================================================
//================================================================
using System.Collections;
{
{
// Agent variable.
private AgentObjects
.IAgentCtlCharacterEx agentChar
;
// Name of the initialized character.
// Balloon constants
public AgentController
(AxAgentObjects
.AxAgent agentHost,
{
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;
//agentChar.Balloon.Style = agentChar.Balloon.Style & !(AutoPace);
}
{
{
}
}
{
}
{
}
{
}
{
agentChar.Speak(text, "");
}
{
agentChar.Think(text);
}
{
agentChar.Play(animation);
}
{
agentChar
.MoveTo(x, y,
null); }
{
agentChar.GestureAt(x, y);
}
{
ArrayList list
= new ArrayList
(); {
list.Add(animation);
}
}
// Tests if the agent is visible.
// If the agent is not visible it will be shown.
{
{
}
{
}
}
}
}