class ClientClass : ClientInterface
{
public void OnCallback(object aUpdatedObject)
{
try
{
Form1.addTextOnInstance(aUpdatedObject.ToString());
}
catch (Exception ex)
{
Form1.addTextOnInstance(ex.ToString());
}
}
}
/*************************************************
* I do this in my application upon startup
*/
private void Form1_Load(object sender, EventArgs e)
{
NetNamedPipeBinding tBinding = new NetNamedPipeBinding();
tBinding.MaxReceivedMessageSize = 2000000;
ClientClass tClientClass = new ClientClass();
DuplexChannelFactory<RequestInterface> pipeFactory =
new DuplexChannelFactory<RequestInterface>(
tClientClass,
tBinding,
new EndpointAddress(
"net.pipe://localhost/Request"));
try
{
RequestInterface tInterface = pipeFactory.CreateChannel();
tInterface.Subscribe();
addText("completed successfully");
}
catch (Exception aEx)
{
addText(aEx.Message);
addText(aEx.ToString());
}
}