Beispiel #1
0
        private void Create_Button_Click(object sender, RoutedEventArgs e)
        {
            Lumber    newLumber   = new Lumber();
            lumberWPF lumberModal = new lumberWPF(newLumber);

            if (lumberModal.ShowDialog() == true)
            {
                workshopWP.AddLumber(newLumber);
                workshopWP.CalculateTotalPrice();
                Lumber_List.Items.Add(newLumber.ToString());
                TotalPrice_Label.Content  = workshopWP.TotalLumberPrice.ToString();
                CountObject_Label.Content = Lumber_List.Items.Count;
            }
            else
            {
                MessageBox.Show("Изменения не сохранены");
            }
        }
Beispiel #2
0
        private void Edit_Button_Click(object sender, RoutedEventArgs e)
        {
            int selectedIndex = Lumber_List.SelectedIndex;

            if (selectedIndex < 0 || selectedIndex >= workshopWP.Lumbers.Count)
            {
                MessageBox.Show("Выберете пиломатериал!");
                return;
            }
            lumberWPF lumberModal = new lumberWPF(workshopWP.Lumbers[selectedIndex]);

            if (lumberModal.ShowDialog() == true)
            {
                Lumber_List.Items[selectedIndex] = workshopWP.Lumbers[selectedIndex].ToString();
                workshopWP.CalculateTotalPrice();
                TotalPrice_Label.Content  = workshopWP.TotalLumberPrice.ToString();
                CountObject_Label.Content = Lumber_List.Items.Count;
            }
            else
            {
                MessageBox.Show("Changes was not saved");
            }
        }