private Task <bool> ShowNotificationToSend(IsolatedStorageFile store, string[] filenames) { var tcs = new TaskCompletionSource <bool>(); Scheduler.Dispatcher.Schedule(() => { NotificationTool.Show( LocalizedStrings.LocalizedResources.CrashData, LocalizedStrings.LocalizedResources.SendCrashQuestion, new NotificationAction(LocalizedStrings.LocalizedResources.Send, (Action)(async() => { tcs.TrySetResult(true); await SendCrashesAsync(store, filenames); })), new NotificationAction(LocalizedStrings.LocalizedResources.Delete, (Action)(() => { tcs.TrySetResult(false); foreach (string filename in filenames) { try { store.DeleteFile(Path.Combine(Constants.CrashDirectoryName, filename)); } catch (Exception e) { HockeyClient.Current.AsInternal().HandleInternalUnhandledException(e); } } })) ); }); return(tcs.Task); }
public void HandleCrashes() { try { IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication(); if (store.DirectoryExists(CrashDirectoryName)) { string[] filenames = store.GetFileNames(CrashDirectoryName + "\\crash*.log"); Debugger.Log(0, "HockeyApp", filenames.ToString()); if (filenames.Length > 0) { Scheduler.Dispatcher.Schedule(() => { NotificationTool.Show( "Crash Data", "The app quit unexpectedly. Would you like to send information about this to the developer?", new NotificationAction("Send", () => { SendCrashes(store, filenames); }), new NotificationAction("Delete", () => { DeleteCrashes(store, filenames); }) ); }); } } } catch (Exception) { // Ignore all exceptions } }
/// <summary> /// Starts intialization of view model. /// </summary> private void InitializeViewModeExecute() { if (!this.wasInitialization) { this.wasInitialization = true; using (var settingsRepository = new SettingsRepository()) { if (!IsolatedStorageSettings.ApplicationSettings.Contains(_firstLaunchKey)) { IsolatedStorageSettings.ApplicationSettings[_firstLaunchKey] = wasInitialization; var result = MessageBox.Show("Would you like this application to use your phone's GPS function?", "GPS", MessageBoxButton.OKCancel); var currentSettings = settingsRepository.GetCurrentSettings(); currentSettings.IsGpsEnabled = result == MessageBoxResult.OK; settingsRepository.UpdateCurrentSettings(currentSettings); } bool userAcceptedEula = false; var store = IsolatedStorageSettings.ApplicationSettings; if (store.Contains(EULA_KEY)) { userAcceptedEula = (bool)store[EULA_KEY]; } if (!userAcceptedEula) { NotificationTool.Show( "Privacy Policy", "NDG", new NotificationAction("Accept", () => { AcceptedPrivacy(); }), new NotificationAction("Decline", () => { DeclinedPrivacy(); })); } GpsTracker.Instance.GpsAllowed = settingsRepository.GetCurrentSettings().IsGpsEnabled; GpsTracker.Instance.StartTracking(); } } if (Membership.CurrentUser == null) { this.Login = string.Empty; this.Password = string.Empty; using (var settingsRepository = new SettingsRepository()) this.ServerPath = settingsRepository.GetCurrentSettings().Server.Address; } var pageParameters = NavigationProvider.GetNavigationParameters(); if (pageParameters.ContainsKey(SEVER_PATH_PARAMETER)) { this.ServerPath = pageParameters[SEVER_PATH_PARAMETER]; } }
protected void ShowUpdateNotification(Version currentVersion, IEnumerable <IAppVersion> appVersions, UpdateCheckSettings updateCheckSettings) { Scheduler.Dispatcher.Schedule(() => { NotificationTool.Show( LocalizedStrings.LocalizedResources.UpdateNotification, LocalizedStrings.LocalizedResources.UpdateAvailable, new NotificationAction(LocalizedStrings.LocalizedResources.Show, (Action)(() => { ShowVersionPopup(currentVersion, appVersions, updateCheckSettings); })), new NotificationAction(LocalizedStrings.LocalizedResources.Dismiss, (Action)(() => { //DO nothing })) ); }); }
private Task <bool> ShowNotificationToSend(IsolatedStorageFile store, string[] filenames) { var tcs = new TaskCompletionSource <bool>(); Scheduler.Dispatcher.Schedule(() => { NotificationTool.Show( SdkResources.CrashData, SdkResources.SendCrashQuestion, new NotificationAction(SdkResources.Send, () => { tcs.TrySetResult(true); SendCrashes(store, filenames); }), new NotificationAction(SdkResources.Delete, () => { tcs.TrySetResult(false); DeleteCrashes(store, filenames); }) ); }); return(tcs.Task); }