示例#1
0
        private void BtnEditPet_Click(object sender, RoutedEventArgs e)
        {
            if (dgPets.SelectedIndex > -1)
            {
                var selectedPet = (Pet)dgPets.SelectedItem;

                if (selectedPet == null)
                {
                    MessageBox.Show("No Selected Pets.");
                }
                else
                {
                    var petDetail = new frmAddEditPet(selectedPet, null, true);

                    petDetail.ShowDialog();

                    if (petDetail.DialogResult == true)
                    {
                        populatePets();
                    }
                }
            }
            else
            {
                MessageBox.Show("Please select a pet to edit");
            }
        }
示例#2
0
        private void BtnCreatePet_Click(object sender, RoutedEventArgs e)
        {
            var addPet = new frmAddEditPet();
            var result = addPet.ShowDialog();

            if (result == true)
            {
                populatePets();
            }
        }