private void button1_Click(object sender, EventArgs e) { using (localhost.MessagingServiceClient m_proxy = new localhost.MessagingServiceClient()) { m_proxy.SendMessage(string.Format("Hello from {0}", this.Text)); } }
public Form1() { InitializeComponent(); this.Text += ": Process " + Process.GetCurrentProcess().Id.ToString(); m_proxy = new localhost.MessagingServiceClient(); ICommunicationObject obj = m_proxy as ICommunicationObject; obj.Faulted += new EventHandler(obj_Faulted); }
public Form1() { InitializeComponent(); this.Text += ": ThreadId " + Thread.CurrentThread.GetHashCode().ToString(); MessagingServiceCallback callbackType = new MessagingServiceCallback(); InstanceContext context = new InstanceContext(callbackType); m_proxy = new localhost.MessagingServiceClient(context); }
void obj_Faulted(object sender, EventArgs e) { MessageBox.Show("Communication channel has faulted. Creating a new proxy instance."); m_proxy = new localhost.MessagingServiceClient(); }