Esempio n. 1
0
        private async void ConvertTempToC()
        {
            TempConvertSoapClient f = new TempConvertSoapClient();
            var resultc             = await f.FahrenheitToCelsiusAsync(textbox.Text);

            await f.CloseAsync();

            tempc.Text = resultc;
        }
Esempio n. 2
0
        private async void ConvertTempToF()
        {
            TempConvertSoapClient f = new TempConvertSoapClient();
            var resultf             = await f.CelsiusToFahrenheitAsync(textbox.Text);

            await f.CloseAsync();

            tempf.Text = resultf;
        }
        private async void CalculateExecute()
        {
            try {
                var    client  = new TempConvertSoapClient(TempConvertSoapClient.EndpointConfiguration.TempConvertSoap12);
                string celsius = await client.FahrenheitToCelsiusAsync(Input);

                Result = $"The temp in celsius is: {celsius}";
            } catch (Exception ex) {
                Result = $"Error: {ex.Message}";
            }
        }
Esempio n. 4
0
        private async void TemperaturaZInternetu()
        {
            Windows.Web.Http.HttpClient hc = new Windows.Web.Http.HttpClient();
            var result = await hc.GetStringAsync(new Uri("http://ktostemperature.azurewebsites.net/external2.txt"));

            TempConvertSoapClient f = new TempConvertSoapClient();
            var resultf             = await f.CelsiusToFahrenheitAsync(result);

            await f.CloseAsync();

            temp.Text = $"{result} C, {resultf} F";
        }
Esempio n. 5
0
        public void Bug32886_Test()          // test in one of the comment
        {
            // Init service
            int         port        = NetworkHelpers.FindFreePort();
            ServiceHost serviceHost = new ServiceHost(typeof(TempConvertSoapImpl), new Uri("http://localhost:" + port + "/TempConvertSoap"));

            serviceHost.AddServiceEndpoint(typeof(TempConvertSoap), new BasicHttpBinding(), string.Empty);

            // Enable metadata exchange (WSDL publishing)
            var mexBehavior = new ServiceMetadataBehavior();

            mexBehavior.HttpGetEnabled = true;
            serviceHost.Description.Behaviors.Add(mexBehavior);
            serviceHost.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding(), "mex");

            serviceHost.Open();

            try {
                // client
                var binding       = new BasicHttpBinding();
                var remoteAddress = new EndpointAddress("http://localhost:" + port + "/TempConvertSoap");
                var client        = new TempConvertSoapClient(binding, remoteAddress);

                var wait = new ManualResetEvent(false);

                Exception error  = null;
                string    result = null;

                client.CelsiusToFahrenheitCompleted += delegate(object o, CelsiusToFahrenheitCompletedEventArgs e) {
                    try {
                        error  = e.Error;
                        result = e.Error == null ? e.Result : null;
                    } finally {
                        wait.Set();
                    }
                };

                client.CelsiusToFahrenheitAsync("24.5");

                Assert.IsTrue(wait.WaitOne(TimeSpan.FromSeconds(20)), "timeout");
                Assert.IsNull(error, "#1, inner exception: {0}", error);
                Assert.AreEqual("76.1", result, "#2");
            } finally {
                serviceHost.Close();
            }
        }
Esempio n. 6
0
 public TempConvertSoapClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(TempConvertSoapClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Esempio n. 7
0
 public TempConvertSoapClient(EndpointConfiguration endpointConfiguration) :
     base(TempConvertSoapClient.GetBindingForEndpoint(endpointConfiguration), TempConvertSoapClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Esempio n. 8
0
 public TempConvertSoapClient() :
     base(TempConvertSoapClient.GetDefaultBinding(), TempConvertSoapClient.GetDefaultEndpointAddress())
 {
     this.Endpoint.Name = EndpointConfiguration.TempConvertSoap.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Esempio n. 9
0
 private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
 {
     return(TempConvertSoapClient.GetEndpointAddress(EndpointConfiguration.TempConvertSoap));
 }
Esempio n. 10
0
 private static System.ServiceModel.Channels.Binding GetDefaultBinding()
 {
     return(TempConvertSoapClient.GetBindingForEndpoint(EndpointConfiguration.TempConvertSoap));
 }
Esempio n. 11
0
 public TempConvertSoapClient() :
     base(TempConvertSoapClient.GetDefaultBinding(), TempConvertSoapClient.GetDefaultEndpointAddress())
 {
 }
Esempio n. 12
0
 public TempConvertSoapClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(TempConvertSoapClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
 }
Esempio n. 13
0
 public TempConvertSoapClient(EndpointConfiguration endpointConfiguration) :
     base(TempConvertSoapClient.GetBindingForEndpoint(endpointConfiguration), TempConvertSoapClient.GetEndpointAddress(endpointConfiguration))
 {
 }