示例屏幕截图-Spotify锁屏信息
如何在锁定屏幕上显示信息?就像Spotify一样。
编辑:可以看到问题是重复的,所以现在的问题是-Spotify如何做到这一点?
对于
Windows10。无论使用什么WPF / UWP / WinForms。
如果仅可以使用其他语言/黑客-一定要这么做。
而不是在后台工作 - 这段代码仍然冻结我的程序:
private void button_Click(object sender, RoutedEventArgs e)
{
this.Dispatcher.BeginInvoke(new Action(() =>
{
Thread.Sleep(5000);
label.Content = "Done";
}), DispatcherPriority.Normal);
}
Run Code Online (Sandbox Code Playgroud)
我试过Thread/Tasks,线程示例:
private void button_Click(object sender, RoutedEventArgs e)
{
var t = new Thread(new ThreadStart(runtask));
t.Start();
}
private void runtask()
{
this.Dispatcher.BeginInvoke(new Action(() =>
{
Thread.Sleep(5000);
label.Content = "Done";
}), DispatcherPriority.Normal);
}
Run Code Online (Sandbox Code Playgroud)
任务示例:
private void button_Click(object sender, RoutedEventArgs e)
{
Task.Run(() =>
{
Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new Action(() =>
{
Thread.Sleep(5000);
label.Content = "Done";
}));
});
}
Run Code Online (Sandbox Code Playgroud)
我的节目仍然冻结.有什么建议?