private void actionButton_Click(object sender, EventArgs e) { var context = LocalizationManifest.Get.CurrentLanguage["FormDesign"]; Action <DesignInfo> disbandDesign = x => this.controller.DisbandDesign(this.data); Action <DesignInfo> keepDesign = x => this.controller.KeepDesign(this.data); Action <DesignInfo> refitDesign = x => this.controller.RefitDesign(this.data, x); var formatter = new ThousandsFormatter(); var refitOptions = new IShipComponentType[] { new ShipComponentType <DesignInfo>(context["disbandDesign"].Text(), global::Stareater.Properties.Resources.cancel, null, disbandDesign), new ShipComponentType <DesignInfo>(context["keepDesign"].Text(), global::Stareater.Properties.Resources.start, null, keepDesign) }.Concat( this.controller.RefitCandidates(this.data).Where(x => x.Constructable).Select(x => new ShipComponentType <DesignInfo>( x.Name + Environment.NewLine + context["refitCost"].Text() + ": " + formatter.Format(this.controller.RefitCost(this.data, x)), ImageCache.Get[x.ImagePath], x, refitDesign ))); using (var form = new FormPickComponent(context["refitTitle"].Text(), refitOptions)) form.ShowDialog(); this.makeNameText(); }
private void pickShieldAction_Click(object sender, EventArgs e) { Action <ShieldInfo> selectShield = x => this.controller.Shield = x; var shields = new IShipComponentType[] { new ShipComponentType <ShieldInfo>(this.context["unselectComponent"].Text(), null, null, selectShield) }.Concat( this.controller.Shields().Select(x => new ShipComponentType <ShieldInfo>( x.Name, ImageCache.Get[x.ImagePath], x, selectShield ))); using (var form = new FormPickComponent(this.context["shieldPickTitle"].Text(), shields)) form.ShowDialog(); if (this.controller.Shield != null) { this.pickShieldAction.Text = this.controller.Shield.Name; this.shieldImage.Visible = true; this.shieldImage.Image = ImageCache.Get[this.controller.Shield.ImagePath]; } else { this.pickShieldAction.Text = this.context["noShield"].Text(); this.shieldImage.Visible = false; this.shieldImage.Image = null; } updateInfos(); }
private void selectColonizerAction_Click(object sender, EventArgs e) { var title = LocalizationManifest.Get.CurrentLanguage["FormColonization"]["colonizerTitle"].Text(); var options = controller.ColonizerDesignOptions.Select(desing => new ShipComponentType<DesignInfo>( desing.Name, ImageCache.Get[desing.ImagePath], 0, desing, x => pickColonizer(x) )); using (var form = new FormPickComponent(title, options)) form.ShowDialog(); }
private void addEquipAction_Click(object sender, EventArgs e) { var missionEquipmnet = this.controller.MissionEquipment().Select(x => new ShipComponentType <MissionEquipInfo>( x.Name, ImageCache.Get[x.ImagePath], x, addMissionEquip )); var specialEquipmnet = this.controller.SpecialEquipment().Where(x => !this.controller.HasSpecialEquip(x)).Select(x => new ShipComponentType <SpecialEquipInfo>( x.Name, ImageCache.Get[x.ImagePath], x, addSpecialEquip )); using (var form = new FormPickComponent(this.context["equipPickTitle"].Text(), missionEquipmnet, this.context["specEquipSeparator"].Text(), specialEquipmnet)) form.ShowDialog(); updateInfos(); }