Ejemplo n.º 1
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (lstDesigns.SelectedItems.Count == 1)
     {
         var d = (IDesign)lstDesigns.SelectedItems[0].Tag;
         if (d.Owner != Empire.Current)
         {
             MessageBox.Show("You cannot edit alien designs. You can, however, copy them.");
         }
         else
         {
             if (d.TurnNumber < Galaxy.Current.TurnNumber)
             {
                 // TODO - let player edit old designs only if they have never been added to a queue (like in SE4)?
                 MessageBox.Show("You cannot edit a design that was created on a prior turn.");
             }
             else
             {
                 var form = new VehicleDesignForm();
                 form.Design = d;
                 this.ShowChildForm(form);
                 if (form.DialogResult == DialogResult.OK)
                 {
                     BindDesignList();
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            var form = new VehicleDesignForm();

            this.ShowChildForm(form);
            if (form.DialogResult == DialogResult.OK)
            {
                BindDesignList();
            }
        }
Ejemplo n.º 3
0
 private void btnCopy_Click(object sender, EventArgs e)
 {
     if (lstDesigns.SelectedItems.Count == 1)
     {
         IDesign copy = CopyDesign((IDesign)lstDesigns.SelectedItems[0].Tag);
         var     form = new VehicleDesignForm();
         form.Design = copy;
         this.ShowChildForm(form);
         if (form.DialogResult == DialogResult.OK)
         {
             BindDesignList();
         }
     }
 }
Ejemplo n.º 4
0
 private void btnUpgrade_Click(object sender, EventArgs e)
 {
     if (lstDesigns.SelectedItems.Count == 1)
     {
         var old  = (IDesign)lstDesigns.SelectedItems[0].Tag;
         var copy = old.IsObsolescent ? old.LatestVersion : CopyDesign(old);                 // make sure to copy design even if it has no upgradeable parts
         var form = new VehicleDesignForm();
         form.Design = copy;
         this.ShowChildForm(form);
         if (form.DialogResult == DialogResult.OK)
         {
             BindDesignList();
         }
     }
 }