【发布时间】:2021-12-18 20:46:12
【问题描述】:
异步操作完成后,我需要将TaskDialogPage 导航到另一个。这是我的代码
TaskDialogPage page = new()
{
//...
}
TaskDialogPage completedPage = new()
{
//...
}
page.Created += async (_, _) =>
{
await DoSomethingThatTakesTime().ConfigureAwait(false);
page.Navigate(completedPage); // NotSupportedException - Illegal thread call
};
我可以使用Control.Invoke() 方法:
page.Invoke(() => page.Navigate(completedPage))
但是TaskDialogPage 不继承自Control!
【问题讨论】:
标签: c# asynchronous .net-core async-await taskdialog