private async void GoButton_Click(object sender, RoutedEventArgs e)
        {
            WeatherSoapClient proxy = new WeatherSoapClient();
            WeatherReturn result = await proxy.GetCityWeatherByZIPAsync(inputZipCode.Text);
            ForecastReturn fr = await proxy.GetCityForecastByZIPAsync(inputZipCode.Text);
            Forecast[] f = fr.ForecastResult;
            if (result.Success)
            {
                resultCityState.Text = String.Format("{0}, {1}", result.City, result.State);
                resultDetails.Text = String.Format
                    ("\n\nConditions - {0} \n\nTemperature - {1} \n\nRelative Humidity - {2} \n\nWind - {3} \n\nPressure - {4} - \n\nPressure - {5}  - \n\nWind Chill - {6}  - \n\nVisibility - {7}",

                     result.Description, result.Temperature, result.RelativeHumidity, result.Wind, result.Pressure, fr.WeatherStationCity, result.WindChill, result.Visibility);
            }

            GetWeatherInformationResponse result1 = await proxy.GetWeatherInformationAsync();
            WeatherDescription[] r = result1.GetWeatherInformationResult;
            foreach (WeatherDescription d in r)
                if (d.WeatherID == result.WeatherID)
                {
                    image i = new image();
                    i.imageurl = d.PictureURL;
                    myimage.DataContext = i;
                    break;
                }
        }
Example #2
0
 private void ButtonBase_OnClick(object sender, RoutedEventArgs e) {
    string strZip = TextBox.Text;
    var objProxy = new WeatherSoapClient("WeatherSoap");
    var city = objProxy.GetCityWeatherByZIP(strZip);//44103;
    string str = $"City:{city.City}\nTemperature:{city.Temperature}\nPressure:{city.Pressure}";
    TextBlock.Text = String.Empty;
    TextBlock.Text = str;
 }
        static void Main(string[] args)
        {
            var service = new WeatherSoapClient();
            var weatherReturn = service.GetCityWeatherByZIP("75074");

            Console.WriteLine("City length from partial: " + weatherReturn.CityLength);

            Console.ReadLine();
        }
Example #4
0
        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            string strZip   = TextBox.Text;
            var    objProxy = new WeatherSoapClient("WeatherSoap");
            var    city     = objProxy.GetCityWeatherByZIP(strZip);//44103;
            string str      = $"City:{city.City}\nTemperature:{city.Temperature}\nPressure:{city.Pressure}";

            TextBlock.Text = String.Empty;
            TextBlock.Text = str;
        }
Example #5
0
        void IDisposable.Dispose()
        {
            this.IsDisposed = true;

            if (this.proxy != null)
            {
                this.proxy.Close();
                this.proxy = null;
            }
        }
Example #6
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            WeatherSoapClient client = new WeatherSoapClient("WeatherSoap");

            WeatherReturn result = client.GetCityWeatherByZIP(txZip.Text);

            lblCity.Text = result.City;
            lblState.Text = result.State;
            lblTemperatur.Text = result.Temperature;
            lblWind.Text = result.Wind;
            lblZip.Text = result.RelativeHumidity;
        }
        /// <summary>
        /// The get image uri for type.
        /// </summary>
        /// <param name="type">
        /// The type.
        /// </param>
        /// <returns>
        /// The <see cref="Uri"/>.
        /// </returns>
        private async Task <Uri> GetImageUriForType(int type)
        {
            if (!this.weather.Any())
            {
                var proxy  = new WeatherSoapClient();
                var result = await proxy.GetWeatherInformationAsync();

                foreach (var item in result.GetWeatherInformationResult)
                {
                    this.weather.Add(item);
                }
            }

            var uri = this.weather.Where(d => d.WeatherID == type)
                      .Select(d => new Uri(d.PictureURL, UriKind.Absolute))
                      .FirstOrDefault();

            return(uri);
        }
