Ejemplo n.º 1
0
        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)";
            }
        }
Ejemplo n.º 2
0
        public void ContactWindow_Loaded(object sender, RoutedEventArgs e)
        {
            BusinessLayer.ConversationManager cm = new BusinessLayer.ConversationManager();

            IList<EntityLayer.Contact> contacts = cm.getContacts();
            ViewModel.Contact.ContactsModelView cmv = new ViewModel.Contact.ContactsModelView(contacts);
            ListContact.DataContext = cmv;
        }
Ejemplo n.º 3
0
        private void MenuItem_Delete_Click(object sender, RoutedEventArgs e)
        {
            BusinessLayer.ConversationManager cm = new BusinessLayer.ConversationManager();

            if (ListContact.SelectedItem != null)
            {
                cm.removeContact(((ContactModelView)ListContact.SelectedItem).Contact);
                IList<EntityLayer.Contact> contacts = cm.getContacts();
                ViewModel.Contact.ContactsModelView cmv = new ViewModel.Contact.ContactsModelView(contacts);
                ListContact.DataContext = cmv;
            }
        }