private async Task Update() { try { await ElementDAO.UpdateFromAPI(new Progress <int>(percent => { if (percent == -1) { UpdateProgressBar.IsIndeterminate = true; LabelStatus.Text = "Checking API status"; } else { UpdateProgressBar.IsIndeterminate = false; LabelStatus.Text = "Updating cache"; UpdateProgressBar.Value = percent; } })); } catch (WebException) { await new ContentDialog { Title = "Periodic Table", Content = "Unable to get information from server! Using from cached.", CloseButtonText = "Ok" }.ShowAsync(); } }
private async Task Update() { try { await ElementDAO.UpdateFromAPI(new Progress <int>(percent => { if (percent == -1) { UpdateProgressBar.IsIndeterminate = true; LabelStatus.Content = "Checking API status"; } else { UpdateProgressBar.IsIndeterminate = false; LabelStatus.Content = "Updating cache"; UpdateProgressBar.Value = percent; } })); } catch (WebException) { Modscleo4.WPFUI.MessageBox.Show("Unable to get information from server! Using from cached.", "Periodic Table", MessageBoxButton.OK, MessageBoxImage.Exclamation); } finally { new MainWindow().Show(); Close(); } }
private async Task Update() { try { await ElementDAO.UpdateFromAPI(); } catch (WebException) { await DisplayAlert("Periodic Table", "Unable to get information from server! Using from cached.", "Ok"); } finally { Application.Current.MainPage = new MainPage(); } }