コード例 #1
0
ファイル: lumberWPF.xaml.cs プロジェクト: sashasav10/OOP_Lab4
        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("Изменения не сохранены");
            }
        }
コード例 #2
0
ファイル: lumberWPF.xaml.cs プロジェクト: sashasav10/OOP_Lab4
        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("Изменения не сохранены");
            }
        }