/// <summary> /// Clear all routes, stops, and recents /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ResetBtn_Click(object sender, RoutedEventArgs e) { // Assure the user didn't misclick MessageBoxResult mbr = MessageBox.Show("This will remove all of this app's local transit data", "Are you sure?", MessageBoxButton.OKCancel); if (mbr != MessageBoxResult.OK) { return; } // Clear everything AppSettings.KnownStops.Value = new Dictionary <string, BusStop>(); AppSettings.KnownRoutes.Value = new Dictionary <string, BusRoute>(); AppSettings.RecentIds.Value = new LinkedList <string>(); AppSettings.AlarmThresholds.Reset(); // Save changes AppSettings.KnownRoutes.Save(); AppSettings.KnownStops.Save(); AppSettings.RecentIds.Save(); AppSettings.AlarmThresholds.Save(); // Change numbers this.ViewModel.NotifyNums(); PanoVM.Instance.UpdateSuggestions(); RecentStopsQueue.Refresh(); }
/// <summary> /// Restore files from skydrive /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void RestoreBtn_Click(object sender, RoutedEventArgs e) { if (!TransitLoader.InternetAvailable()) { return; } ProgressIndicatorHelper.Instance.Push(LoadingEnum.Downloading); this.ViewModel.LiveButtonEnabled = false; try { await CloudStorage.RestoreFromSkydrive(); ProgressIndicatorHelper.Instance.Remove(LoadingEnum.Downloading); this.ViewModel.NotifyNums(); RecentStopsQueue.Refresh(); await TransitInfo.RefreshRouteIDsAsync(); PanoVM.Instance.UpdateSuggestions(); MessageBox.Show("Downloaded all stops and routes from Skydrive to local storage", "Success", MessageBoxButton.OK); } catch (Exception exc) { ProgressIndicatorHelper.Instance.Remove(LoadingEnum.Downloading); MessageBox.Show(exc.Message, "An error occured", MessageBoxButton.OK); } finally { this.ViewModel.LiveButtonEnabled = true; } }