public ChannelEventHandler(IChannel channel, IDataUpdatedCallback callback, IContextChannel contextChannel)
        {
            this.callback = callback;
            this.channel  = channel;

            channel.ValueChanged   += new EventHandler(OnChannelValueChanged);
            contextChannel.Closing += new EventHandler(OnContextChannelClosing);
        }
Esempio n. 2
0
        public void RegisterCallback(string channelId)
        {
            IDataUpdatedCallback callback = OperationContext.Current.GetCallbackChannel <IDataUpdatedCallback>();

            IChannel channel = Env.Current.CommunicationPlugins.GetChannel(channelId);

            if (channel != null)
            {
                ChannelEventHandler handler = new ChannelEventHandler(channel, callback, OperationContext.Current.Channel);
                handler.Disconnected += new EventHandler(OnHandlerDisconnected);
                subscribers.Add(handler);
            }
        }