예제 #1
0
 private void tmCheckNotify_Tick(object sender, EventArgs e)
 {
     if (m_account != null)
     {
         List <MORZEMessages> msgs = null;
         msgs = m_account.GetSendedAndUncofirmedMessages(new TimeSpan(0, 0, 0, 0, tmCheckNotify.Interval));
         if (msgs != null)
         {
             foreach (MORZEMessages mm in msgs)
             {
                 if (mm.Messages.Any())
                 {
                     mm.Messages.OrderBy(x => x.Date);
                     IMORZEContact cnt = m_book.GetContact(mm.ContactAddress, false);
                     if (cnt != null)
                     {
                         MORZEContact mc = cnt as MORZEContact;
                         mc.clearAllExt();
                         m_net.SendMessage(mm.Messages.FirstOrDefault(), cnt);
                     }
                     else
                     {
                         mm.Messages[0].Status = MORZEMessageStatus.recipUnknown;
                     }
                 }
             }
         }
     }
 }
예제 #2
0
        protected virtual void btnOk_Click(object sender, EventArgs e)
        {
            IMORZEContact cnt = null;

            try
            {
                if (string.IsNullOrEmpty(tbName.Text) == false)
                {
                    if (m_cnt == null)
                    {
                        cnt          = new MORZEContact(tbName.Text, tbAddress.Text);
                        m_cnt        = cnt;
                        DialogResult = DialogResult.OK;
                        Close();
                    }
                }
                else
                {
                    MessageBox.Show("Name is empty", Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #3
0
        private void dlgMessage_FormClosing(object sender, FormClosingEventArgs e)
        {
            MORZEContact mcnt = m_cnt as MORZEContact;

            if (mcnt != null)
            {
                mcnt.OnRecvMessage -= OnRecvMessage;
            }
        }
예제 #4
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            MORZEContact alice = new MORZEContact("Alice", "MRZRBgIAAACkAABSU0ExAAQAAAEAAQDdEHaTbjquPhR0KSWR9Jr2I+6QtkANZqQGu9lHfNQBocy7M0jRlTV+Jd3A/0/P+ixJUazLbV7BlXfHgwomTdX3g9FbnafjHM5psmX5ZDGN/YAKFUGkH+Gt+otxDq8K2wNlUMChSL3wpYqOrsFRSVzpXkk1Xmtgzd6BfXveewEIuA==");

            client.SendMessage("Hello Alice", alice);



            // hash=client.Send(sms);
        }
예제 #5
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;
        }
예제 #6
0
        private void dlgMessage_Load(object sender, EventArgs e)
        {
            Text = string.Format("{0} - {1}", m_acc.ToString(), m_cnt.ToString());
            MORZEContact mcnt = m_cnt as MORZEContact;

            if (mcnt != null)
            {
                mcnt.OnRecvMessage += OnRecvMessage;

                MORZEMessages msgs = m_acc.GetMessages(m_cnt);
                if (msgs != null)
                {
                    List <MORZEMessage> m;
                    if (m_lastLoadedMessage != null)
                    {
                        m = msgs.Messages.Where(x => x.Date > m_lastLoadedMessage).ToList();
                    }
                    else
                    {
                        m = msgs.Messages;
                    }
                    m = m.OrderBy(x => x.Date).ToList();

                    foreach (MORZEMessage i in m)
                    {
                        if (i.Status == MORZEMessageStatus.recived)
                        {
                            PutDisplayMessage(m_cnt.ToString(), i.ToString(), false);
                        }
                        else
                        {
                            PutDisplayMessage(m_acc.ToString(), i.ToString(), true);
                        }
                        m_lastLoadedMessage = i.Date;
                    }
                }
            }
        }