예제 #1
0
        public string UpdateContact(IMORZEContact cnt)
        {
            string       err = null;
            MORZEContact c   = m_contacts.Where(x => x.GetAddress() == cnt.GetAddress()).FirstOrDefault();

            if (c != null)
            {
                c.DisplayName = cnt.ToString();
            }

            return(err);
        }
예제 #2
0
        private void AddContactToList(IMORZEContact contact)
        {
            ListViewItem lvi = new ListViewItem(contact.ToString());

            lvi.Tag         = contact;
            lvi.ToolTipText = contact.GetAddress();
            lvContact.Items.Add(lvi);

            MORZEContact mrz = contact as MORZEContact;

            mrz.OnRecvNotifyAcceptecExtKey += OnRecvNotifyAcceptecExtKey;
            mrz.OnRecvMessage            += OnRecvMessage;
            mrz.OnRecvDeliveredMsgNotify += OnRecvDeliveredMsgNotify;
        }
예제 #3
0
        private void OnRecvMessage(IMORZEContact sender, MORZEMessage msg)
        {
            Invoke(new Action(() =>
            {
                for (int i = 0; i < lvContact.Items.Count; i++)
                {
                    IMORZEContact c = lvContact.Items[i].Tag as IMORZEContact;;
                    if (c != null && c.GetAddress() == sender.GetAddress())
                    {
                        lvContact.Items[i].Font = new Font(lvContact.Items[i].Font, FontStyle.Bold);
                    }
                }

                m_account.AddReciveredMessage(sender, msg);
            }));
        }
예제 #4
0
        public List <MORZEMessage> GetUnsendedNewMessages(IMORZEContact contact, TimeSpan interval)
        {
            List <MORZEMessage> lmsg = null;

            Monitor.Enter(this);

            MORZEMessages msgs = null;

            if (m_Messages != null)
            {
                msgs = m_Messages.Where(x => x.ContactAddress == contact.GetAddress()).FirstOrDefault();
                if (msgs != null)
                {
                    lmsg = msgs.Messages.Where(x => x.Status == MORZEMessageStatus.unsendedNew || (x.Status == MORZEMessageStatus.sended && x.Date + interval < DateTime.Now)).ToList();
                }
            }
            Monitor.Exit(this);

            return(lmsg);
        }
예제 #5
0
        public MORZEMessages GetMessages(IMORZEContact contact)
        {
            Monitor.Enter(this);

            MORZEMessages msgs = null;

            if (m_Messages == null)
            {
                m_Messages = new List <MORZEMessages>();
            }
            else
            {
                msgs = m_Messages.Where(x => x.ContactAddress == contact.GetAddress()).FirstOrDefault();
            }
            if (msgs == null)
            {
                msgs = new MORZEMessages(contact);
                m_Messages.Add(msgs);
            }
            Monitor.Exit(this);

            return(msgs);
        }
예제 #6
0
 public MORZEMessages(IMORZEContact contact)
 {
     //m_account = account;
     //m_contact = contact;
     m_contactAddress = contact.GetAddress();
 }