gpt4 book ai didi

c# - 暂停窗口 wpf 应用程序

转载 作者:太空宇宙 更新时间:2023-11-03 11:04:14 25 4
gpt4 key购买 nike

我想在没有启动鼠标操作并且光标在 10 秒内没有移动时播放视频。我试过这段代码:

private void dispatcherTimer_Tick(object sender, EventArgs e)
{
Test t = new Test();
t.Show();
}

public void declencher() {
try
{
while (Mouse.Captured != null)
{
dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 12);
dispatcherTimer.Start();
MessageBox.Show("hhh");
}
}
catch { }


}

我想知道如何在 WPF 中测试这种情况以及最好的方法是什么

最佳答案

检查这段代码

 if (button1.Content.Equals("Play"))
{
button1.Content = "Pause";
mediaElement1.Play();
}
else
{
button1.Content = "Play";
mediaElement1.Pause();
}

关于c# - 暂停窗口 wpf 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16517459/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com