void MarketDistribute() { if (!CanStart()) { return; } var control = new DistributeControl(); var vm = new DistributeViewModel() { IsBusy = true }; control.DataContext = vm; OpenView("Distribute Market(" + ProcessMode.ToString() + "):" + GetHeader(), control); Task.Factory.StartNew(() => { try { Save(); var ml = TargetObject.GetMarketDataList(); var dl = TargetObject.GetDistributeByMarket(ml); var tl = TargetObject.GetDistributeTrendByMarket(ml); App.Current.Dispatcher.Invoke(() => { vm.LoadData(dl, tl); }); } catch (Exception ex) { LogSupport.Error(ex); } }).ContinueWith((t) => { vm.IsBusy = false; }); }