private void ReportRefreshProgress(int percentComplete, string message)      // percent not implemented for this
 {
     if (!Controller.PendingClose)
     {
         refreshprogressstring      = message;
         toolStripStatusLabel1.Text = ObjectExtensionsStrings.AppendPrePad(syncprogressstring, refreshprogressstring, " | ");
         Update();       // nasty but it works - needed since we are doing UI work here and the UI thread will be blocked
     }
 }
        private void ReportSyncProgress(int percentComplete, string message)
        {
            if (!Controller.PendingClose)
            {
                if (percentComplete >= 0)
                {
                    toolStripProgressBar1.Visible = true;
                    toolStripProgressBar1.Value   = percentComplete;
                }
                else
                {
                    toolStripProgressBar1.Visible = false;
                }

                syncprogressstring         = message;
                toolStripStatusLabel1.Text = ObjectExtensionsStrings.AppendPrePad(syncprogressstring, refreshprogressstring, " | ");
            }
        }
Ejemplo n.º 3
0
        private void Display(HistoryEntry he, HistoryList hl, bool selectedEntry)
        {
            //System.Diagnostics.Debug.WriteLine("SI:Display ");

            if (neverdisplayed)
            {
                UpdateViewOnSelection();  // then turn the right ones on
                neverdisplayed = false;
            }

            last_he = he;

            if (last_he != null)
            {
                SetControlText(he.System.Name);

                HistoryEntry lastfsd = hl.GetLastHistoryEntry(x => x.journalEntry is EliteDangerousCore.JournalEvents.JournalFSDJump, he);

                textBoxSystem.Text      = he.System.Name;
                panelFD.BackgroundImage = (lastfsd != null && (lastfsd.journalEntry as EliteDangerousCore.JournalEvents.JournalFSDJump).EDSMFirstDiscover) ? EDDiscovery.Icons.Controls.firstdiscover : EDDiscovery.Icons.Controls.notfirstdiscover;

                discoveryform.history.FillEDSM(he); // Fill in any EDSM info we have

                //textBoxBody.Text = he.WhereAmI + ((he.IsInHyperSpace) ? " (HS)": "");
                textBoxBody.Text = he.WhereAmI + " (" + he.BodyType + ")";

                if (he.System.HasCoordinate)         // cursystem has them?
                {
                    string SingleCoordinateFormat = "0.##";

                    string separ = System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator + " ";

                    textBoxPosition.Text = he.System.X.ToString(SingleCoordinateFormat) + separ + he.System.Y.ToString(SingleCoordinateFormat) + separ + he.System.Z.ToString(SingleCoordinateFormat);

                    ISystem homesys = EDCommander.Current.HomeSystemIOrSol;

                    textBoxHomeDist.Text = he.System.Distance(homesys).ToString(SingleCoordinateFormat);
                    textBoxSolDist.Text  = he.System.Distance(0, 0, 0).ToString(SingleCoordinateFormat);
                }
                else
                {
                    textBoxPosition.Text = "?";
                    textBoxHomeDist.Text = "";
                    textBoxSolDist.Text  = "";
                }

                int count = discoveryform.history.GetVisitsCount(he.System.Name);
                textBoxVisits.Text = count.ToString();

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

                buttonRoss.Enabled = buttonEDDB.Enabled = enableedddross;

                string allegiance, economy, gov, faction, factionstate, security;
                hl.ReturnSystemInfo(he, out allegiance, out economy, out gov, out faction, out factionstate, out security);

                textBoxAllegiance.Text = allegiance;
                textBoxEconomy.Text    = economy;
                textBoxGovernment.Text = gov;
                textBoxState.Text      = factionstate;

                List <MissionState> mcurrent = (from MissionState ms in he.MissionList.Missions.Values where ms.InProgressDateTime(last_he.EventTimeUTC) orderby ms.Mission.EventTimeUTC descending select ms).ToList();

                if (mcurrent == null || mcurrent.Count == 0)
                {
                    richTextBoxScrollMissions.Text = "No Missions".T(EDTx.UserControlSysInfo_NoMissions);
                }
                else
                {
                    string t = "";
                    foreach (MissionState ms in mcurrent)
                    {
                        t = ObjectExtensionsStrings.AppendPrePad(t,
                                                                 JournalFieldNaming.ShortenMissionName(ms.Mission.Name)
                                                                 + " Exp:" + (EDDiscoveryForm.EDDConfig.DisplayUTC ? ms.Mission.Expiry : ms.Mission.Expiry.ToLocalTime())
                                                                 + " @ " + ms.DestinationSystemStation(),
                                                                 Environment.NewLine);
                    }

                    richTextBoxScrollMissions.Text = t;
                }

                SetNote(he.snc != null ? he.snc.Note : "");
                textBoxGameMode.Text = he.GameModeGroup;
                if (he.isTravelling)
                {
                    textBoxTravelDist.Text  = he.TravelledDistance.ToStringInvariant("0.0") + "ly";
                    textBoxTravelTime.Text  = he.TravelledSeconds.ToString();
                    textBoxTravelJumps.Text = he.TravelledJumpsAndMisses;
                }
                else
                {
                    textBoxTravelDist.Text = textBoxTravelTime.Text = textBoxTravelJumps.Text = "";
                }

                int cc = (he.ShipInformation) != null?he.ShipInformation.CargoCapacity() : 0;

                if (cc > 0)
                {
                    textBoxCargo.Text = he.MaterialCommodity.CargoCount.ToStringInvariant() + "/" + cc.ToStringInvariant();
                }
                else
                {
                    textBoxCargo.Text = he.MaterialCommodity.CargoCount.ToStringInvariant();
                }

                textBoxMaterials.Text = he.MaterialCommodity.MaterialsCount.ToStringInvariant();
                textBoxData.Text      = he.MaterialCommodity.DataCount.ToStringInvariant();
                textBoxCredits.Text   = he.Credits.ToString("N0");

                textBoxJumpRange.Text = "";

                if (he.ShipInformation != null)
                {
                    ShipInformation si = he.ShipInformation;

                    textBoxShip.Text = si.ShipFullInfo(cargo: false, fuel: false);
                    if (si.FuelCapacity > 0 && si.FuelLevel > 0)
                    {
                        textBoxFuel.Text = si.FuelLevel.ToStringInvariant("0.#") + "/" + si.FuelCapacity.ToStringInvariant("0.#");
                    }
                    else if (si.FuelCapacity > 0)
                    {
                        textBoxFuel.Text = si.FuelCapacity.ToStringInvariant("0.#");
                    }
                    else
                    {
                        textBoxFuel.Text = "N/A".T(EDTx.UserControlSysInfo_NA);
                    }

                    EliteDangerousCalculations.FSDSpec fsd = si.GetFSDSpec();
                    if (fsd != null)
                    {
                        EliteDangerousCalculations.FSDSpec.JumpInfo ji = fsd.GetJumpInfo(he.MaterialCommodity.CargoCount,
                                                                                         si.ModuleMass() + si.HullMass(), si.FuelLevel, si.FuelCapacity / 2);

                        //System.Diagnostics.Debug.WriteLine("Jump range " + si.FuelLevel + " " + si.FuelCapacity + " " + ji.cursinglejump);
                        textBoxJumpRange.Text = ji.cursinglejump.ToString("N2") + "ly";
                    }
                }
                else
                {
                    textBoxShip.Text = textBoxFuel.Text = "";
                }

                RefreshTargetDisplay(this);
            }
            else
            {
                SetControlText("");
                textBoxSystem.Text                = textBoxBody.Text = textBoxPosition.Text =
                    textBoxAllegiance.Text        = textBoxEconomy.Text = textBoxGovernment.Text =
                        textBoxVisits.Text        = textBoxState.Text = textBoxHomeDist.Text = textBoxSolDist.Text =
                            textBoxGameMode.Text  = textBoxTravelDist.Text = textBoxTravelTime.Text = textBoxTravelJumps.Text =
                                textBoxCargo.Text = textBoxMaterials.Text = textBoxData.Text = textBoxShip.Text = textBoxFuel.Text =
                                    "";

                buttonRoss.Enabled = buttonEDDB.Enabled = false;
                SetNote("");
            }
        }