예제 #1
0
        public void StartUp()
        {
            // Construct InstanceContext to handle messages on callback interface. 
            // An instance of ChatApp is created and passed to the InstanceContext.
            InstanceContext instanceContext = new InstanceContext(new TransactionNotifierService(this));

            // Create the participant with the given endpoint configuration
            // Each participant opens a duplex channel to the mesh
            // participant is an instance of the chat application that has opened a channel to the mesh
            DuplexChannelFactory<ITransactionNotifierChannel> factory = 
                new DuplexChannelFactory<ITransactionNotifierChannel>(instanceContext, "ChatEndpoint");

            _channel = factory.CreateChannel();

            // Retrieve the PeerNode associated with the participant and register for online/offline events
            // PeerNode represents a node in the mesh. Mesh is the named collection of connected nodes.
            IOnlineStatus ostat = _channel.GetProperty<IOnlineStatus>();
            //ostat.Online += new EventHandler(OnOnline);
            //ostat.Offline += new EventHandler(OnOffline);

            _channel.Open();
        }
        public void StartUp()
        {
            // Construct InstanceContext to handle messages on callback interface.
            // An instance of ChatApp is created and passed to the InstanceContext.
            InstanceContext instanceContext = new InstanceContext(new TransactionNotifierService(this));

            // Create the participant with the given endpoint configuration
            // Each participant opens a duplex channel to the mesh
            // participant is an instance of the chat application that has opened a channel to the mesh
            DuplexChannelFactory <ITransactionNotifierChannel> factory =
                new DuplexChannelFactory <ITransactionNotifierChannel>(instanceContext, "ChatEndpoint");

            _channel = factory.CreateChannel();

            // Retrieve the PeerNode associated with the participant and register for online/offline events
            // PeerNode represents a node in the mesh. Mesh is the named collection of connected nodes.
            IOnlineStatus ostat = _channel.GetProperty <IOnlineStatus>();

            //ostat.Online += new EventHandler(OnOnline);
            //ostat.Offline += new EventHandler(OnOffline);

            _channel.Open();
        }