Exemplo n.º 1
0
 public void SaveContact()
 {
     try
     {
         IContactModel model = new ContactModel();
         model.Name  = AddressUtility.checkName(Name);
         model.Email = AddressUtility.checkEmail(Email);
         model.Phone = AddressUtility.checkPhone(Phone);
         AddressBook.EditItemMenu(SaveModel.Email, model);
         EventAggregationProvider.EventAggregator.Publish(AddressBook.ListAllMenu());
         TryClose();
     }
     catch (AddressException ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 2
0
 public void AddContact()
 {
     try
     {
         var           name  = AddressUtility.checkName(Name);
         var           email = AddressUtility.checkEmail(Email);
         var           phone = AddressUtility.checkPhone(Phone);
         IContactModel cm    = new ContactModel();
         cm.Name  = name;
         cm.Email = email;
         cm.Phone = phone;
         AddressBook.AddItemMenu(cm);
         EventAggregationProvider.EventAggregator.Publish(AddressBook.ListAllMenu());
         MessageBox.Show(string.Format("Hello {0} {1} {2}!", Name, Email, Phone)); //Don't do this in real life :)
         TryClose();
     }
     catch (AddressException ex)
     {
         MessageBox.Show(ex.Message);
     }
 }