Ejemplo n.º 1
0
        private void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            object[]         state    = (object[])e.Argument;
            FrameworkElement list     = (FrameworkElement)state[0];
            Uri         uri           = (Uri)state[1];
            CallType    typeOf        = (CallType)state[2];
            ProgressBar myProgressBar = (ProgressBar)state[3];

            CurrentWeatherGetter cwg = new CurrentWeatherGetter(list, typeOf, myProgressBar);

            cwg.TryGetWeather(uri);
        }
Ejemplo n.º 2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (!NetworkInterface.GetIsNetworkAvailable())
            {
                MessageBox.Show("There is currently no network information available. No weather data will be displayed.", "No network connection", MessageBoxButton.OK);
                return;
            }

            if (AddCityTextBox.Text != string.Empty)
            {
                ProgressBar.Visibility = System.Windows.Visibility.Visible;
                string s = AddCityTextBox.Text.Replace(" ", "%20");
                myGetter.TryGetWeather(new Uri("http://autocomplete.wunderground.com/aq?query=" + s + "&format=JSON"));
            }
        }