Ejemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();
            
            EQInfo_label1.Text = "";
            EQInfo_label2.Text = "";
            EQInfo_label3.Text = "";
            EQInfo_label4.Text = "";
            Today_label.Text = "Today: " + DateTime.Now.ToString("dd.MMMM");
            my_dyn_loc_label1.Text = "";
            location_linkLabel1.Text = "";

            // A list for the quakes
            eq_list = new List<EQ_ListData>();
            userLocationJSON = new UserLocation();
            
            try
            {
                // Get user location data from the interweb
                userLocation = userLocationJSON._download_serialized_json_data<UserLocation>("http://ipinfo.io/json");
                // Get the quake data from the interweb
                eq_data = new EQ_Data();
            }
            catch (WebException e)
            {
                Console.WriteLine(e.Message);
                MessageBox.Show("No interweb. Me need interweb to work.", "Copmuter says no!", MessageBoxButtons.OK);
                // Disable the button if there's no internet connection.
                Get_button.Enabled = false;
                
            }

            // Display the user location.
            my_dyn_loc_label1.Text = "You are in "+ userLocation.city;

        }