扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:刘彦青 来源:yesky 2007年11月14日
关键字:
图1 |
AxAgent.Characters.Load("Genie",(object)"C:/Windows/Msagent/chars/GENIE.acs"); Character = AxAgent.Characters["Genie"]; file://将语言设置为美国英语 Character.LanguageID = 0x409; file://该行代码显示角色 Character.Show(null); |
using System; using System.Drawing; using System.WinForms; using AgentObjects; public class Hello: Form { private System.ComponentModel.Container components; private System.WinForms.Button button2; private System.WinForms.Button button1; private System.WinForms.TextBox textBox1; private AxAgentObjects.AxAgent AxAgent; private IAgentCtlCharacterEx Character; public Hello() { InitializeComponent(); } public static void Main(string[] args) { Application.Run(new Hello()); } private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.button1 = new System.WinForms.Button(); this.button2 = new System.WinForms.Button(); this.textBox1 = new System.WinForms.TextBox(); this.AxAgent = new AxAgentObjects.AxAgent(); AxAgent.BeginInit(); button2.Click += new System.EventHandler(button2_Click); button1.Location = new System.Drawing.Point(88, 208); button1.BackColor = (System.Drawing.Color)System.Drawing.Color.FromARGB((byte)255, (byte)128, (byte)128); button1.Size = new System.Drawing.Size(152, 32); button1.TabIndex = 1; button1.Text = "Load character"; button2.Location = new System.Drawing.Point(120, 240); button2.BackColor = (System.Drawing.Color)System.Drawing.Color.FromARGB((byte)255, (byte)128, (byte)128); button2.Size = new System.Drawing.Size(96, 24); button2.TabIndex = 2; button2.Text = "SPEAK"; textBox1.Location = new System.Drawing.Point(48, 8); textBox1.Text = " "; textBox1.Multiline = true; textBox1.TabIndex = 0; textBox1.Size = new System.Drawing.Size(248, 200); textBox1.BackColor = (System.Drawing.Color)System.Drawing.Color.FromARGB((byte)255, (byte)128, (byte)128); this.Text = "MSAGENT DEMO"; this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.WindowState = System.WinForms.FormWindowState.Maximized; this.BackColor = (System.Drawing.Color)System.Drawing.Color.FromARGB((byte)255, (byte)192, (byte)192); this.ClientSize = new System.Drawing.Size(344, 301); this.Controls.Add(button2); this.Controls.Add(button1); this.Controls.Add(textBox1); this.Controls.Add(AxAgent); button1.Click += new System.EventHandler(button1_Click); AxAgent.EndInit(); } protected void button2_Click(object sender, System.EventArgs e) { if(textBox1.Text.Length == 0) return; Character.Speak(textBox1.Text, null); } protected void button1_Click(object sender, System.EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.AddExtension = true; openFileDialog.Filter = "Microsoft Agent Characters (*.acs)|*.acs"; openFileDialog.FilterIndex = 1 ; openFileDialog.RestoreDirectory = true ; if(openFileDialog.ShowDialog() != DialogResult.OK) return; try { AxAgent.Characters.Unload("CharacterID"); } catch { } AxAgent.Characters.Load("CharacterID", (object)openFileDialog.FileName); Character = AxAgent.Characters["CharacterID"]; Character.LanguageID = 0x409; Character.Show(null); Character.Play ("announce"); Character.Speak ("welcome you sir",null); } } |
图2 |
图3 |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者