コード例 #1
0
        public Task <string> GetCitiesByCountry(string countryName)
        {
            var globalWeatherSoapClient = new GlobalWeatherSoapClient();
            var citiesByCountryAsync    = globalWeatherSoapClient.GetCitiesByCountryAsync(countryName);

            return(citiesByCountryAsync);
        }
コード例 #2
0
ファイル: Client.cs プロジェクト: Siim/AlloyDemoKit
        public WeatherData GetWeather(string city, string country)
        {
            GlobalWeatherSoapClient soapClient = new GlobalWeatherSoapClient();
            string result = soapClient.GetWeather(city, country);

            XmlSerializer serializer = new XmlSerializer(typeof(CurrentWeather));
            MemoryStream reader = new MemoryStream(Encoding.Unicode.GetBytes(result));

            CurrentWeather weatherResult = (CurrentWeather)serializer.Deserialize(reader);

            var data = new WeatherData()
            {
                LocationName = weatherResult.Location,
                Conditions = weatherResult.SkyConditions
            };
            
            string timeStamp = weatherResult.Time.Substring(weatherResult.Time.IndexOf("/") + 1)
                                                 .Replace('.', '-')
                                                 .Replace("UTC", "")
                                                 .TrimEnd();
            string formattedTime = timeStamp.Substring(0, timeStamp.Length - 2) + ":" + timeStamp.Substring(timeStamp.Length - 2);
            data.CurrentTime = Convert.ToDateTime(formattedTime);

            int length = weatherResult.Temperature.Length;
            string celsius = weatherResult.Temperature.Substring(weatherResult.Temperature.IndexOf("(") + 1, length - (weatherResult.Temperature.IndexOf(")") - 1));
            data.Temp.AddCelsius(Convert.ToDouble(celsius));

            return data;
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: alex1gtp/YourWeather
        private void comboBoxCities_SelectedIndexChanged(object sender, EventArgs e)
        {
            BasicHttpBinding binding = new BasicHttpBinding();

            EndpointAddress address = new EndpointAddress("http://www.webservicex.com/globalweather.asmx?WSDL");

            GlobalWeatherSoapClient gwsc = new GlobalWeatherSoapClient(binding, address);

            var weather = gwsc.GetWeather(comboBoxCities.Text, comboBoxCountry.Text);

            if (weather == "Data Not Found!")
            {
                richTextBoxWeatherDetails.Clear();

                //XmlSerializer result = new XmlSerializer(typeof(CurrentWeather));

                //var w = (CurrentWeather)result.Deserialize(new StringReader(weather));

                //for( int i = 0; i< w.ItemsElementName.Lenght; i++)
                //{
                //    richTextBoxWeatherDetails.Text += w.ItmesElementName[i]+ ":" w.Items[i] + "\r\n";
                //}
            }
            else
            {
                richTextBoxWeatherDetails.Clear();
                richTextBoxWeatherDetails.Text = "Data Not Found!";
            }
        }
コード例 #4
0
        public WeatherData GetWeather(string city, string country)
        {
            GlobalWeatherSoapClient soapClient = new GlobalWeatherSoapClient();
            string result = soapClient.GetWeather(city, country);

            XmlSerializer serializer = new XmlSerializer(typeof(CurrentWeather));
            MemoryStream  reader     = new MemoryStream(Encoding.Unicode.GetBytes(result));

            CurrentWeather weatherResult = (CurrentWeather)serializer.Deserialize(reader);

            var data = new WeatherData()
            {
                LocationName = weatherResult.Location,
                Conditions   = weatherResult.SkyConditions
            };

            string timeStamp = weatherResult.Time.Substring(weatherResult.Time.IndexOf("/") + 1)
                               .Replace('.', '-')
                               .Replace("UTC", "")
                               .TrimEnd();
            string formattedTime = timeStamp.Substring(0, timeStamp.Length - 2) + ":" + timeStamp.Substring(timeStamp.Length - 2);

            data.CurrentTime = Convert.ToDateTime(formattedTime);

            int    length  = weatherResult.Temperature.Length;
            string celsius = weatherResult.Temperature.Substring(weatherResult.Temperature.IndexOf("(") + 1, length - (weatherResult.Temperature.IndexOf(")") - 1));

            data.Temp.AddCelsius(Convert.ToDouble(celsius));

            return(data);
        }
コード例 #5
0
            public string getWeather()
            {
                try
                {
                    address = new EndpointAddress("http://www.webservicex.net/globalweather.asmx?WSDL");

                    GlobalWeatherSoapClient gwsc = new GlobalWeatherSoapClient(binding, address);

                    string        ret_cities = gwsc.GetCitiesByCountry("Philippines");
                    List <string> city_list  = new List <string>();

                    //TODO: Read xml data into string[] of countries
                    XmlDocument xmlDoc = new XmlDocument();
                    xmlDoc.Load(ret_cities);
                    XmlNodeList parentNode = xmlDoc.GetElementsByTagName("NewDataSet");
                    foreach (XmlNode childrenNode in parentNode)
                    {
                        //HttpContext.Current.Response.Write(childrenNode.SelectSingleNode("//City").Value);
                        city_list.Add(childrenNode.SelectSingleNode("//City").Value);
                    }
                    // ------------------------------------------------------

                    string return_weather = string.Join(";", city_list.ToArray());
                    return(return_weather);
                }
                catch (Exception ex)
                {
                    return("Convertion Error: " + ex.Message);
                }
            }
コード例 #6
0
        static void Main(string[] args)
        {
            var c = new GlobalWeatherSoapClient("GlobalWeatherSoap");

            Console.WriteLine(c.GetCitiesByCountry("Brazil"));

            Console.ReadKey();
        }
コード例 #7
0
        /// <summary>
        ///  Call Web service and display the results to the NameRange control
        /// </summary>
        /// <param name="city">Search City</param>
        /// <param name="country">Search Country</param>
        public void DisplayWebServiceResult(string city, string country)
        {
            // Get Name Range and Clear current display
            NamedRange range = (NamedRange)this.Controls["Data"];

            range.Clear();

            // Initialize the value of x
            int x = 0;

            try
            {
                // Initialize a new instance of Service Client
                using (GlobalWeatherSoapClient weatherclien = new GlobalWeatherSoapClient())
                {
                    // Call Web service method to Get Weather Data
                    string xmlweatherresult = weatherclien.GetWeather(city, country);

                    // Load an XElement from a string that contains XML data
                    var xmldata = XElement.Parse(xmlweatherresult);

                    // Query the Name and value of Weather
                    var query = from weather in xmldata.Elements()
                                select new
                    {
                        weather.Name,
                        weather.Value
                    };

                    if (query.Count() > 0)
                    {
                        foreach (var item in query)
                        {
                            // Use RefersToR1C1 property to change the range that a NameRange control refers to
                            range.RefersToR1C1 = String.Format("=R1C1:R{0}C2", query.Count());

                            // Update data  in range.
                            // Excel uses 1 as the base for index.
                            ((Excel.Range)range.Cells[x + 1, 1]).Value2 = item.Name.ToString();
                            ((Excel.Range)range.Cells[x + 1, 2]).Value2 = item.Value.ToString();
                            x++;
                            if (x == query.Count() - 1)
                            {
                                break;
                            }
                        }
                    }
                }
            }
            catch
            {
                this.Range["A1"].Value2 = "Input City or Country is error, Please check them again";

                // -16776961 is represent for red
                this.Range["A1"].Font.Color = -16776961;
            }
        }
コード例 #8
0
        public async Task <List <Table> > GetWeatherByCountryName(string country)
        {
            string cities     = string.Empty;
            var    soapClient = new GlobalWeatherSoapClient(globalWeatherSoap);

            cities = await soapClient.GetCitiesByCountryAsync(country);

            //string is returned in xml format
            return(StringConvert.ConvertXmlStringIntoObject(cities));
        }
コード例 #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            GlobalWeatherSoapClient obj = new GlobalWeatherSoapClient();
            string       resultado      = obj.GetCitiesByCountry(textBox1.Text);
            DataSet      resul          = new DataSet();
            StringReader lectura        = new StringReader(resultado);

            resul.ReadXml(lectura);
            comboBox1.DataSource    = resul.Tables[0];
            comboBox1.DisplayMember = "city";
        }
