private void Hyperlink_Click(object sender, RoutedEventArgs e) { Regex rgx = new Regex(@"^[0-9]+$"); if (rgx.IsMatch(AddNum.Text)) { BusinessLayer.ConversationManager cm = new BusinessLayer.ConversationManager(); EntityLayer.Contact contacts = cm.getContactFromString(AddNum.Text); if (contacts == null) { EntityLayer.Contact c; if (AddNom.Text.Length == 0) { c = new EntityLayer.Contact(AddNum.Text); } else { c = new EntityLayer.Contact(AddNom.Text, AddNum.Text); } cm.addContact(c); IList<EntityLayer.Contact> icon = cm.getContacts(); parentWindow.ListContact.DataContext = new ViewModel.Contact.ContactsModelView(icon); } this.Close(); } else { AddTitle.Text = "Ajout d'un contact (Numéro Invalide)"; } }
public ContactModelView(EntityLayer.Contact contact) { m_contact = contact; }