示例#1
0
 private void olvTFUnits_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Delete)
     {
         TaskForce      tf  = SelectedTaskForce();
         TaskForceEntry tfe = olvTFUnits.SelectedObject as TaskForceEntry;
         tf.Remove(tfe.Unit);
         olvTFUnits.SetObjects(tf);
         e.Handled = true;
     }
 }
示例#2
0
        private void olvTFUnits_CellEditFinished(object sender, BrightIdeasSoftware.CellEditEventArgs e)
        {
            TaskForce tf = SelectedTaskForce();

            if (e.SubItemIndex == 0)
            {
                uint           val = (uint)e.NewValue;
                TaskForceEntry tfe = e.RowObject as TaskForceEntry;

                if (val == 0)
                {
                    tf.Remove(tfe.Unit);
                    olvTFUnits.SetObjects(tf);
                }
            }

            UpdateTFCost();
        }
示例#3
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.SingleOrDefault(s => s.Unit == unit);

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