| 1234567891011121314151617181920212223242526272829303132333435363738 |
- 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);
- }
- /// <summary>
- /// 安全刷新界面控件 当为子线程时委托刷新界面
- /// </summary>
- /// <param name="control"></param>
- /// <param name="action"></param>
- public static void SafeRefreshControl(this System.Windows.Forms.Control control, Action action)
- {
- if (control.InvokeRequired)
- control.Invoke(action);
- else
- action();
- }
- }
- }
|