Пример #1
0
        // Add clicked: Open EditContactWindow, and set its title to indicate add
        private void button_addContact_Click(object sender, RoutedEventArgs e)
        {
            EditContactWindow editContactWindow = new EditContactWindow();
            editContactWindow.Title = "Add Contact";
            editContactWindow.Owner = this;
            editContactWindow.Show();

            // Initialize the entry
            editContactWindow.InitContractEntry();
        }
Пример #2
0
        // Edit clicked: Open EditContactWindow,
        //  and display the selected contact
        private void button_editContact_Click(object sender, RoutedEventArgs e)
        {
            // Check that non-empty row has been selected
            if (dataGrid_contacts.SelectedItem != null &&
                  dataGrid_contacts.SelectedItem is ContactEntry)
            {
                // Create edit contact window
                EditContactWindow editContactWindow = new EditContactWindow();
                editContactWindow.Title = "Edit Contact";
                editContactWindow.Owner = this;
                editContactWindow.Show();

                // Get row data and display it in edit window
                ContactEntry contact = new ContactEntry();
                contact = (ContactEntry)dataGrid_contacts.SelectedItem;
                editContactWindow.DisplayContactEntry(contact);
            }
        }