Ejemplo n.º 1
0
        public void ShowSystemInformation(DataGridViewRow rw)
        {
            StoreSystemNote(true);      // save any previous note

            HistoryEntry he = null;

            if (rw == null)
            {
                textBoxSystem.Text         = textBoxBody.Text = textBoxX.Text = textBoxY.Text = textBoxZ.Text =
                    textBoxAllegiance.Text = textBoxEconomy.Text = textBoxGovernment.Text =
                        textBoxVisits.Text = textBoxState.Text = textBoxHomeDist.Text = richTextBoxNote.Text = textBoxSolDist.Text = "";
                buttonRoss.Enabled         = buttonEDDB.Enabled = false;
            }
            else
            {
                he = userControlTravelGrid.GetHistoryEntry(rw.Index);     // reload, it may have changed
                Debug.Assert(he != null);

                _discoveryForm.history.FillEDSM(he, reload: true); // Fill in any EDSM info we have, force it to try again.. in case system db updated

                notedisplayedhe = he;

                textBoxSystem.Text = he.System.name;
                textBoxBody.Text   = he.WhereAmI;

                if (he.System.HasCoordinate)         // cursystem has them?
                {
                    textBoxX.Text = he.System.x.ToString(SingleCoordinateFormat);
                    textBoxY.Text = he.System.y.ToString(SingleCoordinateFormat);
                    textBoxZ.Text = he.System.z.ToString(SingleCoordinateFormat);

                    ISystem homesys = _discoveryForm.GetHomeSystem();

                    toolTipEddb.SetToolTip(textBoxHomeDist, $"Distance to home system ({homesys.name})");
                    textBoxHomeDist.Text = SystemClassDB.Distance(he.System, homesys).ToString(SingleCoordinateFormat);
                    textBoxSolDist.Text  = SystemClassDB.Distance(he.System, 0, 0, 0).ToString(SingleCoordinateFormat);
                }
                else
                {
                    textBoxX.Text        = "?";
                    textBoxY.Text        = "?";
                    textBoxZ.Text        = "?";
                    textBoxHomeDist.Text = "";
                    textBoxSolDist.Text  = "";
                }

                int count = _discoveryForm.history.GetVisitsCount(he.System.name);
                textBoxVisits.Text = count.ToString();

                bool enableedddross = (he.System.id_eddb > 0);  // Only enable eddb/ross for system that it knows about

                buttonRoss.Enabled = buttonEDDB.Enabled = enableedddross;

                textBoxAllegiance.Text = he.System.allegiance.ToNullUnknownString();
                textBoxEconomy.Text    = he.System.primary_economy.ToNullUnknownString();
                textBoxGovernment.Text = he.System.government.ToNullUnknownString();
                textBoxState.Text      = he.System.state.ToNullUnknownString();
                richTextBoxNote.Text   = he.snc != null ? he.snc.Note : "";

                _discoveryForm.CalculateClosestSystems(he.System, (s, d) => NewStarListComputed(s.name, d));
            }

            if (OnTravelSelectionChanged != null)
            {
                OnTravelSelectionChanged(he, _discoveryForm.history);
            }
        }