private void btnCallService_Click(object sender, EventArgs e) { SimpleService.SimpleServiceClient client = new SimpleService.SimpleServiceClient(); MessageBox.Show(client.GetMessage("Windows username and password required here.")); client.ClientCredentials.UserName.UserName = "******"; // Windows username required client.ClientCredentials.UserName.Password = "******"; // Windows password required MessageBox.Show(client.GetMessage("Red")); }
private void Button_Click(object sender, RoutedEventArgs e) { try { MessageBox.Show("Number = " + client.IncrementNumber().ToString()); } catch (System.ServiceModel.CommunicationException ex) { if (client.State == System.ServiceModel.CommunicationState.Faulted) { MessageBox.Show("Session timed out. Your existing session will be lost. A new session will now be created."); client = new SimpleService.SimpleServiceClient(); } } }
public MainWindow() { InitializeComponent(); client = new SimpleService.SimpleServiceClient(); }
private void btnCallService_Click(object sender, EventArgs e) { SimpleService.SimpleServiceClient client = new SimpleService.SimpleServiceClient(); MessageBox.Show(client.GetUserName()); }