private void LookUpThread(object s) { ISystem sys = s as ISystem; string url = ""; string defaulturl = ""; if (source == "EDSM") { EDSMClass edsm = new EDSMClass(); url = edsm.GetUrlToSystem(sys.Name); defaulturl = EDSMClass.ServerAddress; } else if (source == "Spansh") { if (sys.SystemAddress.HasValue) { url = Properties.Resources.URLSpanshSystemSystemId + sys.SystemAddress.Value.ToStringInvariant(); } else { url = "https://spansh.co.uk"; } defaulturl = urlallowed; } else if (source == "EDDB") { url = Properties.Resources.URLEDDBSystemName + System.Web.HttpUtility.UrlEncode(sys.Name); defaulturl = urlallowed; } else if (source == "Inara") { url = Properties.Resources.URLInaraStarSystem + System.Web.HttpUtility.UrlEncode(sys.Name); defaulturl = urlallowed; } System.Diagnostics.Debug.WriteLine("Url is " + last_sys_tracked.Name + "=" + url); this.BeginInvoke((MethodInvoker) delegate { if (!isClosing) { if (url.HasChars()) { SetControlText("Data on " + sys.Name); webBrowser.Navigate(url); } else { SetControlText("No Data on " + sys.Name); webBrowser.Navigate(defaulturl); } } }); }
public void Bookmark(BookmarkClass bk) // from multiple places, update this bookmark, region or system.. { string note = ""; string name; if (!bk.isRegion) { InitialisePos(bk.x, bk.y, bk.z); SystemNoteClass sn = SystemNoteClass.GetNoteOnSystem(bk.StarName); note = (sn != null) ? sn.Note : ""; name = bk.StarName; } else { // region, set position, set name InitialisePos(bk.x, bk.y, bk.z); name = bk.Heading; } this.Text = "Update Bookmark".T(EDTx.BookmarkForm_UB); buttonOK.Text = "Update".T(EDTx.BookmarkForm_Update); textBoxName.Text = name; textBoxName.ReadOnly = !bk.isRegion; textBoxName.ReturnPressed += (ctrl) => { return(true); }; textBoxBookmarkNotes.Text = bk.Note; textBoxBookmarkNotes.CursorToEnd(); textBoxBookmarkNotes.ScrollToCaret(); textBoxTravelNote.Text = note; textBoxTime.Text = EDDConfig.Instance.ConvertTimeToSelectedFromUTC(bk.TimeUTC).ToString(); checkBoxTarget.Checked = bk.id == TargetClass.GetTargetBookmark(); // who is the target of a bookmark (0=none) //foreach (Control c in panelOuter.Controls) System.Diagnostics.Debug.WriteLine("All Control {0} at {1}", c.Name, c.Top); if (bk.isRegion) { HideEDSM(); HideTravelNote(); // in order note HideSurfaceBookmarks(); } else { var edsm = new EDSMClass(); edsmurl = edsm.GetUrlToSystem(name); SurfaceBookmarks.Init(bk.StarName, helist, bk.PlanetaryMarks); } buttonOK.Enabled = true; }
public void NewSystemBookmark(ISystem system, string note, DateTime timeutc) // from multipe, create a new system bookmark { this.Text = "New System Bookmark".T(EDTx.BookmarkForm_SB); textBoxName.Text = system.Name; textBoxName.ReturnPressed += (ctrl) => { return(true); }; textBoxTravelNote.Text = note; textBoxTime.Text = EDDConfig.Instance.ConvertTimeToSelectedFromUTC(timeutc).ToString(); InitialisePos(system); buttonDelete.Hide(); var edsm = new EDSMClass(); edsmurl = edsm.GetUrlToSystem(system.Name); SurfaceBookmarks.Init(system.Name, helist); buttonOK.Enabled = true; }
public void NotedSystem(string name, string note, bool istarget) // from target, a system with notes { this.Text = "System Information".T(EDTx.BookmarkForm_SI); textBoxName.Text = name; textBoxName.ReturnPressed += (ctrl) => { return(true); }; textBoxTravelNote.Text = (note != null) ? note : ""; checkBoxTarget.Checked = istarget; HideTime(); HideBookmarkNotes(); HideSurfaceBookmarks(); var edsm = new EDSMClass(); edsmurl = edsm.GetUrlToSystem(name); }
private void textBox_TextChanged(object sender, EventArgs e) { if (validatestarname) { ISystem f = SystemCache.FindSystem(textBoxName.Text, null, false); // no edsm lookup, too slow to do interactively. if (f != null && f.HasCoordinate) { InitialisePos(f); var edsm = new EDSMClass(); edsmurl = edsm.GetUrlToSystem(f.Name); SurfaceBookmarks.Init(f.Name, helist); } else { textBoxX.Text = textBoxY.Text = textBoxZ.Text = ""; } buttonEDSM.Enabled = buttonOK.Enabled = ValidateData() && f != null; } else { buttonOK.Enabled = ValidateData(); } }