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); }
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; }
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); })); }
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); }
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); }
public MORZEMessages(IMORZEContact contact) { //m_account = account; //m_contact = contact; m_contactAddress = contact.GetAddress(); }