コード例 #1
0
ファイル: MainForm.cs プロジェクト: skubisz/komunikator-lpp
        private void timer_Tick(object sender, EventArgs e)
        {            
            timer.Enabled = false;
            
            
            List<CommunicatorMessage> messages = _communicator.readMessages();

            foreach (CommunicatorMessage message in messages)
            {
                bool exists = false;
                foreach (Talk talk in _activeTalks)
                {                    
                    if (talk.addMessage(message.from, talk.contactName, message.message))
                    {
                        exists = true;
                        break;
                    }
                }

                if (!exists)
                {
                    Contact contact = _communicator.contacts.findContact(message.from);
                    string contactName = contact != null ? contact.name : message.from;

                    int talkId = _communicator.archive.getNextId();
                    Talk newTalk = new Talk(this, _communicator.getLogedUser(), talkId, message.from, contactName);
                    _activeTalks.Add(newTalk);
                    newTalk.Show();
                    newTalk.addMessage(message.from, contactName, message.message);
                }
            }
            
            timer.Enabled = true;            
            
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: skubisz/komunikator-lpp
        private void contactList_DoubleClick(object sender, EventArgs e)
        {
            if (contactList.SelectedItems.Count == 1)
            {
                Contact contact = _communicator.contacts.getList()[contactList.SelectedItems[0].Index];
                
                foreach (Talk talk in _activeTalks)
                {
                    if (talk.contactLogin == contact.login)
                    {
                        talk.Focus();
                        return;
                    }
                }

                int talkId = _communicator.archive.getNextId();
                Talk newTalk = new Talk(this, _communicator.getLogedUser(), talkId, contact.login, contact.name);
                _activeTalks.Add(newTalk);
                newTalk.Show();                
            }
            else if (contactList.SelectedItems.Count > 1) 
            {
                MessageBox.Show("W tej chwili komunikator nie obsługuje rozmów konferencyjnych");
            }
            
        }