public void RemoveConnection(ServerWebSocketConnection connection)
        {
            Connections.Remove(connection);

            if (PresenterConnection == connection)
            {
                PresenterConnection = null;
            }
        }
 public void AddConnection(ServerWebSocketConnection connection, string clientName)
 {
     if (!Connections.Contains(connection))
     {
         int num = GenerateConnectionNumber();
         connection.BrushArgb  = Colors[(num - 1) % Colors.Length].ToArgb();
         connection.ClientName = clientName;
         Connections.Add(connection);
     }
 }
        public static Conference Start(string id, ServerWebSocketConnection presenterConnection, int presenterWidth, int presenterHeight, string clientName)
        {
            var conference = new Conference {
                Id = id, PresenterConnection = presenterConnection
            };

            conference.AddConnection(presenterConnection, clientName);

            conference.Bitmap   = new Bitmap(presenterWidth, presenterHeight);
            conference.Graphics = Graphics.FromImage(conference.Bitmap);

            return(conference);
        }
        public static void AddConnection(Connection connection)
        {
            if (Connections.ContainsKey(connection))
            {
                return;
            }

            ServerWebSocketConnection serverWebSocketConnection = new ServerWebSocketConnection(connection);

            lock (Connections)
                Connections.Add(connection, serverWebSocketConnection);

            serverWebSocketConnection.GetStateCommandReceived          += ServerWebSocketConnectionOnGetStateCommandReceived;
            serverWebSocketConnection.DiffCommandReceived              += ServerWebSocketConnectionOnDiffCommandReceived;
            serverWebSocketConnection.InputCommandReceived             += ServerWebSocketConnectionOnInputCommandReceived;
            serverWebSocketConnection.PaintAddFigureCommandRecieved    += ServerWebSocketConnectionPaintAddFigureCommandRecieved;
            serverWebSocketConnection.PaintDeleteFigureCommandRecieved += ServerWebSocketConnectionPaintDeleteFigureCommandRecieved;
            serverWebSocketConnection.ControlAccessCommandReceived     += ServerWebSocketConnectionOnControlAccessCommandReceived;
            serverWebSocketConnection.RequestControllCommandReceived   += ServerWebSocketConnectionOnRequestControllCommandReceived;
        }