예제 #1
0
        private void AddChatMember_Load(object sender, EventArgs e)
        {
            /* 추가할 멤버리스트 출력 - 채팅방 멤버 아닌 친구 */
            ChattingRoom chatRoom = Store.chatList.Single((X) => X.getRoomNum() == rNumber);

            members = chatRoom.getMembers();

            for (int i = 0; i < friendList.Count; i++)
            {
                int fnum = friendList.ElementAt(i).getfNum();

                bool isMember = false;
                foreach (Friend member in members)
                {
                    int userNum = member.getfNum();
                    if (userNum == fnum)
                    {
                        isMember = true;
                    }
                }


                //if (!isMember)
                //    checkedListBox1.Items.Add(friendList.ElementAt(i).getfname());
                if (!isMember)
                {
                    checkedListBox1.Items.Add(friendList.ElementAt(i));
                }
            }
        }
예제 #2
0
        private void ChatRoom_Load(object sender, EventArgs e)
        {
            if (isFirst)
            {
                ChattingRoom chattingRoom = Store.chatList.Single((x) => x.getRoomNum() == this.rNumber);

                string packet = "2|2|" + this.rNumber + "|";
                main.SendStr(packet);

                flowLayoutPanel1.Controls.Clear();
            }
        }
예제 #3
0
        public MsgBox(int rNum, int num, string msg, DateTime time)
        {
            InitializeComponent();

            ChattingRoom chatRoom = Store.chatList.Single((x) => x.getRoomNum() == rNum);

            this.MemberList = chatRoom.getMembers();

            float msgBoxWidth = setSize(msg);

            label2.Parent = pictureBox1;

            if (num == Store.myInfo.getUserNum())
            {
                sendMsg(msg, time, msgBoxWidth);
            }
            else
            {
                revMsg(num, msg, time, msgBoxWidth);
            }
        }
예제 #4
0
        public void pntList()
        {
            /* 채팅방 인원 리스트 출력 */

            try
            {
                if (listBox1.InvokeRequired)
                {
                    delegatePrintMemberList d = new delegatePrintMemberList(pntList);
                    Invoke(d);
                }
                else
                {
                    listBox1.Items.Clear();

                    ChattingRoom  chatRoom = Store.chatList.Single((X) => X.getRoomNum() == rNumber);
                    List <Friend> members  = chatRoom.getMembers();

                    foreach (Friend friend in members)
                    {
                        listBox1.Items.Add(friend.getfname());
                    }
                }
            }
            catch  { }



            //for(int i=0; i<members.Count;i++)
            //{
            //    for(int j=0; j<Store.userlist.Count;j++)
            //    {
            //        if(members.ElementAt(i) == Store.userlist[j])
            //        {
            //            listBox1.Items.Add(Store.userlist[j].getName());

            //        }
            //    }
            //}
        }
예제 #5
0
        //채팅 멤버 추가
        public void AddChatMember(string rNum, string fndList)
        {
            int          roomNumber = int.Parse(rNum);
            ChattingRoom chatRoom   = Store.chatList.Single((x) => x.getRoomNum() == roomNumber);

            //if (isLast) // "0"수신하면 목록 갱신
            //{
            //    chatRoom.addMember();
            //    updateChatRoom();
            //    return;
            //}

            string[] fnd = fndList.Split('/');

            foreach (string item in fnd)
            {
                if (fnd.Equals(""))
                {
                    break;
                }

                string[] fndInfo = item.Split('?');

                if (fndInfo[0] == "") /* 채팅방 멤버 출력 갱신되게..*/ } {
예제 #6
0
 public void addChattRoom(ChattingRoom chat)
 {
     this.AllRoomNum.Add(chat);
 }
예제 #7
0
        //채팅방 목록 갱신
        public void ChatList(string roomNum, string fndList, bool isLast)
        {
            //마지막 일 경우
            if (isLast)
            {
                //pntRoomList();
                updateChatRoom();
                Store.msgList.Clear();
                return;
            }

            int rNum = int.Parse(roomNum);

            //존재하는 채팅방인지 검사
            foreach (ChattingRoom item in Store.chatList)
            {
                if (item.getRoomNum() == rNum)
                {
                    return;
                }
            }

            string[]     str          = fndList.Split('/');
            ChattingRoom chattingRoom = new ChattingRoom(main, rNum);

            Store.chatList.Add(chattingRoom);
            foreach (string item in str)
            {
                if (item.Equals(""))
                {
                    break;
                }
                string[] fnd  = item.Split('?');
                int      uNum = int.Parse(fnd[0]);
                if (uNum != Store.myInfo.getUserNum())
                {
                    Friend friend;
                    try
                    {
                        friend = Store.friendList.Single((x) => x.getfNum() == uNum);
                    }
                    catch (InvalidOperationException)
                    {
                        friend = new Friend();
                        friend.setfNum(uNum);
                        friend.setfname(fnd[1]);
                    }
                    chattingRoom.addMember(friend);
                }
            }
            //미확인 메시지 검사
            for (int i = Store.msgList.Count - 1; i >= 0; i--)
            {
                Message message = Store.msgList.ElementAt(i);
                if (rNum.Equals(message.getRoomNum()))
                {
                    int      msgUser = message.getId();
                    string   msg     = message.getMsg();
                    DateTime msgTime = message.getTime();
                    chattingRoom.setRestMessage(msgUser, msg, msgTime);
                }
            }
        }