Esempio n. 1
0
        // https://www.bbc.com/news  151.101.0.81 - United States
        // wp.pl 212.77.98.9 poland
        // http://angryjoeshow.com/ajsa/ 67.225.176.169 United States
        // https://www.mi.com/global/ 58.83.160.156 China
        // https://www.referat.ru/ 91.212.151.161 Russian Federation



        private void time_Click(object sender, EventArgs e)
        {
            startTimer();

            var serviceClient = new ServiceTime.ServiceSoapClient("ServiceSoap");

            txtTimeOutput.Text = serviceClient.GetTime().ToString();

            calculateTime(timeTime);
        }
Esempio n. 2
0
        private void btnTime_Click(object sender, EventArgs e)
        {
            var watch = new Stopwatch();

            watch.Start();
            var serviceClient = new ServiceTime.ServiceSoapClient("ServiceSoap1");

            txtTimeOutput.Text = serviceClient.GetTime().ToString();
            watch.Stop();
            txtTimeWatch.Text = watch.ElapsedMilliseconds.ToString();
        }
Esempio n. 3
0
        private async void StartTasksAsync()
        {
            var clientQuote = new ServiceReferenceQuotes.DelayedStockQuoteSoapClient("DelayedStockQuoteSoap");

            taskQuote = clientQuote.GetQuickQuoteAsync(txtQuotesInput.Text, "0");

            var clientResolve = new ServiceResolve.P2GeoSoapClient("IP2GeoSoap");

            taskResolve = clientResolve.ResolveIPAsync(txtResolveInput.Text, "0");


            var clientTime = new ServiceTime.ServiceSoapClient("ServiceSoap");

            taskTime = clientTime.GetTimeAsync();

            var clientEcho = new ServiceEcho.ServiceSoapClient("ServiceSoap1");

            taskEcho = clientEcho.EchoAsync(txtEchoInput.Text);


            using (WebClient client = new WebClient())
            {
                Uri uri1 = new Uri("http://api.openweathermap.org/data/2.5/weather?q=" + txtWeatherInput.Text + "&mode=xml&appid=714329f613c83cfa729591a7ceac291d");

                taskTemperature = await client.DownloadStringTaskAsync(uri1);

                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.LoadXml(taskTemperature);

                XmlNode      temp_node  = xmlDocument.SelectSingleNode("//temperature");
                XmlAttribute temp_value = temp_node.Attributes["value"];

                double temperature = double.Parse(temp_value.Value, System.Globalization.CultureInfo.InvariantCulture);
                temperature = temperature - 273.15; // kelvin to celcius conversion

                txtWeatherOutputTemperature.Text = temperature.ToString("N2");

                if (temperature < 0)
                {
                    txtWeatherOutputTemperature.BackColor = Color.Red;
                }
                else if (temperature >= 0 && temperature <= 5)
                {
                    txtWeatherOutputTemperature.BackColor = Color.Blue;
                }
                else
                {
                    txtWeatherOutputTemperature.BackColor = Color.Green;
                }
            }
        }