public async Task SimpleWait(IWaitingService waiter) { using (waiter.WaitBlock("Waiting ...")) { await Task.Delay(5000); } }
private static async Task CountToFive(IWaitingService waiter, Action <int> update, double maximum) { using (waiter.WaitBlock("Waiting ...", maximum)) { for (int i = 0; i < 5; i++) { update(i); await Task.Delay(1000); } } }
public async Task ConnectToSimAsync(IWaitingService wait, [FromServices] ISimulatorInterface simulator, [FromServices] Func <FlightDisplayViewModel> displayFactory) { using (wait.WaitBlock("Connecting to Simulator")) { try { await simulator.Connect(); simulator.LostConnection += NavigateToThisPage; FlightDisplay(displayFactory); } catch (Exception e) { wait.ErrorMessage = e.Message; throw; } } }