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("Изменения не сохранены"); } }
public workshopWPF(Workshop workshop) { InitializeComponent(); workshopWP = workshop; workshopWP.Count = workshop.Count; if (workshopWP != null && workshopWP.Lumbers != null) { CountObject_Label.Content = Lumber_List.Items.Count; workshopWP.CalculateTotalPrice(); TotalPrice_Label.Content = workshop.TotalLumberPrice.ToString(); if (workshop.Lumbers != null) { workshop.Lumbers.ForEach(lumber => { Lumber_List.Items.Add(lumber); }); } } }