Exemplo n.º 1
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);
     }
 }