private async void SubmitReport_Click(object sender, RoutedEventArgs e) { // hide buttons this.SubmitButton.Visibility = Visibility.Collapsed; this.DeleteButton.Visibility = Visibility.Collapsed; // show progress ring this.processing.IsActive = true; if (await currentReport.UploadToServer()) { await currentReport.discardReport(true); await currentReportFile.DeleteAsync(StorageDeleteOption.PermanentDelete); this.processing.IsActive = false; //submit report Frame.Navigate(typeof(UnsentReportsPage)); } else { this.processing.IsActive = false; MessageDialog didNotSend = new MessageDialog("Error when attempting to send report, please try again later", "Failed to Send"); didNotSend.Commands.Add(new UICommand("OK")); await didNotSend.ShowAsync(); } }
private void ReturnButton_Click(object sender, RoutedEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; if (rootFrame != null && rootFrame.CanGoBack) { report.discardReport(true); rootFrame.Navigate(typeof(HubPage)); } }
public async Task DiscardReportTest() { String date = dt.ToString("dd_MM_yyyy_H_mm_ss"); Report r = new Report(); var localStorage = ApplicationData.Current.LocalFolder; var file = await localStorage.CreateFileAsync("RiverWatchImage_" + date + ".jpg"); r.setImage(file); while (!r.isGeolocationReady()) { await Task.Delay(2000); } r.discardReport(true); bool filePresent = await IsFilePresent("RiverWatchImage_" + date + ".jpg"); Assert.AreEqual(filePresent, false); }