/// <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)
        {
            to_hardware_overview2 tf2 = (to_hardware_overview2)e.Parameter;

            testname = tf2.testname;
            temp_c   = tf2.temp_c;
            humidity = tf2.humidity;
        }
Beispiel #2
0
        private async void soil_test_commom_cont_button_Click(object sender, RoutedEventArgs e)
        {
            //try
            //{
            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 TestID you typed already exists, please choose aother", "Sorry");
                await msg.ShowAsync();
            }
            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 != "")
                {
                    to_hardware_overview2 th2 = new to_hardware_overview2()
                    {
                        testname = testname_box.Text, temp_c = present_weat_block.Text, humidity = humidity_block_txt_Copy.Text
                    };
                    if (Internet_notifier.Text != "")
                    {
                        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(hardware_details2), th2);
                        }));
                        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 and weather API
                                //Debug.WriteLine(location);
                                //GetjasonValues(theURI);
                            }
                            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(hardware_details2), th2);
                    }
                }
                else
                {
                    MessageDialog msg = new MessageDialog("Missed some fields, please enter them to continue", "Error");
                    await msg.ShowAsync();
                }
            }
            // }
            //  catch
            // {

            // }
        }