private void textBoxTarget_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { TargetHelpers.SetTargetSystem(this, discoveryform, textBoxTarget.Text); } }
private void setTargetToolStripMenuItem_Click(object sender, EventArgs e) { int[] selectedRows = dataGridViewExplore.SelectedCells.OfType <DataGridViewCell>().Where(c => c.RowIndex != dataGridViewExplore.NewRowIndex).Select(c => c.RowIndex).OrderBy(v => v).Distinct().ToArray(); if (selectedRows.Length == 0) { return; } var obj = dataGridViewExplore[0, selectedRows[0]].Value; if (obj == null) { return; } TargetHelpers.SetTargetSystem(this, discoveryform, (string)obj); }
// double percent = -10; Timer t = new Timer();// play thru harness private void Display(ISystem cursys) { if (currentRoute == null) { DisplayText("Please set a route, by right clicking".T(EDTx.UserControlRouteTracker_NoRoute), "", ""); return; } if (currentRoute.Systems.Count == 0) { DisplayText(currentRoute.Name, "Route contains no waypoints".T(EDTx.UserControlRouteTracker_NoWay), ""); return; } string topline = "", bottomline = "", note = ""; if (!cursys.HasCoordinate) { topline = String.Format("Unknown location".T(EDTx.UserControlRouteTracker_Unk)); bottomline = ""; } else { SavedRouteClass.ClosestInfo closest = currentRoute.ClosestTo(cursys); if (closest == null) // if null, no systems found.. uh oh { topline = String.Format("No systems in route have known co-ords".T(EDTx.UserControlRouteTracker_NoCo)); bottomline = ""; } else { double routedistance = currentRoute.CumulativeDistance(); double distleft = closest.disttowaypoint + (closest.deviation < 0 ? 0 : closest.cumulativewpdist); topline = String.Format("{0} {1} WPs, {2:N1}ly", currentRoute.Name, currentRoute.Systems.Count, routedistance); EliteDangerousCalculations.FSDSpec.JumpInfo ji = currentHE.GetJumpInfo(); string jumpmsg = ""; if (showJumpsToolStripMenuItem.Checked && ji != null) { int jumps = (int)Math.Ceiling(routedistance / ji.avgsinglejump); if (jumps > 0) { topline += ", " + jumps.ToString() + " " + ((jumps == 1) ? "jump".T(EDTx.UserControlRouteTracker_J1) : "jumps".T(EDTx.UserControlRouteTracker_JS)); } jumps = (int)Math.Ceiling(closest.disttowaypoint / ji.avgsinglejump); if (jumps > 0) { jumpmsg = ", " + jumps.ToString() + " " + ((jumps == 1) ? "jump".T(EDTx.UserControlRouteTracker_J1) : "jumps".T(EDTx.UserControlRouteTracker_JS)); } else { jumpmsg = " No Ship FSD Information".T(EDTx.UserControlRouteTracker_NoFSD); } } string wpposmsg = closest.system.Name; if (showWaypointCoordinatesToolStripMenuItem.Checked) { wpposmsg += String.Format(" @{0:N1},{1:N1},{2:N1}", closest.system.X, closest.system.Y, closest.system.Z); } wpposmsg += String.Format(" {0:N1}ly", closest.disttowaypoint); if (closest.deviation < 0) // if not on path { bottomline += closest.cumulativewpdist == 0 ? "From Last WP ".T(EDTx.UserControlRouteTracker_FL) : "To First WP ".T(EDTx.UserControlRouteTracker_TF); bottomline += wpposmsg + jumpmsg; } else { topline += String.Format(", Left {0:N1}ly".T(EDTx.UserControlRouteTracker_LF), distleft); bottomline += String.Format("To WP {0} ".T(EDTx.UserControlRouteTracker_ToWP), closest.waypoint + 1); bottomline += wpposmsg + jumpmsg; if (showDeviationFromRouteToolStripMenuItem.Checked) { bottomline += String.Format(", Dev {0:N1}ly".T(EDTx.UserControlRouteTracker_Dev), closest.deviation); } } if (showBookmarkNotesToolStripMenuItem.Checked) { BookmarkClass bookmark = GlobalBookMarkList.Instance.FindBookmarkOnSystem(cursys.Name); if (bookmark != null) { note = String.Format("Note: {0}".T(EDTx.UserControlRouteTracker_Note), bookmark.Note); } } //System.Diagnostics.Debug.WriteLine("T:" + topline + Environment.NewLine + "B:" + bottomline); string name = closest.system.Name; if (lastsystem == null || name.CompareTo(lastsystem) != 0) { if (autoCopyWPToolStripMenuItem.Checked) { SetClipboardText(name); } if (autoSetTargetToolStripMenuItem.Checked) { string targetName; double x, y, z; TargetClass.GetTargetPosition(out targetName, out x, out y, out z); if (name.CompareTo(targetName) != 0) { TargetHelpers.SetTargetSystem(this, discoveryform, name, false); } } lastsystem = name; } } } DisplayText(topline, bottomline, note); }