LblStatus.Content = "正在获取数据..."; BtnGetWeatherRegion.IsEnabled = false; try { var threadDelegate = new ThreadStart(delegate { //异步处理的逻辑代码 listAllRegion = GetRegionLevel1(); //Winform中用Invoke()方法 Dispatcher.Invoke(new MethodInvoker(() => { //异步处理完成之后,回调主线程的控件显示处理状态 LvRegion.ItemsSource = listAllRegion; LblStatus.Content = "数据获取完成,总记录行数:" + listAllRegion.Count; BtnGetWeatherRegion.IsEnabled = true; BtnWeatherRegionSql.IsEnabled = true; })); }); new Thread(threadDelegate).Start(); } catch (Exception ex) { LblStatus.Content = "数据获取失败:" + ex.Message; BtnGetWeatherRegion.IsEnabled = true; }