コード例 #10
0
        public void WhenIInputCountryNameToGetCity(string p0)
        {
            GlobalWeatherSoapClient cl = new GlobalWeatherSoapClient();

            string city_ls = cl.GetCitiesByCountry(p0);

            Console.WriteLine(city_ls);
            if (!ScenarioContext.Current.ContainsKey("CityList"))
            {
                ScenarioContext.Current.Add("CityList", city_ls);
            }
        }
コード例 #11
0
ファイル: Class1.cs プロジェクト: Thad54/swe2
        public void handleRequest(Dictionary<string, string> data, StreamWriter OutPutStream)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("<html><body><div><h1>Weather</h1>");

            GlobalWeatherSoapClient service = new GlobalWeatherSoapClient();

            sb.Append(service.GetCitiesByCountry("Austria"));

            sb.Append("</div></body></html>");
            WriteResponse(sb.ToString(), "text/html", OutPutStream);
            return;
        }
コード例 #12
0
        public async Task <CurrentWeather> GetWeather(string country, string city)
        {
            var globalWeatherSoapClient = new GlobalWeatherSoapClient();
            var currentWeather          = await globalWeatherSoapClient.GetWeatherAsync(country, city);

            if (currentWeather == "Data Not Found")
            {
                var weatherApi = new WeatherApi();
                return(await weatherApi.GetWeather(city));
            }
            var serializer = new Serializer();
            var weather    = serializer.Deserialize <CurrentWeather>(currentWeather);

            return(weather);
        }
