0
在下面的代碼中,我希望在提取某些數據之前顯示狀態消息,而不顯示填充該數據的對話框,直到完成數據提取。但是在數據到達之前,對話框會顯示出來。ui任務未按預期工作
我在做什麼錯?
乾杯,
Berryl
ProjectSelectionViewModel vm = null;
SetStatus("Fetching data...");
var task = Task.Factory.StartNew(() =>
{
vm = presentationFactory.GetProjectSelectionViewModel();
}
);
task.ContinueWith(t => SetStatus("Finished!!!"), TaskScheduler.FromCurrentSynchronizationContext());
var userAction = uiService.ShowDialog(Strings.ViewKey_ProjectPicker, vm);
// etc.
您在延續的意思(類似task.ContinueWith(T => _ onFetchFinished(VM),...),或在創建任務的(像Task.Factory.StartNew(()=> _ fetch(),()=> _ onFetchFinished(vm)。你能抓出一些快速而髒的代碼嗎? – Berryl 2010-07-01 00:09:29