Esempio n. 1
0
        private void CreateWood_Button_Click(object sender, RoutedEventArgs e)
        {
            Wood    newWood   = new Wood();
            woodWPF woodModal = new woodWPF(newWood);

            if (woodModal.ShowDialog() == true)
            {
                Woods_ComboBox.Items.Add(newWood.ToString());
                woods.Add(newWood);
                Wood.WriteWoodsToFile("Woods", woods);
            }
            else
            {
                MessageBox.Show("Изменения не сохранены");
            }
        }
Esempio n. 2
0
        private void EditWood_Button_Click(object sender, RoutedEventArgs e)
        {
            int selectedIndex = Woods_ComboBox.SelectedIndex;

            if (selectedIndex < 0 || selectedIndex >= woods.Count)
            {
                MessageBox.Show("Необходимо выбрать древесину!");
                return;
            }
            woodWPF woodModal = new woodWPF(woods[selectedIndex]);

            if (woodModal.ShowDialog() == true)
            {
                Woods_ComboBox.Items[selectedIndex] = woods[selectedIndex].ToString();
                Wood.WriteWoodsToFile("Woods", woods);
            }
            else
            {
                MessageBox.Show("Изменения не сохранены");
            }
        }