本文介绍了在WPF主窗口中调用方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了问题,我想打开主窗口然后我希望窗口说欢迎使用电子邮件系统。我不知道出了什么问题,它先说出来然后出现了窗口,我希望窗口出现然后说出消息



我的代码

公共部分班级MainWindow:MetroWindow

{





私人SpeechRecognitionEngine sre;

private SpeechSynthesizer synth;

public MainWindow()

{

InitializeComponent();





synth = new SpeechSynthesizer();

sre = new SpeechRecognitionEngine();

speak();

}





public void speak()

{



synth.SetOutputToDefaultAudioDevice();

synth.Speak(欢迎使用电子邮件系统);



我尝试了什么:



在同一类和calle的方法中生成对象d主窗口,没有工作

I am having a problem , I want to open main window and then i want the window to speak "welcome to email system " . I dont know what is wrong , it speaks this first and then the window appears , i want the window to appear and then say the message

my code
public partial class MainWindow : MetroWindow
{


private SpeechRecognitionEngine sre;
private SpeechSynthesizer synth;
public MainWindow()
{
InitializeComponent();


synth = new SpeechSynthesizer();
sre = new SpeechRecognitionEngine();
speak();
}


public void speak()
{

synth.SetOutputToDefaultAudioDevice();
synth.Speak("Welcome to email System");

What I have tried:

made object in the method of the same class and called the main window, didnt work

推荐答案


这篇关于在WPF主窗口中调用方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-04 04:52