示例#1
0
        private void contactsListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Contact contact = (Contact)contactsListView.SelectedItem;

            if (contact != null)
            {
                ContactDetailsWindow contactDetailsWindow = new ContactDetailsWindow(contact);
                contactDetailsWindow.ShowDialog();
                readDatabase();
            }
        }
        private void NewContactsListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //keep track of the contact selected by user
            Contact selectedContact = (Contact)newContactsListView.SelectedItem;

            if (selectedContact != null)
            {
                //if the contact is not null create a new contact details window with the contacts info
                ContactDetailsWindow contactDetailsWindow = new ContactDetailsWindow(selectedContact);
                //make the user unable to get back to the main window before finishing with the new one
                contactDetailsWindow.ShowDialog();
            }
            ReadDatabase();
        }