void UpdateQueryResults(AutoCompleteBox box, Task<object[]> task, CancellationToken token) { VerifyAccess(); // // Last chance for cancellation... after this, we know we won't get canceled because cancellation can // only happen on this thread. // if (task.Status != TaskStatus.RanToCompletion || token.IsCancellationRequested) { return; } box.ItemsSource = task.Result; box.PopulateComplete(); }