Beispiel #1
0
        void ActiveSessions_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
                case NotifyCollectionChangedAction.Add:
                    foreach (var channel in e.NewItems)
                    {
                        var session = new Session((ITransportChannel)channel);
                        _currentSessions.Add(session);
                    }
                    Console.WriteLine("Client connected");
                    break;
                case NotifyCollectionChangedAction.Remove:
                    foreach (var channel in e.OldItems)
                    {
                        var session = _currentSessions.FirstOrDefault(s => s.Channel.Equals(channel));
                        if (session != null)
                        {
                            _currentSessions.Remove(session);
                        }
                    }
                    Console.WriteLine("Client disconnected");
                    break;

            }
        }
Beispiel #2
0
 public ProtocolBase(Session session)
 {
     _session = session;
     _version = 1;
 }