private void loadHandledData() { ThreadPool.QueueUserWorkItem(delegate { Dispatcher.Invoke(new Action(delegate { UploadListUserControl.StartLoading(); DownloadListUserControl.StartLoading(); })); RetrieveDataListWorker.SendRetrieveDataListRequest( successCallback : delegate(RetrieveDataListResponse response) { Dispatcher.Invoke(new Action(delegate { foreach (var item in response.DataList) { if (item.PatientAge == null) { item.PatientAge = "未知"; } if (item.PatientName == null) { item.PatientName = "未知"; } } UploadListUserControl.FinishLoading(); DownloadListUserControl.FinishLoading(); UploadListUserControl.SetDataSource(response.DataList); DownloadListUserControl.SetDataSource(response.DataList); })); }, failureCallback : delegate(string failureReason) { Dispatcher.Invoke(new Action(delegate { DownloadListUserControl.FinishLoading(); MessageBox.Show("获取数据列表失败。" + failureReason, "", MessageBoxButton.OK, MessageBoxImage.Asterisk); })); }, errorCallback : delegate(Exception ex) { Dispatcher.Invoke(new Action(delegate { DownloadListUserControl.FinishLoading(); Util.ShowExceptionMessage(ex, "获取数据列表出错。"); })); }); }); }
private void GetOrders(RetrieveDataListRequest updateDicomDataRequest) { RetrieveDataListWorker.SendRetrieveDataListRequest( updateDicomDataRequest, successCallback : delegate(RetrieveDataListResponse response) { Dispatcher.Invoke(new Action(delegate { foreach (var item in response.DataList) { if (item.PatientAge == null) { item.PatientAge = "未知"; } if (item.PatientName == null) { item.PatientName = "未知"; } } UploadListUserControl.FinishLoading(); DownloadListUserControl.FinishLoading(); UploadListUserControl.SetDataSource(response.DataList); DownloadListUserControl.SetDataSource(response.DataList); })); Thread.Sleep(1000 * 60); GetOrders(updateDicomDataRequest); }, failureCallback : delegate(string failureReason) { Dispatcher.Invoke(new Action(delegate { MessageBox.Show("获取订单列表失败。" + failureReason, "", MessageBoxButton.OK, MessageBoxImage.Asterisk); })); }, errorCallback : delegate(Exception ex) { Dispatcher.Invoke(new Action(delegate { Util.ShowExceptionMessage(ex, "获取订单列表出错。"); })); }); }