コード例 #1
0
        private void newContact_Click(object sender, EventArgs e)
        {
            dlgContact dlg = new dlgContact();

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                IMORZEContact contact = dlg.MORZEContact;
                string        err     = m_book.AddContact(contact);
                if (string.IsNullOrEmpty(err) == true)
                {
                    m_book.Save();
                    AddContactToList(contact);
                }
                else
                {
                    MessageBox.Show(err, Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            dlg.Dispose();
        }
コード例 #2
0
 private void properyToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (lvContact.SelectedItems.Count == 1)
     {
         dlgContact dlg = new dlgContact();
         dlg.MORZEContact = lvContact.SelectedItems[0].Tag as IMORZEContact;
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             IMORZEContact contact = dlg.MORZEContact;
             string        err     = m_book.UpdateContact(contact);
             if (string.IsNullOrEmpty(err) == true)
             {
                 m_book.Save();
                 lvContact.SelectedItems[0].Text = contact.ToString();
             }
             else
             {
                 MessageBox.Show(err, Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         dlg.Dispose();
     }
 }