0
我想更新函數開始處的忙指示符。 僅當功能完成時才執行綁定。綁定WPF不立即執行
private async void DoJob()
{
await Task.Run(() => SetBusyIndicatorState(true));
var res = await (LongFunction());
...
await Task.Run(() => SetBusyIndicatorState(false));
}
private void SetBusyIndicatorState(bool state)
{
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
{
RadBusyIndicatorLoad.IsBusy = state;
}));
}
當我執行該功能我沒有看到繁忙指示符,因爲結合在端執行(等待Task.Run(()=> SetBusyIndicatorState(假));) – leapold