Below is the code to use thread in c# and WPF for responsive UI.
void Main()
{
ThreadStart ts = new ThreadStart(Test);
Thread th = new Thread(ts);
th.IsBackground = true;
th.Priority = ThreadPriority.Lowest;
th.Start();
}
void Test()
{
//TODO lengthy work
}
void Main()
{
ThreadStart ts = new ThreadStart(Test);
Thread th = new Thread(ts);
th.IsBackground = true;
th.Priority = ThreadPriority.Lowest;
th.Start();
}
void Test()
{
//TODO lengthy work
}
No comments:
Post a Comment