private async void btnGetEmployees_Click(object sender, RoutedEventArgs e) { txtInfo.Text = "Data is Not Received Yet...."; MyRef.ServiceClient Proxy = new MyRef.ServiceClient(); var Result = await Proxy.GetEmployeesAsync(); dgEmp.ItemsSource = Result; txtInfo.Text = "Data Received...."; }
private void Form1_Load(object sender, EventArgs e) { Proxy = new MyRef.ServiceClient(); Proxy.ClientCredentials.UserName.UserName = "******"; Proxy.ClientCredentials.UserName.Password = "******"; System.Net.ServicePointManager.ServerCertificateValidationCallback += (se, cert, chain, sslerror) => { return true; }; }
/// <summary> /// Method for Posting Messages to Database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { try { if (Protocol == string.Empty) { MessageBox.Show("Please select the Protocol"); } else { switch (Protocol) { case "Tcp": Proxy = new MyRef.ServiceClient("NetTcpBinding_IService"); break; case "Http": Proxy = new MyRef.ServiceClient("BasicHttpBinding_IService"); break; case "Udp": Proxy = new MyRef.ServiceClient("UdpBinding_IService"); break; } } Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); for (int i = 0; i < 2000; i++) { MyRef.MessagePost msg = new MyRef.MessagePost() { MessageDetails = "My Message Post No" + i.ToString() + "with Protocol " + Protocol }; Proxy.PostMessages(msg); } stopWatch.Stop(); if (Protocol == "Tcp") { lblTcpTime.Text += stopWatch.ElapsedMilliseconds; } if (Protocol == "Http") { lblHttpTime.Text += stopWatch.ElapsedMilliseconds; } if (Protocol == "Udp") { lblUdpTime.Text += stopWatch.ElapsedMilliseconds; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void MainPage_Loaded(object sender, RoutedEventArgs e) { Proxy = new MyRef.ServiceClient(); LoadDealers(); LoadProducts(); CreateBillUI(); }
public CServiceAdapter() { Proxy = new MyRef.ServiceClient(); }