private void BtnGetZipCodes_Click(object sender, RoutedEventArgs e) { try { if (!string.IsNullOrWhiteSpace(txtState.Text)) { var address = new EndpointAddress("net.tcp://localhost/GeoLib.WebHost/GeoService.svc"); var binding = new NetTcpBinding(); GeoClient proxy = new GeoClient(binding, address); IEnumerable <ZipCodeData> data = proxy.GetZips(txtState.Text); if (data != null) { lstZips.ItemsSource = data; } proxy.Close(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btnGetZipCodes_Click(object sender, RoutedEventArgs e) { //This call, in the way it's configured, will only work with ConsoleHost if (!string.IsNullOrWhiteSpace(txtSearchState.Text)) { //As commented in the module, it's possible to set values in the config file or programmatically. //Here it was set programmatically, to change this, you just need to comment the next lines, //and make the constructor passing the tcpEP string as parameter. EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService"); Binding binding = new NetTcpBinding() { MaxReceivedMessageSize = 2000000, SendTimeout = new TimeSpan(0, 0, 5) }; GeoClient proxy = new GeoClient(binding, address); IEnumerable <ZipCodeData> data = proxy.GetZips(txtSearchState.Text); if (data != null) { lstZips.ItemsSource = data; } proxy.Close(); } }
private void btnGetZipCodes_Click(object sender, RoutedEventArgs e) { if (txtState.Text != null) { GeoClient proxy = new GeoClient(); IEnumerable <ZipCode> data = proxy.GetZips(txtState.Text); if (data != null) { lstZips.ItemsSource = data; } proxy.Close(); } }
private void btnGetZipCodes_Click(object sender, RoutedEventArgs e) { if (txtState.Text != "") { EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService"); Binding binding = new NetTcpBinding(); GeoClient proxy = new GeoClient(binding, address); IEnumerable <ZipCodeData> data = proxy.GetZips(txtState.Text); if (data != null) { lstZipCodes.ItemsSource = data; } proxy.Close(); } }
public void GetZipCodes() { var tempProxy = new GeoClient("tcpEP"); if (string.IsNullOrEmpty(State)) return; var data = tempProxy.GetZips(State); this.ZipCodes.Clear(); foreach (var zipCodeData in data) { this.ZipCodes.Add(zipCodeData); } tempProxy.Close(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(txtState.Text)) { EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService"); System.ServiceModel.Channels.Binding bind = new NetTcpBinding(); GeoClient client = new GeoClient(bind, address); var result = client.GetZips(txtState.Text); if (result != null) { lstZips.ItemsSource = result; } client.Close(); } }
private void BtnGetZipCodes_OnClick(object sender, RoutedEventArgs e) { if (txtState != null) { EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService"); Binding binding = new NetTcpBinding(); GeoClient proxy = new GeoClient(binding, address); var datas = proxy.GetZips(txtState.Text); if (datas != null) { lstZips.ItemsSource = datas; } } }
private void btnGetZipCodes_Click(object sender, RoutedEventArgs e) { if (txtState.Text == "") return; EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService"); NetTcpBinding binding = new NetTcpBinding(); binding.MaxReceivedMessageSize = 2097152; using (GeoClient client = new GeoClient(binding, address)) { IEnumerable<ZipCodeData> data = client.GetZips(txtState.Text); if (data == null) return; lstZips.ItemsSource = data; } }
private void btnGetZipCodes_Click(object sender, RoutedEventArgs e) { if (txtState.Text != null) { //GeoClient proxy = new GeoClient(); //IGeoService proxy = CreateProxy(); GeoClient proxy = new GeoClient("dynamicGeoService"); IEnumerable <ZipCodeData> data = proxy.GetZips(txtState.Text); if (data != null) { lstZips.ItemsSource = data; } ((IDisposable)proxy).Dispose(); //proxy.Close(); } }
private void GetZipCodesBtn_OnClick(object sender, RoutedEventArgs e) { var address = new EndpointAddress("net.tcp://localhost:8009/GeoService"); var binding = new NetTcpBinding(); var proxy = new GeoClient(binding, address); ZipCodeData[] data = proxy.GetZips(""); var sb = new StringBuilder(); foreach (var zipCodeData in data) { sb.AppendLine($"State: {zipCodeData.State} City: {zipCodeData.City} ZipCode: {zipCodeData.ZipCode}"); } GetZipsTextBLock.Text = sb.ToString(); proxy.Close(); }
private void btnGetZipCodes_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(txtState.Text)) { return; } var endpointAddress = new EndpointAddress("net.tcp://localhost:8009/GeoService"); Binding binding = new NetTcpBinding(); var proxy = new GeoClient(binding, endpointAddress); var data = proxy.GetZips(txtState.Text); if (data != null) { lstZips.ItemsSource = data; } proxy.Close(); }
static void Main(string[] args) { System.Console.Write("Enter Zip code:"); var zip = System.Console.ReadLine(); System.Console.Write("Enter old state abbrivation:"); var oldstate = System.Console.ReadLine(); System.Console.Write("Enter new state abbrivation:"); var newstate = System.Console.ReadLine(); GeoClient proxy = new GeoClient(); try { var result = proxy.GetStates(true); var zipsByState = proxy.GetZips(new ZipCode() { County = "India" }, 1); var zipcodeByInfo = proxy.GetZipInfo(zip); GeoAdminClient adminClient = new GeoAdminClient(); adminClient.ClientCredentials.UserName.UserName = "******"; adminClient.ClientCredentials.UserName.Password = "******"; adminClient.UpdateState(oldstate, newstate); // var allZipCodes = proxy.GetZips(new ZipCode() { }, 1); System.Console.Write("State:"); System.Console.WriteLine(null != zipcodeByInfo.State ? zipcodeByInfo.State.Name : string.Empty); System.Console.Write("City:"); System.Console.WriteLine(null != zipcodeByInfo.City ? zipcodeByInfo.City : string.Empty); } finally { // proxy.Close(); } System.Console.ReadLine(); }
private void bthGetZipCodes_Click( object sender, RoutedEventArgs e ) { if (txtState.Text != "") { //GeoClient proxy = new GeoClient("httpEP"); EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService"); System.ServiceModel.Channels.Binding binding = new NetTcpBinding(); GeoClient proxy = new GeoClient(binding, address); IEnumerable<ZipCodeData> data = proxy.GetZips(txtState.Text); if (data != null) { lstZips.ItemsSource = data; } proxy.Close(); } }
private void btnGetZipCodes_Click(object sender, RoutedEventArgs e) { if (txtState.Text != null) { EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService"); Binding binding = new NetTcpBinding(); binding.SendTimeout = new TimeSpan(0, 0, 0, 5); ((NetTcpBinding)binding).MaxReceivedMessageSize = 2000000; GeoClient proxy = new GeoClient(binding, address); IEnumerable <ZipCodeData> data = proxy.GetZips(txtState.Text); if (data != null) { lbxResponse.ItemsSource = data; } proxy.Close(); } }
private void btnGetZipCodes_Click(object sender, RoutedEventArgs e) { if(txtState.Text != "") { GeoClient proxy = new GeoClient(endpointName); IEnumerable<ZipCodeData> zipCodeData = proxy.GetZips(txtState.Text); if (zipCodeData != null) { lstZips.ItemsSource = zipCodeData; } proxy.Close(); //EndpointAddress endpointAddress = new EndpointAddress("net.tcp://localhost:11001/GeoService"); //System.ServiceModel.Channels.Binding binding = new NetTcpBinding(); //GeoClient proxy = new GeoClient(binding, endpointAddress); //IEnumerable<ZipCodeData> zipCodeData = proxy.GetZips(txtState.Text); //if(zipCodeData!=null) //{ // lstZips.ItemsSource = zipCodeData; //} //proxy.Close(); } }
private void btnGetZipCodes_Click(object sender, RoutedEventArgs e) { //Here we will do no config for proxy //the client little more knowledge of wcf becuase proxy need this programattic end point //config info and this is fed through ctor overload. if (txtState.Text != null) { //EndpointAddress address = new EndpointAddress("net.tcp://localhost:8009/GeoService"); //NetTcpBinding binding = new NetTcpBinding(); //binding.Name = "dynamic"; //binding.MaxReceivedMessageSize = 2000000; //GeoClient proxy = new GeoClient(binding, address); GeoClient proxy = new GeoClient("tcpEP"); IEnumerable<ZipCodeData> data = proxy.GetZips(txtState.Text); if (data != null) lstZips.ItemsSource = data; proxy.Close(); } }