Exemplo n.º 1
0
        private void Create_Button_Click(object sender, RoutedEventArgs e)
        {
            Workshop    newWorkshop   = new Workshop();
            workshopWPF workshopModal = new workshopWPF(newWorkshop);

            if (workshopModal.ShowDialog() == true)
            {
                newWorkshop.Count = Workshops_List.Items.Count + 1;
                Workshops_List.Items.Add(newWorkshop.ToShortString());
                workshops.Add(newWorkshop);
            }
            else
            {
                MessageBox.Show("Изменения не сохранены");
            }
        }
Exemplo n.º 2
0
 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);
             });
         }
     }
 }