我的WPF应用程序中有一些MediaElements
如果我调用Question1_5.Play();
,则Timer_activated.Play();
不能按时播放(该音频在调用Play()方法后播放5-6秒)。
出什么问题了?
private void NewGame_MouseLeftButtonDown(object sender,
MouseButtonEventArgs e) {
Dispatcher.BeginInvoke((Action)(() => Windows.SelectedItem = Game));
Questions1_5.Play();
sb = FindResource("TimerAppear") as Storyboard;
sb.Begin();
sb.Pause();
timer = new DispatcherTimer();
timer.Tick += new EventHandler(timer_Tick);
timer.Interval = new TimeSpan(0, 0, 4);
timer.Start();
}
private void timer_Tick(object sender, EventArgs e) {
Timer_activated.Play();
sb.Resume();
sb = FindResource("Seconds15") as Storyboard;
timer.Stop();
}