public void LoadData() { if (NetworkInterface.GetIsNetworkAvailable()) { IScheduler scheduler = Scheduler.Dispatcher; scheduler.Schedule(() => { GetTwitterFeed(); GetCanucksGameFeed(); GetCanucksticketsFeed(); GetCanucksStoreFeed(); GetCanucksPromoFeed(); CheckForErrors(); }); } else { var builder = new StringBuilder(); builder.AppendLine("To update the application a network connection is required."); builder.AppendLine("The application will attempt to load saved data"); builder.AppendLine(); builder.AppendLine( "When a network connection has been re-established tap on the ellipsis at the bottom right hand corner and select ‘refresh’"); ErrorService errorService = new ErrorService(builder.ToString(), "No network connection detected") .ErrorDialog(true); errorService.HandleError(); } }
public void LoadData() { CheckPlayOff(); if (!NetworkInterface.GetIsNetworkAvailable()) { var builder = new StringBuilder(); builder.AppendLine("To update the application a network connection is required."); builder.AppendLine("The application will attempt to load saved data"); builder.AppendLine(); builder.AppendLine( "When a network connection has been re-established tap on the ellipsis at the bottom right hand corner and select ‘refresh’"); ErrorService errorService = new ErrorService(builder.ToString(), "No network connection detected") .ErrorDialog(true); errorService.HandleError(); LoadCachedData(); } else { if (IsPlayoffs) { LoadPlayoffScoresAndSchedules(); } LoadScoresAndSchedules(); IScheduler scheduler = Scheduler.Dispatcher; scheduler.Schedule(() => { GetNewsStream(); GetFeatures(); GetTwitterFeed(); GetFeedInfoItems(); CheckForErrors(); }); } }
private void CheckForErrors() { if (_errors.Count == 0) { return; } if (_errors.Count == 1) { string errorMessage = "We were unable to load: " + _errors.First(); ErrorService errorService = new ErrorService(errorMessage, "").ErrorDialog(true); errorService.HandleError(); } if (_errors.Count > 1) { string errorMessage = "We were unable to load: " + _errors.Aggregate((i, j) => i + " , " + j); ErrorService errorService = new ErrorService(errorMessage, "").ErrorDialog(true); errorService.HandleError(); } }
private async void OnDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { await ErrorService.HandleError(e.Exception, "An unhandled exception occurred", true, true); e.Handled = true; }