private void setRouteToolStripMenuItem_Click(object sender, EventArgs e) { ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm(); var routes = SavedRouteClass.GetAllSavedRoutes(); var routenames = (from x in routes select x.Name).ToList(); f.Add(new ExtendedControls.ConfigurableForm.Entry("Route", "", new Point(10, 40), new Size(400, 24), "Select route".Tx(this), routenames)); f.Add(new ExtendedControls.ConfigurableForm.Entry("Cancel", typeof(ExtendedControls.ExtButton), "Cancel".Tx(), new Point(410 - 100, 80), new Size(100, 24), "Press to Cancel".Tx(this))); f.Trigger += (dialogname, controlname, tag) => { if (controlname != "Route") { f.DialogResult = DialogResult.Cancel; } else { f.DialogResult = DialogResult.OK; } f.Close(); }; if (f.ShowDialogCentred(this.FindForm(), this.FindForm().Icon, "Enter route".Tx(this)) == DialogResult.OK) { string routename = f.Get("Route"); currentRoute = routes.Find(x => x.Name.Equals(routename)); // not going to be null, but consider the upset. currentRoute.TestHarness(); // enable for debug if (currentRoute != null) { SQLiteDBClass.PutSettingString(DbSave + "SelectedRoute", currentRoute.Id.ToStringInvariant()); // write ID back } Display(); } }
private void setRouteToolStripMenuItem_Click(object sender, EventArgs e) { ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm(); var routes = SavedRouteClass.GetAllSavedRoutes(); var routenames = (from x in routes select x.Name).ToList(); f.Add(new ExtendedControls.ConfigurableForm.Entry("Route", "", new Point(10, 40), new Size(400, 24), "Select route".T(EDTx.UserControlRouteTracker_Selectroute), routenames)); f.AddCancel(new Point(410 - 100, 80), "Press to Cancel".T(EDTx.UserControlRouteTracker_PresstoCancel)); f.Trigger += (dialogname, controlname, tag) => { if (controlname != "Route") { f.ReturnResult(DialogResult.Cancel); } else { f.ReturnResult(DialogResult.OK); } }; if (f.ShowDialogCentred(this.FindForm(), this.FindForm().Icon, "Enter route".T(EDTx.UserControlRouteTracker_Enterroute), closeicon: true) == DialogResult.OK) { string routename = f.Get("Route"); currentRoute = routes.Find(x => x.Name.Equals(routename)); // not going to be null, but consider the upset. currentRoute.TestHarness(); // enable for debug if (currentRoute != null) { EliteDangerousCore.DB.UserDatabase.Instance.PutSettingString(DbSave + "SelectedRoute", currentRoute.Id.ToStringInvariant()); // write ID back } Display(); } }