private void cmdAddContact_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var newID = 0;
         if (_Contacts.Count > 0)
         {
             newID = _Contacts.Max(c => c.ID) + 1;
         }
         var dlgContact = new WndContacts(newID, _Groups) { Owner = this };
         dlgContact.ContactChanged += dlgContact_ContactChanged;
         var showDialog = dlgContact.ShowDialog();
         if (showDialog == null || !showDialog.Value)
         {
             dlgContact.ContactChanged -= dlgContact_ContactChanged;
             return;
         }
         fillContacts(false);
         fillGroups(false);
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex);
     }
 }
 private void editContact()
 {
     try
     {
         var cont = getSelectedContact();
         if (cont == null) return;
         var dlgContact = new WndContacts(cont, _Groups) { Owner = this };
         dlgContact.ContactChanged += dlgContact_ContactChanged;
         var showDialog = dlgContact.ShowDialog();
         if (showDialog == null || !showDialog.Value)
         {
             dlgContact.ContactChanged -= dlgContact_ContactChanged;
         }
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex);
     }
 }
Exemple #3
0
 private void actionAddContact()
 {
     try
     {
         var newId = 0;
         if (PNStatic.Contacts.Count > 0)
         {
             newId = PNStatic.Contacts.Max(c => c.ID) + 1;
         }
         var dlgContact = new WndContacts(newId, PNStatic.ContactGroups) { Owner = this };
         dlgContact.ContactChanged += dlgContact_ContactChanged;
         var showDialog = dlgContact.ShowDialog();
         if (showDialog == null || !showDialog.Value)
         {
             dlgContact.ContactChanged -= dlgContact_ContactChanged;
         }
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex);
     }
 }