Advertisement
Guest User

Untitled

a guest
Jun 21st, 2011
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.35 KB | None | 0 0
  1. class ClientClass : ClientInterface
  2.     {
  3.         public void OnCallback(object aUpdatedObject)
  4.         {
  5.             try
  6.             {
  7.                 Form1.addTextOnInstance(aUpdatedObject.ToString());
  8.             }
  9.             catch (Exception ex)
  10.             {
  11.                 Form1.addTextOnInstance(ex.ToString());
  12.             }
  13.         }
  14.     }
  15.  
  16. /*************************************************
  17.  * I do this in my application upon startup
  18. */
  19. private void Form1_Load(object sender, EventArgs e)
  20.         {
  21.             NetNamedPipeBinding tBinding = new NetNamedPipeBinding();
  22.             tBinding.MaxReceivedMessageSize = 2000000;
  23.  
  24.            
  25.             ClientClass tClientClass = new ClientClass();
  26.             DuplexChannelFactory<RequestInterface> pipeFactory =
  27.              new DuplexChannelFactory<RequestInterface>(
  28.                 tClientClass,
  29.                 tBinding,
  30.                 new EndpointAddress(
  31.                    "net.pipe://localhost/Request"));
  32.  
  33.             try
  34.             {
  35.                 RequestInterface tInterface = pipeFactory.CreateChannel();
  36.  
  37.                 tInterface.Subscribe();
  38.                 addText("completed successfully");
  39.             }
  40.             catch (Exception aEx)
  41.             {
  42.                 addText(aEx.Message);
  43.                 addText(aEx.ToString());
  44.             }
  45.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement