コード例 #1
0
        public void NotedSystem(string name, string note, bool target)
        {
            this.Text = "System Information";
            buttonCancel.Hide();
            buttonDelete.Hide();
            textBoxNotes.Hide();
            textBoxTime.Hide();
            labelTimeMade.Hide();
            labelBookmarkNotes.Hide();
            textBoxName.Text       = name;
            textBoxTravelNote.Text = (note != null) ? note : "";

            int delta = textBoxTravelNote.Location.Y - checkBoxTarget.Location.Y;       // before we move it

            checkBoxTarget.Location = new Point(checkBoxTarget.Location.X, labelTimeMade.Location.Y);
            buttonEDSM.Location     = new Point(buttonEDSM.Location.X, labelTimeMade.Location.Y);

            ShiftLocationY(buttonOK, delta);
            ShiftLocationY(labelTravelNote, delta);
            ShiftLocationY(labelTravelNoteEdit, delta);
            ShiftLocationY(textBoxTravelNote, delta);
            this.Height           -= delta;
            checkBoxTarget.Checked = target;

            var edsm = new EDSMClass();

            edsmurl = edsm.GetUrlToEDSMSystem(name);
        }
コード例 #2
0
        private void buttonEDSMTarget_Click(object sender, EventArgs e)
        {
            string name;
            long?  edsmid = null;
            double x, y, z;

            if (TargetClass.GetTargetPosition(out name, out x, out y, out z))
            {
                ISystem sc = this.discoveryform.history.FindSystem(TargetClass.GetNameWithoutPrefix(name), discoveryform.galacticMapping);

                if (sc != null)
                {
                    name   = sc.Name;
                    edsmid = sc.EDSMID;
                }
            }

            EDSMClass edsm = new EDSMClass();
            string    url  = edsm.GetUrlToEDSMSystem(name, edsmid);

            if (url.Length > 0)         // may pass back empty string if not known, this solves another exception
            {
                Process.Start(url);
            }
            else
            {
                ExtendedControls.MessageBoxTheme.Show(FindForm(), "System unknown to EDSM".T(EDTx.UserControlSysInfo_SysUnk));
            }
        }
コード例 #3
0
ファイル: BookmarkForm.cs プロジェクト: kkdawkins/EDDiscovery
        public void Bookmark(BookmarkClass bk)        // from multiple places, update this bookmark, region or system..
        {
            string note = "";
            string name;
            long?  edsmid = null;

            if (!bk.isRegion)
            {
                ISystem s = SystemCache.FindSystem(bk.StarName);
                if (s != null)    // paranoia
                {
                    InitialisePos(s);
                    edsmid = s.EDSMID;
                }
                else
                {
                    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.GetUrlToEDSMSystem(name, edsmid);
                SurfaceBookmarks.Init(bk.StarName, bk.PlanetaryMarks);
            }


            buttonOK.Enabled = true;
        }
コード例 #4
0
        private void buttonEDSM_Click(object sender, EventArgs e)
        {
            HistoryEntry sys = userControlTravelGrid.GetCurrentHistoryEntry;

            if (sys != null)
            {
                _discoveryForm.history.FillEDSM(sys, reload: true);
            }

            if (sys != null && sys.System != null) // solve a possible exception
            {
                if (!String.IsNullOrEmpty(sys.System.name))
                {
                    long?id_edsm = sys.System.id_edsm;
                    if (id_edsm <= 0)
                    {
                        id_edsm = null;
                    }

                    EDSMClass edsm = new EDSMClass();
                    string    url  = edsm.GetUrlToEDSMSystem(sys.System.name, id_edsm);

                    if (url.Length > 0)         // may pass back empty string if not known, this solves another exception
                    {
                        Process.Start(url);
                    }
                    else
                    {
                        EDDiscovery.Forms.MessageBoxTheme.Show("System unknown to EDSM");
                    }
                }
            }
        }
コード例 #5
0
        private void buttonEDSM_Click(object sender, EventArgs e)
        {
            if (last_he != null)
            {
                discoveryform.history.FillEDSM(last_he, reload: true);

                if (last_he.System != null) // solve a possible exception
                {
                    if (!String.IsNullOrEmpty(last_he.System.name))
                    {
                        long?id_edsm = last_he.System.id_edsm;
                        if (id_edsm <= 0)
                        {
                            id_edsm = null;
                        }

                        EDSMClass edsm = new EDSMClass();
                        string    url  = edsm.GetUrlToEDSMSystem(last_he.System.name, id_edsm);

                        if (url.Length > 0)         // may pass back empty string if not known, this solves another exception
                        {
                            Process.Start(url);
                        }
                        else
                        {
                            ExtendedControls.MessageBoxTheme.Show("System unknown to EDSM");
                        }
                    }
                }
            }
        }
コード例 #6
0
        private void textBoxName_Validated(object sender, EventArgs e)
        {
            if (!freeSystemEntry)
            {
                return;
            }
            string  t = textBoxName.Text.Trim();
            ISystem s = SystemClassDB.GetSystem(t);

            if (s != null)
            {
                var edsm = new EDSMClass();
                edsmurl = edsm.GetUrlToEDSMSystem(t);
                userControlSurfaceBookmarks1.NewForSystem(t);
                SystemNoteClass sn = SystemNoteClass.GetNoteOnSystem(t);
                textBoxNotes.Text = (sn != null) ? sn.Note : "";
                InitialisePos(s);
                buttonOK.Enabled    = true;
                labelBadSystem.Text = "";
            }
            else
            {
                buttonOK.Enabled = false;
                textBoxName.SelectAll();
                labelBadSystem.Text = "System name not recognised";
            }
        }
コード例 #7
0
        private void LookUpThread(object s)
        {
            ISystem sys = s as ISystem;

            EDSMClass edsm = new EDSMClass();
            string    url  = edsm.GetUrlToEDSMSystem(sys.Name, sys.EDSMID);

            System.Diagnostics.Debug.WriteLine("Url is " + last_sys.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(EDSMClass.ServerAddress);
                    }
                }
            });
        }
コード例 #8
0
        public void Update(string name, string note, string bookmarknote, string tme, bool regionmark, bool istarget)
        {
            this.Text            = "Update Bookmark";
            buttonOK.Text        = "Update";
            textBoxName.Text     = name;
            textBoxName.ReadOnly = !regionmark;
            textBoxNotes.Text    = bookmarknote;
            textBoxNotes.CursorToEnd();
            textBoxNotes.ScrollToCaret();
            textBoxTravelNote.Text = note;
            textBoxTime.Text       = tme;
            checkBoxTarget.Checked = istarget;

            if (regionmark)
            {
                buttonEDSM.Hide();
                labelTravelNote.Hide();
                labelTravelNoteEdit.Hide();
                textBoxTravelNote.Hide();
                int delta = buttonOK.Location.Y - labelTravelNote.Location.Y;
                ShiftLocationY(buttonOK, delta);
                ShiftLocationY(buttonCancel, delta);
                ShiftLocationY(buttonDelete, delta);
                this.Height -= delta;
            }
            else
            {
                var edsm = new EDSMClass();
                edsmurl = edsm.GetUrlToEDSMSystem(name);
            }
        }
コード例 #9
0
        public void Update(BookmarkClass bk)        // from multiple places, update this bookmark, region or system..
        {
            string note = "";
            string name;
            long?  edsmid = null;

            if (!bk.isRegion)
            {
                ISystem s = SystemCache.FindSystem(bk.StarName);
                if (s != null)    // paranoia
                {
                    InitialisePos(s);
                    edsmid = s.EDSMID;
                }
                else
                {
                    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".Tx(this, "UB");
            buttonOK.Text              = "Update".Tx(this);
            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       = bk.Time.ToString();
            checkBoxTarget.Checked = bk.id == TargetClass.GetTargetBookmark();      // who is the target of a bookmark (0=none)

            if (bk.isRegion)
            {
                HideEDSM();
                HideTravelNote();
                HideSurfaceBookmarks();
            }
            else
            {
                var edsm = new EDSMClass();
                edsmurl = edsm.GetUrlToEDSMSystem(name, edsmid);
                SurfaceBookmarks.Init(bk.StarName, bk.PlanetaryMarks);
            }

            buttonOK.Enabled = true;
        }
コード例 #10
0
        public void NewSystemBookmark(string name, string note, string tme)
        {
            this.Text              = "New System Bookmark";
            textBoxName.Text       = name;
            textBoxTravelNote.Text = note;
            textBoxTime.Text       = tme;
            buttonDelete.Hide();
            var edsm = new EDSMClass();

            edsmurl = edsm.GetUrlToEDSMSystem(name);
        }
コード例 #11
0
        private void buttonEDSMTarget_Click(object sender, EventArgs e)
        {
            EDSMClass edsm = new EDSMClass();
            string    url  = edsm.GetUrlToEDSMSystem(textBoxTarget.Text, null);

            if (url.Length > 0)         // may pass back empty string if not known, this solves another exception
            {
                Process.Start(url);
            }
            else
            {
                ExtendedControls.MessageBoxTheme.Show("System unknown to EDSM");
            }
        }
コード例 #12
0
        private void LookUpThread(object s)
        {
            ISystem sys        = s as ISystem;
            string  url        = "";
            string  defaulturl = "";

            if (source == "EDSM")
            {
                EDSMClass edsm = new EDSMClass();
                url        = edsm.GetUrlToEDSMSystem(sys.Name, sys.EDSMID);
                defaulturl = EDSMClass.ServerAddress;
            }
            else if (source == "Spansh")
            {
                if (sys.SystemAddress.HasValue)
                {
                    url = Properties.Resources.URLSpanshSystemSystemId + sys.SystemAddress.Value.ToStringInvariant();
                }
                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.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);
                    }
                }
            });
        }
コード例 #13
0
        private void buttonFromEDSM_Click(object sender, EventArgs e)
        {
            ISystem ds1 = discoveryform.history.FindSystem(SystemNameOnly(textBox_To.Text), discoveryform.galacticMapping);
            string sysname = ds1?.Name ?? SystemNameOnly(textBox_To.Text);
            long? edsmid = ds1?.EDSMID;

            EDSMClass edsm = new EDSMClass();
            string url = edsm.GetUrlToEDSMSystem(sysname, edsmid);

            if (url.Length > 0)         // may pass back empty string if not known, this solves another exception
                Process.Start(url);
            else
                ExtendedControls.MessageBoxTheme.Show(FindForm(), "System unknown to EDSM");
        }
コード例 #14
0
        public void NewSystemBookmark(ISystem system, string note, string tme)
        {
            this.Text              = "New System Bookmark";
            textBoxName.Text       = system.Name;
            textBoxTravelNote.Text = note;
            textBoxTime.Text       = tme;
            InitialisePos(system);
            buttonDelete.Hide();
            var edsm = new EDSMClass();

            edsmurl = edsm.GetUrlToEDSMSystem(system.Name);
            userControlSurfaceBookmarks1.NewForSystem(system.Name);
            buttonOK.Enabled = true;
        }
コード例 #15
0
        public void NewSystemBookmark(ISystem system, string note, DateTime tme)    // from multipe, create a new system bookmark
        {
            this.Text              = "New System Bookmark".Tx(this, "SB");
            textBoxName.Text       = system.Name;
            textBoxTravelNote.Text = note;
            textBoxTime.Text       = tme.ToString();
            InitialisePos(system);
            buttonDelete.Hide();
            var edsm = new EDSMClass();

            edsmurl = edsm.GetUrlToEDSMSystem(system.Name, system.EDSMID);
            SurfaceBookmarks.Init(system.Name);
            buttonOK.Enabled = true;
        }
コード例 #16
0
ファイル: BookmarkForm.cs プロジェクト: kkdawkins/EDDiscovery
        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.GetUrlToEDSMSystem(system.Name, system.EDSMID);
            SurfaceBookmarks.Init(system.Name);
            buttonOK.Enabled = true;
        }
コード例 #17
0
ファイル: BookmarkForm.cs プロジェクト: vasillas/EDDiscovery
        public void NotedSystem(string name, string note, bool istarget)          // from target, a system with notes
        {
            this.Text              = "System Information";
            textBoxName.Text       = name;
            textBoxTravelNote.Text = (note != null) ? note : "";
            checkBoxTarget.Checked = istarget;

            HideTime();
            HideBookmarkNotes();
            HideSurfaceBookmarks();

            var edsm = new EDSMClass();

            edsmurl = edsm.GetUrlToEDSMSystem(name);
        }
コード例 #18
0
        private void extButtonEDSM_Click(object sender, EventArgs e)
        {
            if (lasthe != null)
            {
                EDSMClass edsm = new EDSMClass();
                string    url  = edsm.GetUrlToEDSMSystem(lasthe.System.Name);

                if (url.Length > 0)         // may pass back empty string if not known, this solves another exception
                {
                    System.Diagnostics.Process.Start(url);
                }
                else
                {
                    ExtendedControls.MessageBoxTheme.Show(FindForm(), "System unknown to EDSM");
                }
            }
        }
コード例 #19
0
ファイル: BookmarkForm.cs プロジェクト: kkdawkins/EDDiscovery
        public void NotedSystem(string name, string note, bool istarget)          // from target, a system with notes
        {
            this.Text = "System Information".T(EDTx.BookmarkForm_SI);
            ISystem s = SystemCache.FindSystem(name);

            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.GetUrlToEDSMSystem(s?.Name ?? name, s?.EDSMID);
        }
コード例 #20
0
        public void EDSM_Click(object sender, EventArgs e)
        {
            DrawnPanel dp = sender as DrawnPanel;

            Console.WriteLine("EDSM click on " + dp.Name);

            EDSMClass edsm = new EDSMClass();
            string    url  = edsm.GetUrlToEDSMSystem(dp.Name);

            if (url.Length > 0)         // may pass back empty string if not known, this solves another exception
            {
                System.Diagnostics.Process.Start(url);
            }
            else
            {
                MessageBox.Show("System " + dp.Name + " unknown to EDSM");
            }
        }
コード例 #21
0
        void PresentSystem(ISystem sys)
        {
            SetControlText("No Entry");
            if (sys != null)
            {
                EDSMClass edsm = new EDSMClass();

                string url = edsm.GetUrlToEDSMSystem(sys.Name, sys.EDSMID);

                if (url.HasChars())
                {
                    SetControlText("Data on " + sys.Name);
                    webBrowser.Navigate(url);
                }
                else
                {
                    SetControlText("No Data on " + sys.Name);
                    webBrowser.Navigate(EDSMClass.ServerAddress);
                }
            }
        }
コード例 #22
0
ファイル: BookmarkForm.cs プロジェクト: kkdawkins/EDDiscovery
        private void textBox_TextChanged(object sender, EventArgs e)
        {
            if (validatestarname)
            {
                ISystem f = SystemCache.FindSystem(textBoxName.Text);
                if (f != null && f.HasCoordinate)
                {
                    InitialisePos(f);
                    var edsm = new EDSMClass();
                    edsmurl = edsm.GetUrlToEDSMSystem(f.Name, f.EDSMID);
                    SurfaceBookmarks.Init(f.Name);
                }
                else
                {
                    textBoxX.Text = textBoxY.Text = textBoxZ.Text = "";
                }

                buttonEDSM.Enabled = buttonOK.Enabled = ValidateData() && f != null;
            }
            else
            {
                buttonOK.Enabled = ValidateData();
            }
        }