Пример #1
0
        public void DoAlterations(Operation op, String username)
        {
            LVAddDelegate lvAdd;
            LVRemDelegate lvRem;

            switch (op)
            {
            case Operation.Add:
                usersList.Add(username);
                lvAdd = new LVAddDelegate(onlineUsers.Items.Add);
                ListViewItem lvItem = new ListViewItem(new string[] { username });
                BeginInvoke(lvAdd, new object[] { lvItem });
                break;

            case Operation.Remove:
                lvRem = new LVRemDelegate(RemoveUser);
                BeginInvoke(lvRem, new object[] { username });
                break;

            case Operation.GroupChat:
                groupChatsList.Add(username);
                lvAdd = new LVAddDelegate(groupChats.Items.Add);
                ListViewItem lvgcItem = new ListViewItem(new string[] { username });
                BeginInvoke(lvAdd, new object[] { lvgcItem });
                break;
            }
        }
Пример #2
0
        public void DoAlterations(Operation op, string username, string port)
        {
            LVAddDelegate lvAdd;
            LVRemDelegate lvRem;

            switch (op)
            {
            case Operation.SessionStart:

                UserSession newUserSession = new UserSession(username, port);
                activeSessions.Add(newUserSession);
                lvAdd = new LVAddDelegate(activeSessionsList.Items.Add);
                ListViewItem lvItem = new ListViewItem(new string[] { username });
                BeginInvoke(lvAdd, new object[] { lvItem });
                break;

            case Operation.SessionEnd:

                lvRem = new LVRemDelegate(RemoveLoggedOutUser);
                BeginInvoke(lvRem, new object[] { username });
                break;

            default:
                break;
            }
        }