コード例 #1
0
        private void createAnimalToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CreateAnimal createForm = new CreateAnimal();//Show form for create

            //new animal
            if (createForm.ShowDialog() == DialogResult.OK)
            {
                //if animal created successed refill ListView
                FillListView();
            }
        }
コード例 #2
0
        private void editAnimalToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int selectedAnimalCount = lvAnimals.SelectedItems.Count;

            if (selectedAnimalCount != 0)
            {
                ListViewItem selectedAnimal = lvAnimals.SelectedItems[0];
                Guid         selectedId     = Guid.Parse(selectedAnimal.SubItems[3].Text);
                Animal       animal         = _context.Animals.First(x => x.Id == selectedId);

                CreateAnimal editForm = new CreateAnimal(animal);

                if (editForm.ShowDialog() == DialogResult.OK)
                {
                    FillListView();
                }
            }
        }