internal static async Task <Report> GenerateFromString(string savedReportString) { Report newReport = new Report(); int count = 0; string[] reportComponents = savedReportString.Split(new String[] { ":~:" }, StringSplitOptions.None); newReport.setImage(await ApplicationData.Current.LocalFolder.GetFileAsync(reportComponents[count++])); string logit = reportComponents[count++]; string latit = reportComponents[count++]; newReport.setGeolocation(logit, latit); int noTags = Int32.Parse(reportComponents[count++]); try { List <string> tags = new List <string>(); for (int i = 0; i < noTags; i++) { tags.Add(reportComponents[count++]); } newReport.setTags(tags); newReport.setDescription(reportComponents[count]); } catch (NullReferenceException) { Debug.WriteLine("Reached end of input String"); } return(newReport); }
/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. /// This parameter is typically used to configure the page.</param> protected async override void OnNavigatedTo(NavigationEventArgs e) { var geolocator = new Geolocator(); if (PositionStatus.Disabled.Equals(geolocator.LocationStatus)) { MessageDialog checkLocationServices = new MessageDialog("Location is disabled on your device. To enable location, go to Settings and select location."); await checkLocationServices.ShowAsync(); Frame.Navigate(typeof(HubPage)); } if (e == null) { return; } if (e.Parameter is StorageFile) { Debug.WriteLine("photo"); StorageFile imageFile = e.Parameter as StorageFile; report.setImage(imageFile); } else if (e.Parameter is List <String> ) { Debug.WriteLine("tags"); List <String> li = e.Parameter as List <String>; report.setTags(li); } else if (e.Parameter is String) { Debug.WriteLine("desc"); String s = e.Parameter as String; report.setDescription(s); } //water quality // else UpdatePollutionReport(); }
internal static async Task<Report> GenerateFromString(string savedReportString) { Report newReport = new Report(); int count = 0; string[] reportComponents = savedReportString.Split(new String[] { ":~:" }, StringSplitOptions.None); newReport.setImage(await ApplicationData.Current.LocalFolder.GetFileAsync(reportComponents[count++])); string logit = reportComponents[count++]; string latit = reportComponents[count++]; newReport.setGeolocation(logit, latit); int noTags = Int32.Parse(reportComponents[count++]); try { List<string> tags = new List<string>(); for (int i = 0; i < noTags; i++) { tags.Add(reportComponents[count++]); } newReport.setTags(tags); newReport.setDescription(reportComponents[count]); } catch (NullReferenceException) { Debug.WriteLine("Reached end of input String"); } return newReport; }
public void SetDescriptionTest() { Report r = new Report(); r.setDescription("A Description"); Assert.AreEqual(r.isDescriptionReady(), true); }