コード例 #13
0
        public async Task <string> GetWatherByCityCountryName(string city, string country)
        {
            string cityWeather = string.Empty;

            try
            {
                var soapClient = new GlobalWeatherSoapClient(globalWeatherSoap);
                cityWeather = await soapClient.GetWeatherAsync(city, country);
            }
            catch (Exception e)
            {
                //log here in case ws down.
            }

            return(cityWeather);
        }
コード例 #14
0
        public CountryCityResult GetCities(string country)
        {
            try
            {
                using (var globalWeatherSoapClient = new GlobalWeatherSoapClient(_soapEndpointName))
                {
                    var cityXmlString = globalWeatherSoapClient.GetCitiesByCountry(country);
                    if (string.IsNullOrEmpty(cityXmlString))
                    {
                        return new CountryCityResult
                               {
                                   Exception = new InvalidDataException("Xml response is empty")
                               }
                    }
                    ;


                    var serializer = new XmlSerializer(typeof(CityResult));
                    using (var reader = new StringReader(cityXmlString))
                    {
                        var cityResponse = serializer.Deserialize(reader) as CityResult;

                        if (cityResponse == null)
                        {
                            return new CountryCityResult
                                   {
                                       Exception = new InvalidDataException("Error in deserializing xml respones")
                                   }
                        }
                        ;

                        return(new CountryCityResult
                        {
                            Status = ServiceStatus.Success,
                            Cities = cityResponse.Tables.Select(t => t.City).ToList()
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                return(new CountryCityResult
                {
                    Exception = ex
                });
            }
        }
コード例 #15
0
 private async void button_Click(object sender, RoutedEventArgs e)
 {
     /****************************************/
     /*   Create the binding                 */
     BasicHttpBinding binding = new BasicHttpBinding();
     /*   Set message size if required       */
     binding.MaxReceivedMessageSize = 20000000;
     /*  Set the Endpoint                    */
     EndpointAddress address = new EndpointAddress("http://www.webservicex.com/globalweather.asmx");
     /****************************************/
     /*  Get the task                        */
     GlobalWeatherSoapClient gwsc = new GlobalWeatherSoapClient(binding, address);
     /*  Always a good idea to test for
     *   Exceptions                          */
     try
     {
         Task<string> getCities = gwsc.GetCitiesByCountryAsync("");
         /************************************/
         /* Place a call to another method 
         *  to do work, this event or        
         *  function while the task finishes 
         *  METHOD CALL HERE                 */
         // Method
         /*   This event cannot complete w/o   
         *    the await getCities task         
         *    being completed                */
         string citys = await getCities;
         /*  You get the XML data &           
         *   deserialize it.                  
         *   You do need to create a class    
         *   that gives you access to the XML */
         XmlSerializer result = new XmlSerializer(typeof(cities.NewDataSet));
         cn = (cities.NewDataSet)result.Deserialize(new StringReader(citys));
         /*  After deserialization, use       
         *   Lamda & Linq                     */
         var Countries = cn.Table.Select(m => m.Country).Distinct();
         /****************************************
         /*  Add countries to the combo box   */
         cmbxCountry.ItemsSource = Countries;
         /****************************************/
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #16
0
        public formWeather()
        {
            InitializeComponent();

            BasicHttpBinding binding = new BasicHttpBinding();

            binding.MaxReceivedMessageSize = 200000000;

            EndpointAddress address = new EndpointAddress("http://www.webservicex.com/globalweather.asmx");

            GlobalWeatherSoapClient gwsc = new GlobalWeatherSoapClient(binding, address);

            var cities = gwsc.GetCitiesByCountry("");

            XmlSerializer result = new XmlSerializer(typeof(Cities.NewDataSet));

            cn = (Cities.NewDataSet)result.Deserialize(new StringReader(cities));
        }
コード例 #17
0
ファイル: Form1.cs プロジェクト: tr1ple5/Tutorials
        private void comboBoxCities_SelectedIndexChanged(object sender, EventArgs e)
        {
            GlobalWeatherSoapClient gwsc = new GlobalWeatherSoapClient(binding, address);

            var weather = gwsc.GetWeather(comboBoxCities.Text, comboBoxCountries.Text);

            if (weather != "Data Not Found")
            {
                richTextBoxWeatherDetails.Clear();

                //Deserialize xml again but Web Service is no longer in use. No data found for all cities and countries.
            }
            else
            {
                richTextBoxWeatherDetails.Clear();
                richTextBoxWeatherDetails.Text = "Data Not Found";
            }
        }
コード例 #18
0
ファイル: Form1.cs プロジェクト: tr1ple5/Tutorials
        public formWeather()
        {
            InitializeComponent();
            binding.MaxReceivedMessageSize = 2000000;

            GlobalWeatherSoapClient gwsc = new GlobalWeatherSoapClient(binding, address);

            var cities = gwsc.GetCitiesByCountry("");

            XmlSerializer result = new XmlSerializer(typeof(Cities.NewDataSet));

            cn = (Cities.NewDataSet)result.Deserialize(new StringReader(cities));

            var Countries = cn.Table.Select(x => x.Country).Distinct();

            comboBoxCountries.Items.AddRange(Countries.ToArray());
            var Cities = cn.Table.Select(x => x.City).Distinct();

            comboBoxCities.Items.AddRange(Cities.ToArray());
        }
コード例 #19
0
 // GET: api/GetWeatherByCity/countryName
 public IEnumerable <string> Get(string countryName)
 {
     try
     {
         globalweatherService.GlobalWeatherSoapClient client = new GlobalWeatherSoapClient();
         //get the list of cities from the service
         var res = client.GetCitiesByCountry(countryName.Trim());
         //create the ds from the string
         var ds = getDS(res);
         if (ds == null || ds.Tables.Count == 0)
         {
             return(null);
         }
         var filePaths = ds.Tables[0]
                         .AsEnumerable()
                         .Where(p => p.Field <string>("Country").Equals(countryName, StringComparison.InvariantCultureIgnoreCase))
                         .Select(row => row.Field <string>("City"))
                         .ToArray();
         return(filePaths);
     }
     catch { return(null); }
 }
コード例 #20
0
        /// <summary>
        /// This method is used to get readings from our local censors plus the weather outside.
        /// </summary>
        /// <param name="listenPort"> This parameter is used to choose on which port, that you want to listen on.</param>
        public static void StartListener(int listenPort)
        {
            // Done is used to run the while loop, checkweather is the weather from our third party webservice, and errorOccurred is used to check which method needs to be run
            string checkWeather = "Error";
            var errorOccurred = false;
            bool done = false;

            Service1Client service = new Service1Client();
            UdpClient listener = new UdpClient(listenPort);
            IPEndPoint groupEP = new IPEndPoint(IPAddress.Any, listenPort);
            GlobalWeatherSoapClient weather = new GlobalWeatherSoapClient();
            try
            {
                while (!done)
                {
                    //Here we start our listener, and wait for a broadcast
                    Trace.WriteLine("Waiting for broadcast");
                    byte[] bytes = listener.Receive(ref groupEP);

                    //When we recieve the message, we then use GetString, and afterwards we split it
                    Trace.WriteLine("Received broadcast from " +
                        groupEP + ": " +
                        Encoding.ASCII.GetString(bytes, 0, bytes.Length));

                    string message = Encoding.ASCII.GetString(bytes, 0, bytes.Length);

                    string[] response = message.Split(':');

                    //In response we know where the temperature is, and we convert that to a double. The number we get is around 218, and because we need a value that looks like celcius, we divide it with 10 so we have an acceptable value
                    double temp = Convert.ToDouble(response[6].Trim().Substring(0, 3));

                    temp = temp / 10;
                    Trace.WriteLine(temp);

                    //We need to send a Date and time plus soundlevel, which we randomly generate
                    string time = DateTime.Now.ToString("HH:mm:ss dd/MM/yyyy");
                    Trace.WriteLine(time);
                    Random rand = new Random();
                    double sound = rand.Next(40, 60);
                    Trace.WriteLine(sound);

                    //Here we get the weather for Roskilde, and afterwards we try to split the string that gets returned. But because the string we get can different depending on the weather, and exception can arise, and by catching that we can split it in another way, that then works
                    string todaysWeather = weather.GetWeather("Roskilde", "Denmark");

                    try
                    {
                        string[] weatherlist = todaysWeather.Split('>');
                        string[] weatherlist2 = weatherlist[9].Split('<');
                        string[] weatherlist3 = weatherlist2[0].Split(' ');
                        string[] weatherlist4 = weatherlist3[3].Split('(');
                        checkWeather = weatherlist4[1];
                    }
                    catch (Exception)
                    {

                        errorOccurred = true;
                    }

                    if (errorOccurred)
                    {
                        string[] weatherlist5 = todaysWeather.Split('>');
                        string[] weatherlist6 = weatherlist5[11].Split('<');
                        string[] weatherlist7 = weatherlist6[0].Split(' ');
                        string[] weatherlist8 = weatherlist7[3].Split('(');
                        checkWeather = weatherlist8[1];
                    }

                    string rows = service.Datatransfer(time, temp, sound, checkWeather);
                    Trace.WriteLine(rows);

                    Trace.Flush();
                    Thread.Sleep(10000);

                }

            }
            catch (Exception)
            {
                string time = DateTime.Now.ToString("HH:mm:ss dd/MM/yyyy");
                service.Datatransfer(time, 0, 0, "Error occurred while receiving broadcast");
            }
            finally
            {
                listener.Close();
            }
        }
コード例 #21
0
 public GlobalWeatherServiceClient()
 {
     _client = new GlobalWeatherSoapClient(ConfigKey);
 }
コード例 #22
0
 public WeatherReportDAL()
 {
     _weatherServiceClient = new GlobalWeatherSoapClient();
 }
コード例 #23
0
        public Form1()
        {
            var delayedStock = new DelayedStockQuoteSoapClient();
            Controls.Add(new Service("DelayedStockQuoteSoapClient/QuickQuote", "GOOG",
                async s => (await delayedStock.GetQuickQuoteAsync(s, "0")).ToString(CultureInfo.CurrentCulture)));
            Controls.Add(new Service("DelayedStockQuoteSoapClient/Quote", "GOOG",
                async s => (await delayedStock.GetQuoteAsync(s, "0")).ChangePercent));
            var ip2GeoSoap = new P2GeoSoapClient();
            Controls.Add(new Service("IP2GeoSoap/IP", "213.180.141.140",
                async s => (await ip2GeoSoap.ResolveIPAsync(s, "0")).City));
            //-> http://www.webservicex.net/ConvertTemperature.asmx?WSDL
            var temperature = new ConvertTemperatureSoapClient();
            Controls.Add(new Service("ConvTemp", "0",
                async s =>
                    (await
                        temperature.ConvertTempAsync(double.Parse(s), TemperatureUnit.degreeCelsius,
                            TemperatureUnit.kelvin)).ToString(CultureInfo.CurrentCulture)));
            //-> WSDL
            var curControl = new CurrencyConvertorSoapClient();
            Controls.Add(new Service("CurrConv", "5",
                async s => (double.Parse(s) * await curControl.ConversionRateAsync(Currency.USD, Currency.EUR)).ToString(CultureInfo.InvariantCulture)));

            var weather = new GlobalWeatherSoapClient();
            Controls.Add(new Service("Weather", "Szczecin", async s =>
            {
                var xml = await weather.GetWeatherAsync(s, "Poland");
                return CurrentWeather.ConvertXml(xml).Temperature;
            }));

            var runall = new Button { Text = "Run all", Dock = DockStyle.Bottom };
            runall.Click += (s, ev) => { Service.GoAll(); };
            Controls.Add(runall);
        }
 public GlobalWeatherService(GlobalWeatherSoapClient client)
 {
     _globalWeatherSoapClient = client;// new GlobalWeatherSoapClient();
 }
コード例 #25
0
 private static System.ServiceModel.Channels.Binding GetDefaultBinding()
 {
     return(GlobalWeatherSoapClient.GetBindingForEndpoint(EndpointConfiguration.GlobalWeatherSoap));
 }
コード例 #26
0
        /// <summary>
        /// This method is used to get readings from our local censors plus the weather outside.
        /// </summary>
        /// <param name="listenPort"> This parameter is used to choose on which port, that you want to listen on.</param>
        public static void StartListener(int listenPort)
        {
            // Done is used to run the while loop, checkweather is the weather from our third party webservice, and errorOccurred is used to check which method needs to be run
            string checkWeather  = "Error";
            var    errorOccurred = false;
            bool   done          = false;

            Service1Client          service  = new Service1Client();
            UdpClient               listener = new UdpClient(listenPort);
            IPEndPoint              groupEP  = new IPEndPoint(IPAddress.Any, listenPort);
            GlobalWeatherSoapClient weather  = new GlobalWeatherSoapClient();

            try
            {
                while (!done)
                {
                    //Here we start our listener, and wait for a broadcast
                    Trace.WriteLine("Waiting for broadcast");
                    byte[] bytes = listener.Receive(ref groupEP);

                    //When we recieve the message, we then use GetString, and afterwards we split it
                    Trace.WriteLine("Received broadcast from " +
                                    groupEP + ": " +
                                    Encoding.ASCII.GetString(bytes, 0, bytes.Length));

                    string message = Encoding.ASCII.GetString(bytes, 0, bytes.Length);

                    string[] response = message.Split(':');

                    //In response we know where the temperature is, and we convert that to a double. The number we get is around 218, and because we need a value that looks like celcius, we divide it with 10 so we have an acceptable value
                    double temp = Convert.ToDouble(response[6].Trim().Substring(0, 3));

                    temp = temp / 10;
                    Trace.WriteLine(temp);

                    //We need to send a Date and time plus soundlevel, which we randomly generate
                    string time = DateTime.Now.ToString("HH:mm:ss dd/MM/yyyy");
                    Trace.WriteLine(time);
                    Random rand  = new Random();
                    double sound = rand.Next(40, 60);
                    Trace.WriteLine(sound);

                    //Here we get the weather for Roskilde, and afterwards we try to split the string that gets returned. But because the string we get can different depending on the weather, and exception can arise, and by catching that we can split it in another way, that then works
                    string todaysWeather = weather.GetWeather("Roskilde", "Denmark");

                    try
                    {
                        string[] weatherlist  = todaysWeather.Split('>');
                        string[] weatherlist2 = weatherlist[9].Split('<');
                        string[] weatherlist3 = weatherlist2[0].Split(' ');
                        string[] weatherlist4 = weatherlist3[3].Split('(');
                        checkWeather = weatherlist4[1];
                    }
                    catch (Exception)
                    {
                        errorOccurred = true;
                    }

                    if (errorOccurred)
                    {
                        string[] weatherlist5 = todaysWeather.Split('>');
                        string[] weatherlist6 = weatherlist5[11].Split('<');
                        string[] weatherlist7 = weatherlist6[0].Split(' ');
                        string[] weatherlist8 = weatherlist7[3].Split('(');
                        checkWeather = weatherlist8[1];
                    }


                    string rows = service.Datatransfer(time, temp, sound, checkWeather);
                    Trace.WriteLine(rows);

                    Trace.Flush();
                    Thread.Sleep(10000);
                }
            }
            catch (Exception)
            {
                string time = DateTime.Now.ToString("HH:mm:ss dd/MM/yyyy");
                service.Datatransfer(time, 0, 0, "Error occurred while receiving broadcast");
            }
            finally
            {
                listener.Close();
            }
        }
コード例 #27
0
 public GlobalWeatherSoapClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(GlobalWeatherSoapClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
コード例 #28
0
 public GlobalWeatherSoapClient(EndpointConfiguration endpointConfiguration) :
     base(GlobalWeatherSoapClient.GetBindingForEndpoint(endpointConfiguration), GlobalWeatherSoapClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
コード例 #29
0
 public GlobalWeatherSoapClient() :
     base(GlobalWeatherSoapClient.GetDefaultBinding(), GlobalWeatherSoapClient.GetDefaultEndpointAddress())
 {
     this.Endpoint.Name = EndpointConfiguration.GlobalWeatherSoap.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
コード例 #30
0
 public WeatherUpdateService()
 {
     WService = new GlobalWeatherSoapClient("GlobalWeatherSoap");
 }
コード例 #31
0
 private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
 {
     return(GlobalWeatherSoapClient.GetEndpointAddress(EndpointConfiguration.GlobalWeatherSoap));
 }
コード例 #32
0
 public WeatherRepository()
 {
     _soapClient = new GlobalWeatherSoapClient("GlobalWeatherSoap12");
 }