Example #8
0
        protected void ButtonResult_Click(object sender, EventArgs e)
        {
            var client = new WeatherSoapClient("WeatherSoap");

            WeatherReturn result = client.GetCityWeatherByZIP(TextBox1.Text);

            if (result.Success)
            {
                LabelCity.Text        = result.City;
                LabelState.Text       = result.State;
                LabelTemperature.Text = result.Temperature;
                LabelWind.Text        = result.Wind;
            }
            else
            {
                LabelCity.Text        = "Couldn´t be retrieved";
                LabelState.Text       = "Couldn´t be retrieved";
                LabelTemperature.Text = "Couldn´t be retrieved";
                LabelWind.Text        = "Couldn´t be retrieved";
            }
        }
Example #9
0
        public PartialViewResult GetWeatherByZipCode(string zipCode)
        {
            WeatherReturn weather;

            try
            {
                //WeatherSoapClient client = new WeatherSoapClient(); // Error - more than one endpoint in web.config
                WeatherSoapClient client = new WeatherSoapClient("WeatherSoap");
                weather = client.GetCityWeatherByZIP(zipCode); //System.ServiceModel.FaultException: 'Server was unable to process request. ---> A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)'

                if (!weather.Success)
                {
                    weather = null;
                }
            }
            catch (Exception ex)
            {
                weather = null;
            }

            return(PartialView(weather));
        }
Example #10
0
 protected void PredictWeatherBtn_Click(object sender, EventArgs e)
 {
     WeatherPrediction.WeatherSoapClient weatherService = new WeatherSoapClient();
     ResultLabel.Text = weatherService.WeatherForecast();
 }
Example #11
0
 private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
 {
     return(WeatherSoapClient.GetEndpointAddress(EndpointConfiguration.WeatherSoap));
 }
Example #12
0
 private static System.ServiceModel.Channels.Binding GetDefaultBinding()
 {
     return(WeatherSoapClient.GetBindingForEndpoint(EndpointConfiguration.WeatherSoap));
 }
Example #13
0
 public WeatherSoapClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(WeatherSoapClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Example #14
0
 public WeatherSoapClient(EndpointConfiguration endpointConfiguration) :
     base(WeatherSoapClient.GetBindingForEndpoint(endpointConfiguration), WeatherSoapClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Example #15
0
 public WeatherSoapClient() :
     base(WeatherSoapClient.GetDefaultBinding(), WeatherSoapClient.GetDefaultEndpointAddress())
 {
     this.Endpoint.Name = EndpointConfiguration.WeatherSoap.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Example #16
0
        protected void btnPredictWeather_Click(object sender, EventArgs e)
        {
            WeatherService.WeatherSoapClient weatherService = new WeatherSoapClient();
            lblWeather.Text = weatherService.GetWeatherCondition();

        }
Example #17
0
        private void buttonWeather_Click(object sender, EventArgs e)
        {
            WeatherSoapClient client = new WeatherSoapClient();

            labelWeather.Text = client.HelloWorld();
        }
Example #18
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     WeatherReference.WeatherSoapClient client = new WeatherSoapClient();
     Label1.Text = client.WheatherForecast();
 }
Example #19
0
 private void buttonWeather_Click(object sender, EventArgs e)
 {
     WeatherSoapClient client = new WeatherSoapClient();
     labelWeather.Text = client.HelloWorld();
 }
Example #20
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     WeatherReference.WeatherSoapClient client = new WeatherSoapClient();
     Label1.Text = client.WheatherForecast();
 }
Example #21
0
        protected void PredictWeatherBtn_Click(object sender, EventArgs e)
        {
            WeatherPrediction.WeatherSoapClient weatherService = new WeatherSoapClient();
            ResultLabel.Text = weatherService.WeatherForecast();

        }
Example #22
0
 protected void btnPredictWeather_Click(object sender, EventArgs e)
 {
     WeatherService.WeatherSoapClient weatherService = new WeatherSoapClient();
     lblWeather.Text = weatherService.GetWeatherCondition();
 }