Exemple #1
0
        private void UpdateTFUnit(int mod)
        {
            TechnoType tt = cmbTFUnit.SelectedItem as TechnoType;
            TaskForce  tf = SelectedTaskForce();

            if (tf.Mod(tt, mod) != 0)
            {
                olvTFUnits.SetObjects(tf);
            }
            else
            {
                TaskForceEntry tfe = tf.FirstOrDefault(s => s.Unit == tt);
                olvTFUnits.RefreshObject(tfe);
            }

            UpdateTFCost();
        }
Exemple #2
0
        private void olvTFUnits_CellEditFinishing(object sender, BrightIdeasSoftware.CellEditEventArgs e)
        {
            if (!e.Cancel && e.SubItemIndex == 1)
            {
                ComboBox       cmb  = e.Control as ComboBox;
                TaskForce      tf   = SelectedTaskForce();
                TaskForceEntry tfe  = e.RowObject as TaskForceEntry;
                TechnoType     unit = cmb.SelectedItem as TechnoType;

                TaskForceEntry exists = tf.FirstOrDefault(s => s.Unit == unit);

                if (exists != null && exists != tfe && !sameUnitMultiEntry)
                {
                    tf.Remove(tfe.Unit);
                    exists.Count = exists.Count + tfe.Count;
                    olvTFUnits.SetObjects(tf);
                }
                else
                {
                    tfe.Unit = unit;
                    olvTFUnits.RefreshItem(e.ListViewItem);
                }
            }
        }