using System.Windows.Threading;
using System.Threading;
using System.Threading;
private void btnPlay01_Click(object sender, RoutedEventArgs e)
{
ThreadStart start1 = new ThreadStart(Thread1);
Thread t1 = new Thread(start1);
t1.Start();
}
{
ThreadStart start1 = new ThreadStart(Thread1);
Thread t1 = new Thread(start1);
t1.Start();
}
public void Thread1()
{
int x = 0;
do
{
x++;
Thread.Sleep(100);
Dispatcher.Invoke(DispatcherPriority.Send, new Action(delegate
{
lbl01.Content = String.Format("Thread 1 running: {0}", x);
}));
}while (x < 50);
}
No comments:
Post a Comment