/// <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. The Parameter /// property is typically used to configure the page.</param> protected override void OnNavigatedTo(NavigationEventArgs e) { t_from_testcommon tf = (t_from_testcommon)e.Parameter; //getting data from test_info_common testname = tf.testname; soiltype = tf.soiltype; landcovered = tf.landcovered; season = tf.season; temp_c = tf.temp_c; humidity = tf.humidity; }
private async void soil_test_commom_cont_button_Click(object sender, RoutedEventArgs e) { try { //checking weather test name already exists or not : start SQLiteConnection conn = new SQLiteConnection(Class1.dbPath); conn.CreateTable <testdata>(); var query = conn.Table <testdata>(); string testname = "Ntej"; foreach (var v5 in query) { if (testname_box.Text == v5.testname) { testname = v5.testname; } } if (testname == testname_box.Text) //if { MessageDialog msg = new MessageDialog("The testname you typed already exists, please choose aother", "Sorry"); await msg.ShowAsync(); } //checking weather test name already exists or not : end else { //string theURI = "http://free.worldweatheronline.com/feed/weather.ashx?q=" + lat + "," + longi + "&format=json&num_of_days=2&key=5e02e86375070423131001"; if (testname_box.Text != "" && soil_type_combo.SelectedIndex != -1 && land_covered_box.Text != "" && season_box.SelectedIndex != -1) //else --> if { t_from_testcommon tf = new t_from_testcommon() { testname = testname_box.Text, soiltype = soil_type_combo.SelectedIndex, landcovered = land_covered_box.Text, season = season_box.SelectedIndex, temp_c = present_weat_block.Text, humidity = humidity_block_txt_Copy.Text }; if (Internet_notifier.Text != "") //else --> if --> if { present_weat_block.Text = ""; humidity_block_txt_Copy.Text = ""; windspeed_block_txt_Copy.Text = ""; visibility_block_txt_Copy.Text = ""; cloud_cover_block_txt_Copy.Text = ""; pricip_block_txt_copy.Text = ""; pree_block_txt_copy.Text = ""; var md = new MessageDialog("Are you sure you want to continue without weather condition results?"); md.Commands.Add(new UICommand("Yes", (UICommandInvokedHandler) => { this.Frame.Navigate(typeof(soiltestOptions), tf); })); md.Commands.Add(new UICommand("Recheck Internet Connection", (UICommandInvokedHandler) => { if (IsConnectedToInternet()) //else --> if --> if --> if { Internet_notifier.Text = ""; Getcoordinates(place, zip); //calling this method to set lat , longi and location values //Debug.WriteLine(location); // GetjasonValues(lat.ToString(), longi.ToString()); } else { present_weat_block.Text = ""; humidity_block_txt_Copy.Text = ""; windspeed_block_txt_Copy.Text = ""; visibility_block_txt_Copy.Text = ""; cloud_cover_block_txt_Copy.Text = ""; pricip_block_txt_copy.Text = ""; pree_block_txt_copy.Text = ""; } })); await md.ShowAsync(); } else { this.Frame.Navigate(typeof(soiltestOptions), tf); } } else { MessageDialog msg = new MessageDialog("Missed some fields, please enter them to continue", "Error"); await msg.ShowAsync(); } } } catch { //exception handling } }