private async void View_LoadView(object sender, EventArgs e) { view.Loading(true); try { view.ShowProducts(await Task.Run(() => api.GetProducts(args)), api); } catch (InvalidOperationException ex) { view.Message(ex.Message); } finally { view.Loading(false); } }
private void View_Cancel(object sender, EventArgs e) { view.ProgressOff(); view.Message(""); cts.Cancel(); cts = new CancellationTokenSource(); svc = new ClientService(cts.Token); view.Message("Операция отменена"); }