private void buttonExtConfigure_Click(object sender, EventArgs e) { System.Diagnostics.Debug.Assert(last_si != null); // must be set for this configure button to be visible ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm(); int width = 430; int ctrlleft = 150; f.Add(new ExtendedControls.ConfigurableForm.Entry("L", typeof(Label), "Fuel Warning:".T(EDTx.UserControlModules_FW), new Point(10, 40), new Size(140, 24), "")); f.Add(new ExtendedControls.ConfigurableForm.Entry("FuelWarning", typeof(ExtendedControls.NumberBoxDouble), last_si.FuelWarningPercent.ToString(), new Point(ctrlleft, 40), new Size(width - ctrlleft - 20, 24), "Enter fuel warning level in % (0 = off, 1-100%)".T(EDTx.UserControlModules_TTF)) { numberboxdoubleminimum = 0, numberboxdoublemaximum = 100, numberboxformat = "0.##" }); f.Add(new ExtendedControls.ConfigurableForm.Entry("Sell", typeof(ExtendedControls.ExtButton), "Force Sell".T(EDTx.UserControlModules_ForceSell), new Point(10, 80), new Size(80, 24), null)); f.AddOK(new Point(width - 100, 110), "Press to Accept".T(EDTx.UserControlModules_PresstoAccept)); f.AddCancel(new Point(width - 200, 110), "Press to Cancel".T(EDTx.UserControlModules_PresstoCancel)); f.Trigger += (dialogname, controlname, tag) => { if (controlname == "OK") { double?v3 = f.GetDouble("FuelWarning"); if (v3.HasValue) { f.ReturnResult(DialogResult.OK); } else { ExtendedControls.MessageBoxTheme.Show(this.FindForm(), "A Value is not valid".T(EDTx.UserControlModules_NValid), "Warning".T(EDTx.Warning), MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (controlname == "Cancel" || controlname == "Close") { f.ReturnResult(DialogResult.Cancel); } else if (controlname == "Sell") { if (ExtendedControls.MessageBoxTheme.Show(FindForm(), "Confirm sell of ship:".TxID(EDTx.UserControlModules_ConfirmForceSell) + Environment.NewLine + last_si.ShipNameIdentType, "Warning".T(EDTx.Warning), MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { var je = new EliteDangerousCore.JournalEvents.JournalShipyardSell(DateTime.UtcNow, last_si.ShipFD, last_si.ID, 0, EDCommander.CurrentCmdrID); var jo = je.Json(); je.Add(jo); discoveryform.NewEntry(je); } f.ReturnResult(DialogResult.Cancel); } }; DialogResult res = f.ShowDialogCentred(this.FindForm(), this.FindForm().Icon, "Ship Configure".T(EDTx.UserControlModules_SC), closeicon: true); if (res == DialogResult.OK) { last_si.FuelWarningPercent = f.GetDouble("FuelWarning").Value; Display(); } }