private async void ConvertTempToC() { TempConvertSoapClient f = new TempConvertSoapClient(); var resultc = await f.FahrenheitToCelsiusAsync(textbox.Text); await f.CloseAsync(); tempc.Text = resultc; }
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}"; } }
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"; }
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(); } }
public TempConvertSoapClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) : base(TempConvertSoapClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress) { this.Endpoint.Name = endpointConfiguration.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }
public TempConvertSoapClient(EndpointConfiguration endpointConfiguration) : base(TempConvertSoapClient.GetBindingForEndpoint(endpointConfiguration), TempConvertSoapClient.GetEndpointAddress(endpointConfiguration)) { this.Endpoint.Name = endpointConfiguration.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }
public TempConvertSoapClient() : base(TempConvertSoapClient.GetDefaultBinding(), TempConvertSoapClient.GetDefaultEndpointAddress()) { this.Endpoint.Name = EndpointConfiguration.TempConvertSoap.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }
private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress() { return(TempConvertSoapClient.GetEndpointAddress(EndpointConfiguration.TempConvertSoap)); }
private static System.ServiceModel.Channels.Binding GetDefaultBinding() { return(TempConvertSoapClient.GetBindingForEndpoint(EndpointConfiguration.TempConvertSoap)); }
public TempConvertSoapClient() : base(TempConvertSoapClient.GetDefaultBinding(), TempConvertSoapClient.GetDefaultEndpointAddress()) { }
public TempConvertSoapClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) : base(TempConvertSoapClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress) { }
public TempConvertSoapClient(EndpointConfiguration endpointConfiguration) : base(TempConvertSoapClient.GetBindingForEndpoint(endpointConfiguration), TempConvertSoapClient.GetEndpointAddress(endpointConfiguration)) { }