Exemplo n.º 1
0
 public IXDListener CreateListener(XDListener.XDMessageHandler handler)
 {
     IXDListener listener = XDListener.CreateListener(Mode, !Propagate);
     listener.RegisterChannel(Name);
     listener.MessageReceived += handler;
     return listener;
 }
        /// <summary>
        /// The non-obsolete constructor used internally for creating new instances of XDListener.
        /// </summary>
        /// <param name="nonObsolete"></param>
        internal XDListener(bool nonObsolete)
        {
            // create a top-level native window
            CreateParams p = new CreateParams();

            p.Width   = 0;
            p.Height  = 0;
            p.X       = 0;
            p.Y       = 0;
            p.Caption = string.Concat("TheCodeKing.Net.XDServices.", Guid.NewGuid().ToString());
            p.Parent  = IntPtr.Zero;
            base.CreateHandle(p);

            this.networkRelay = new NetworkRelayListener(XDBroadcast.CreateBroadcast(XDTransportMode.WindowsMessaging),
                                                         XDListener.CreateListener(XDTransportMode.MailSlot));
        }