预览
代码
手机端效果
demoTTS.cs
demoTTS.Designer.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smobiler.Core;
using Smobiler.Core.Controls;
namespace Smobiler.Tutorials.Plugins
{
partial class demoTTS : Smobiler.Core.Controls.MobileForm
{
public demoTTS() : base()
{
//This call is required by the SmobilerForm.
InitializeComponent();
}
private void title1_ImagePress(object sender, EventArgs e)
{
this.Close();
}
private void button1_Press(object sender, EventArgs e)
{
tts1.Speak("播放成功与否,成功回调在播放完成后返回 This call is required by the SmobilerForm.", Smobiler.Plugins.TTS.TTSLanguage.zh, 1.5f, (obj, args) =>
{
if (args.isError == true)
this.Toast("Error: " + args.error);
else
this.Toast("成功");
});
}
private void button2_Press(object sender, EventArgs e)
{
tts1.Stop((obj, args) =>
{
if (args.isError == true)
this.Toast("Error: " + args.error);
else
this.Toast("成功");
});
}
private void button3_Press(object sender, EventArgs e)
{
tts1.Speak("This call is required by the SmobilerForm.", Smobiler.Plugins.TTS.TTSLanguage.en, 1, (obj, args) =>
{
if (args.isError == true)
this.Toast("Error: " + args.error);
else
this.Toast("成功");
});
}
}
}
using System;
using Smobiler.Core;
namespace Smobiler.Tutorials.Plugins
{
partial class demoTTS : Smobiler.Core.Controls.MobileForm
{
#region "SmobilerForm generated code "
//SmobilerForm overrides dispose to clean up the component list.
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
//NOTE: The following procedure is required by the SmobilerForm
//It can be modified using the SmobilerForm.
//Do not modify it using the code editor.
[System.Diagnostics.DebuggerStepThrough()]
private void InitializeComponent()
{
this.title1 = new Smobiler.Core.Controls.Title();
this.tts1 = new Smobiler.Plugins.TTS.TTS();
this.button1 = new Smobiler.Core.Controls.Button();
this.button2 = new Smobiler.Core.Controls.Button();
this.button3 = new Smobiler.Core.Controls.Button();
//
// title1
//
this.title1.ImageType = Smobiler.Core.Controls.ImageEx.ImageStyle.FontIcon;
this.title1.Name = "title1";
this.title1.ResourceID = "angle-left";
this.title1.Size = new System.Drawing.Size(300, 30);
this.title1.Text = "TTS";
this.title1.ImagePress += new System.EventHandler(this.title1_ImagePress);
//
// tts1
//
this.tts1.Name = "tts1";
//
// button1
//
this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(229)))), ((int)(((byte)(100)))));
this.button1.FontSize = 15F;
this.button1.Location = new System.Drawing.Point(75, 69);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(119, 32);
this.button1.Text = "中文 1.5倍";
this.button1.Press += new System.EventHandler(this.button1_Press);
//
// button2
//
this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(67)))), ((int)(((byte)(80)))));
this.button2.FontSize = 15F;
this.button2.Location = new System.Drawing.Point(75, 185);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(119, 29);
this.button2.Text = "stop";
this.button2.Press += new System.EventHandler(this.button2_Press);
//
// button3
//
this.button3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(192)))), ((int)(((byte)(80)))));
this.button3.FontSize = 15F;
this.button3.Location = new System.Drawing.Point(75, 126);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(119, 29);
this.button3.Text = "英文 正常速";
this.button3.Press += new System.EventHandler(this.button3_Press);
//
// demoTTS
//
this.Components.AddRange(new Smobiler.Core.Controls.MobileComponent[] {
this.tts1});
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.title1,
this.button1,
this.button2,
this.button3});
this.Name = "demoTTS";
}
#endregion
private Core.Controls.Title title1;
private Smobiler.Plugins.TTS.TTS tts1;
private Core.Controls.Button button1;
private Core.Controls.Button button2;
private Core.Controls.Button button3;
}
}