我想为 WPF 应用程序中的连续进度条分配一个新线程,以便在单击 UI 按钮后它将连续运行,直到我收到服务响应。
我做了如下代码,但进度条(MclarenServerCecksProgressBar)似乎根本不起作用
MclarenServerCecksProgressBar.Visibility = Visibility.Visible;
var uiThread = new Thread(() =>
{
progressBarDisptacher = MclarenServerCecksProgressBar.Dispatcher;
// allowing the main UI thread to proceed
System.Windows.Threading.Dispatcher.Run();
});
uiThread.SetApartmentState(ApartmentState.STA);
uiThread.IsBackground = true;
uiThread.Start();
string[] servicesss = getServices(servername,server);
DataTable dtd = esd.getListOfServices(servername, usrid.Text.ToString(),
userpass.Password.ToString(), servicesss);
MclarenServerCecksProgressBar.Visibility = Visibility.Hidden;
请安排建议我实现这一目标,任何其他指针都会有很大帮助。