using System; using System.Collections.Generic; using System.Linq; using System.Speech.Synthesis; using System.Text; namespace Core.StlMes.Client.Mcp.Mch.Mcms { public static class Comm { public static void Speak(this string msg) { SpeechSynthesizer voice = new SpeechSynthesizer { Rate = 1, Volume = 100 }; voice.SpeakCompleted += (sender, args) => voice.Dispose(); //设置语速,[-10,10] //设置音量,[0,100] voice.SpeakAsync(msg); } /// /// 安全刷新界面控件 当为子线程时委托刷新界面 /// /// /// public static void SafeRefreshControl(this System.Windows.Forms.Control control, Action action) { if (control.InvokeRequired) control.Invoke(action); else action(); } } }