Exemple #1
0
        private void echo_Click(object sender, EventArgs e)
        {
            startTimer();

            var serviceClient = new ServiceEcho.ServiceSoapClient("ServiceSoap1");
            var asciiData     = serviceClient.Echo(txtEchoInput.Text);

            txtEchoOutput.Text = asciiData.ToString();

            calculateTime(echoTime);
        }
Exemple #2
0
        private void btnEcho_Click(object sender, EventArgs e)
        {
            var watch = new Stopwatch();

            watch.Start();
            var serviceClient = new ServiceEcho.ServiceSoapClient("ServiceSoap");

            txtEchoOutput.Text = serviceClient.Echo(txtEchoInput.Text).ToString();
            watch.Stop();
            txtEchoWatch.Text = watch.ElapsedMilliseconds.ToString();
        }
Exemple #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;
                }
            }
        }