Ejemplo n.º 1
0
        private void Mnu_Reinforce_Click(object sender, RoutedEventArgs e)
        {
            if (dgv_Overview.SelectedItems.Count > 0)
            {
                var selectedItems = dgv_Overview.SelectedItems;
                IList <CarboGroup> selectedGroups = new List <CarboGroup>();

                // ... Add all Names to a List.
                foreach (var item in selectedItems)
                {
                    CarboGroup cg = item as CarboGroup;
                    selectedGroups.Add(cg);
                }

                CarboGroup bufferGroup = selectedGroups[0].Copy();


                for (int i = 1; i <= (selectedGroups.Count - 1); i++)
                {
                    CarboGroup carboGroupTemp = selectedGroups[i];
                    bufferGroup.Volume += carboGroupTemp.Volume;
                }

                if (bufferGroup != null)
                {
                    ReinforcementWindow reinforementWindow = new ReinforcementWindow(CarboLifeProject.CarboDatabase, bufferGroup);
                    reinforementWindow.ShowDialog();

                    if (reinforementWindow.isAccepted == true)
                    {
                        if (reinforementWindow.createNew == true)
                        {
                            CarboLifeProject.AddGroup(reinforementWindow.reinforcementGroup);
                        }
                        else
                        {
                            foreach (var item in selectedItems)
                            {
                                CarboGroup cg = item as CarboGroup;
                                if (cg != null)
                                {
                                    cg.Additional            = reinforementWindow.addtionalValue;
                                    cg.AdditionalDescription = reinforementWindow.additionalDescription;
                                }
                            }
                        }
                    }
                }
            }

            CarboLifeProject.CalculateProject();
            refreshData();
        }
Ejemplo n.º 2
0
        private void Mnu_Reinforce_Click(object sender, RoutedEventArgs e)
        {
            CarboGroup carboGroup = (CarboGroup)dgv_Overview.SelectedItem;

            if (carboGroup != null)
            {
                ReinforcementWindow reinforementWindow = new ReinforcementWindow(CarboLifeProject.CarboDatabase, carboGroup);
                reinforementWindow.ShowDialog();

                if (reinforementWindow.isAccepted == true)
                {
                    CarboLifeProject.AddGroup(reinforementWindow.reinforcementGroup);
                }
            }
            SortData();
        }