public IChannelSession GetChannelSession(ChannelId channelId) { if (ChannelId.IsNullOrEmpty(channelId)) { throw new ArgumentNullException(nameof(channelId)); } AssertLoggedIn(); if (_channelSessions.ContainsKey(channelId)) { return(_channelSessions[channelId]); } var c = new ChannelSession(this, channelId, _groupHandle); _channelSessions[channelId] = c; return(c); }
public ChannelSession(LoginSession loginSession, ChannelId channelId, string groupId) { if (loginSession == null) { throw new ArgumentNullException(nameof(loginSession)); } if (ChannelId.IsNullOrEmpty(channelId)) { throw new ArgumentNullException(nameof(channelId)); } _loginSession = loginSession; Key = channelId; GroupId = groupId; _sessionHandle = $"{loginSession.AccountHandle}_{channelId}"; VxClient.Instance.EventMessageReceived += InstanceOnEventMessageReceived; _loginSession.PropertyChanged += (sender, args) => { if (args.PropertyName == nameof(_loginSession.TransmittingChannel)) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsTransmitting))); } }; }