Exemplo n.º 1
0
 private void ChannelUnregisteredEventHandler(object sender, ChannelRegistrationEventArgs e)
 {
     if (e.Channel.Equals(this.mChannel))
     {
         Close();
     }
 }
Exemplo n.º 2
0
        private void OnChannelRegistered(object sender, ChannelRegistrationEventArgs e)
        {
            _channel = e.Channel;

            _channel.StatusChanged += (a, f) => {
                if (Status == AgentStatus.Starting && f.Status == ChannelStatus.Online)
                {
                    Status = AgentStatus.Online;
                }
                else if (Status == AgentStatus.Online && f.Status == ChannelStatus.Offline)
                {
                    Status = AgentStatus.Offline;
                }

                ChannelStatus = f.Status;
            };

            if (e.Success)
            {
                _channel.Status = ChannelStatus.Online;
            }
            else
            {
                MsgLogger.WriteError($"{GetType().Name} - OnChannelRegistered", $"channel id='{_channel.Id}' registration failed!");
            }
        }
Exemplo n.º 3
0
        private void OnChannelRegistered(object sender, ChannelRegistrationEventArgs e)
        {
            var channel = e.Channel;

            if (e.Success)
            {
                channel.Status = ChannelStatus.Online;
            }
            else
            {
                MsgLogger.WriteError($"{GetType().Name} - OnChannelRegistered", $"Channel ({channel.Id}) registration failed!");
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Channels the unregistered event handler.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="Forge.Net.Remoting.Channels.ChannelRegistrationEventArgs"/> instance containing the event data.</param>
        protected override void ChannelUnregisteredEventHandler(object sender, ChannelRegistrationEventArgs e)
        {
            base.ChannelUnregisteredEventHandler(sender, e);

            Channel channel = e.Channel;

            // leiratkozom az eseményről
            channel.SessionStateChange -= new EventHandler <SessionStateEventArgs>(ChannelSessionStateChangeEventHandler);

            // megszüntetem a channel-hez tartozó PerSession ProxyBase instance-okat
            lock (mContractAndInstancePerSessionAndChannel)
            {
                IEnumeratorSpecialized <ContractAndInstanceStruct> iterator = mContractAndInstancePerSessionAndChannel.GetEnumerator();
                while (iterator.MoveNext())
                {
                    ContractAndInstanceStruct s = iterator.Current;
                    if (s.Channel.Equals(channel))
                    {
                        iterator.Remove();
                        s.Instance.Dispose();
                    }
                }
            }

            // konfiguráció adminisztrációja, törlöm a csatornához köthető információkat
            List <ContractServiceSideDescriptor> list = new List <ContractServiceSideDescriptor>();

            lock (mContractDescriptors)
            {
                list.AddRange(mContractDescriptors.Values);
            }
            foreach (ContractServiceSideDescriptor ss in list)
            {
                lock (ss)
                {
                    ss.ImplementationPerChannel.Remove(channel.ChannelId);
                }
            }
            list.Clear();
        }
Exemplo n.º 5
0
 protected virtual void OnChannelRegistered(ChannelRegistrationEventArgs e)
 {
     ChannelRegistered?.Invoke(this, e);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Channels the register event handler.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Forge.Net.Remoting.Channels.ChannelRegistrationEventArgs"/> instance containing the event data.</param>
 protected override void ChannelRegisterEventHandler(object sender, ChannelRegistrationEventArgs e)
 {
     base.ChannelRegisterEventHandler(sender, e);
     e.Channel.SessionStateChange += new EventHandler <SessionStateEventArgs>(ChannelSessionStateChangeEventHandler);
 }
Exemplo n.º 7
0
        /// <summary>
        /// Channels the unregistered event handler.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="Forge.Net.Remoting.Channels.ChannelRegistrationEventArgs"/> instance containing the event data.</param>
        protected virtual void ChannelUnregisteredEventHandler(object sender, ChannelRegistrationEventArgs e)
        {
            Channel channel = e.Channel;

            channel.ReceiveMessage -= new EventHandler <ReceiveMessageEventArgs>(ChannelReceiveMessageEventHandler);
        }