}     // end of method cboWeatherProviders_SelectedValueChanged

        #endregion

        private void btnSearch_Click(object sender, EventArgs e)
        {
            if (btnSearch.Image == null)
            {
                string loadingImage = $@"{AppDomain.CurrentDomain.BaseDirectory}res\assets\img\icons\ajax-loader.gif";
                btnSearch.Image = Image.FromFile(loadingImage);
                btnSearch.Text  = "Searching...";

                searchCity.Clear(); // clear any previous searches
                searchCity.Append(cboLocation.Text);

                if (searchCity.ToString().Trim().Length > 0 &&
                    !UtilityMethod.IsKnownCity(searchCity.ToString()))
                {
                    // ignore anything that comes after a comma
                    if (searchCity.ToString().Contains(","))
                    {
                        searchCity.Remove(searchCity.ToString().IndexOf(","),
                                          searchCity.Length - searchCity.ToString().IndexOf(","));
                    }// end of if block

                    UtilityMethod.FindGeoNamesCity(searchCity.ToString(), frmPreference);
                } // end of if block
            }     // end of if block
        }         // end of method btnSearch_Click
Exemplo n.º 2
0
        }// end of one-argument constructor

        protected void DoInBackground()
        {
            if (city.Trim().Length > 0 &&
                !UtilityMethod.IsKnownCity(city))
            {
                UtilityMethod.FindGeoNamesCity(city, null);
                Thread.Sleep(2000); // Wait 2 seconds for the CityDataService thread to be complete.
                StoreNewLocationLocally();
            }// end of if block

            log = $"{city} was successfully saved to local storage.";
            Done();
        }// end of method DoInBackground