在执行操作(启用应用程序栏按钮)之前,我需要在我的应用程序中快速暂停,但我不确定如何最好地完成此操作。基本上很多处理都发生在另一个线程中,但随后 UI 被更新。更新 UI 后,我将枢轴控件滚动到特定的枢轴项。在允许启用应用程序栏按钮之前,我想暂停大约 1 秒钟,或者无论滚动到枢轴控件中的上一个枢轴项需要多长时间。我怎么能做到这一点?到目前为止我所拥有的如下
// Show image and scroll to start page if needed
if (Viewport != null)
{
Viewport.Source = result;
if (editPagePivotControl != null && editPagePivotControl.SelectedIndex != 0)
{
//Here is where the pivot control is told to move to the first item
// (from the second which it will be on before this happens)
editPagePivotControl.SelectedIndex = 0;
}
//A flag to determine whether the app bar button should be enabled
//How to pause for the time it takes to finish moving
// to the first pivot item?
if (_wasEdited)
((ApplicationBarIconButton)ApplicationBar.Buttons[0]).IsEnabled = true;
}