Ejemplo n.º 1
0
 public ChatMessenger(UIAgent agent, Dictionary <string, ChatUser> loggedChatUsers,
                      Dictionary <string, ChatRoom> chatRooms)
 {
     ui = agent;
     this.loggedChatUsers = loggedChatUsers;
     this.chatRooms       = chatRooms;
 }
Ejemplo n.º 2
0
 public ChatServer(UIAgent agent, ServerUserCallback userConnectedCallback,
                   ServerUserCallback userDisconnectedCallback, ServerDataCallback dataReceivedCallback)
 {
     this.userConnectedCallback    = userConnectedCallback;
     this.userDisconnectedCallback = userDisconnectedCallback;
     this.dataReceivedCallback     = dataReceivedCallback;
     ui = agent;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Publiczny konstruktor inicjalizujący komponenty . Utworzenie faktycznego serwera sieciowego,
        /// dopiero w metodzie <see cref="startServer"/>
        /// </summary>
        /// <param name="agent"></param>
        public ChatManager(UIAgent agent)
        {
            ui     = agent;
            server = new ChatServer(agent, onUserConnected, onUserDisconnected, onDataReceived);


            loggedChatUsers  = new Dictionary <string, ChatUser>();
            pendingChatUsers = new Dictionary <string, ChatUser>();
            chatRooms        = new Dictionary <string, ChatRoom>();
            messenger        = new ChatMessenger(ui, loggedChatUsers, chatRooms);

            var cr1 = new ChatRoom("Pokój #1");
            var cr2 = new ChatRoom("Pokój #2");
            var cr3 = new ChatRoom("Pokój #3");
            var cr4 = new ChatRoom(waitingRoomName);

            chatRooms.Add(cr4.name, cr4);
            chatRooms.Add(cr1.name, cr1);
            chatRooms.Add(cr2.name, cr2);
            chatRooms.Add(cr3.name, cr3);
        }
Ejemplo n.º 4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            UIAgent agent = new UIAgent(tbServerLog, lbUsers);

            chatManager = new ChatManager(agent);
        }