/// <summary> /// 引发 ClientClosed 事件。 /// </summary> /// <param name="e">包含事件数据的 <see cref="ClientChannelEventArgs"/>。</param> internal void FireClientChannelClosed(ClientChannelEventArgs e) { if (this.ClientChannelClosed != null) { this.ClientChannelClosed(this, e); } }
void channel_ChannelClosed(object sender, ClientChannelEventArgs e) { e.Channel.Client.UnregisterChannel(e.Channel); // 引发客户端通道关闭事件 this.owner.FireClientChannelClosed(e); // 当是最后一个客户端通道时,引发客户端关闭事件 if (e.Channel.Client.Channels.Length == 0) { this.clients.Remove(e.Channel.Client.AppInstanceId); this.owner.FireClientClosed(new ClientConnectEventArgs(e.Channel.Client)); } }