예제 #1
0
 /// <summary>
 /// This will load the configuration from the TextBoxes
 /// </summary>
 private void UpdateConfiguration_Click(object sender, EventArgs e)
 {
     ResultsDisplay.AppendText(Environment.NewLine + "Updating configuration Information." + Environment.NewLine);
     if (!string.IsNullOrEmpty(WeatherServiceURLInput.Text))
     {
         _weather.APIConfiguration.WeatherAPIURI = WeatherServiceURLInput.Text;
     }
     if (!string.IsNullOrEmpty(APIKeyInput.Text))
     {
         _weather.APIConfiguration.APIKey = APIKeyInput.Text;
     }
     if (!string.IsNullOrEmpty(SaveFileLocationInput.Text))
     {
         _weather.APIConfiguration.SaveFileLocation = SaveFileLocationInput.Text;
     }
     if (!string.IsNullOrEmpty(ZipCodeInput.Text))
     {
         _weather.APIConfiguration.ZipInformationLocation = ZipCodeInput.Text;
     }
 }
예제 #2
0
        public void MakeBasicWebCall(string zipCode)
        {
            ResultsDisplay.Text = $"Making a simple call to weather based on zip{Environment.NewLine}";

            CurrentWeather now = _weather.GetWeatherObjectByZipAsync(zipCode, "").GetAwaiter().GetResult();

            if (now.Cod == "200")
            {
                ResultsDisplay.AppendText($"Result set successful {Environment.NewLine}");
                ResultsDisplay.AppendText($"Retrieval Time:  {now.RetrievalTime.ToLongDateString()}{Environment.NewLine}");
                ResultsDisplay.AppendText($"Condition:  {now.Condition}{Environment.NewLine}");
                ResultsDisplay.AppendText($"Pressure:  {now.Pressure}{Environment.NewLine}");
                ResultsDisplay.AppendText($"WindDirection:  {now.WindDirection}{Environment.NewLine}");
                ResultsDisplay.AppendText($"WindSpeed:  {now.WindSpeed}{Environment.NewLine}");
                ResultsDisplay.AppendText($"Humidity:  {now.Humidity}%{Environment.NewLine}");
                ResultsDisplay.AppendText(now.CreateLogLine() + Environment.NewLine);
            }
            else
            {
                ResultsDisplay.AppendText($"There was an error attempting to connect to the service: {Environment.NewLine} Code: {now.Cod}{Environment.NewLine}Message: {now.Message}{now.ErrorMessage}");
            }
        }
예제 #3
0
 private void StopMultipleTimers_Click(object sender, EventArgs e)
 {
     ResultsDisplay.AppendText(Environment.NewLine + "Stopping Timers");
     _weather.StopTimers();
 }