求助大神——WPF多线程

 MyDataSource.Clear();
            Task.Factory.StartNew(() =>
            {                
                GridViewIsBusy = true;            
                var response = _IndoorSampleCheckHttpProxy.GetSamplesIndoorStationsByStationQueryInformation(_StationQueryInformation);
                foreach (var item in response)
                {
                    item.Number = index.ToString();
                    if (item.AjustNumber != null)
                    {
                        if (item.AjustNumber.Contains(item.OldBoxNumber))
                            item.Flag = true;
                    }
                    index++;
                }
                Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Send,new Action(delegate() 
                {
                    MyDataSource.AddRange(response);                    
                }));            
                GridViewIsBusy = false;
            });


拉丁的传说
浏览 736回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP