public AssignTravelLogSystemForm(TravelHistoryControl travelHistory, EliteDangerous.JournalEvents.JournalLocOrJump vsc)
        {
            InitializeComponent();
            this._travelLogEntry = vsc;
            SystemClass.GetSystemAndAlternatives(vsc, out _linkSystem, out _alternatives, out _namestatus);

            this.tbLogSystemName.Text = vsc.StarSystem;
            this.tbVisitedDate.Text = vsc.EventTimeLocal.ToString();
            this.tbLogCoordX.Text = vsc.HasCoordinate ? vsc.StarPos[0].ToString("0.000") : "?";
            this.tbLogCoordY.Text = vsc.HasCoordinate ? vsc.StarPos[1].ToString("0.000") : "?";
            this.tbLogCoordZ.Text = vsc.HasCoordinate ? vsc.StarPos[2].ToString("0.000") : "?";
            this.tbLogCoordX.TextAlign = vsc.HasCoordinate ? HorizontalAlignment.Right : HorizontalAlignment.Center;
            this.tbLogCoordY.TextAlign = vsc.HasCoordinate ? HorizontalAlignment.Right : HorizontalAlignment.Center;
            this.tbLogCoordZ.TextAlign = vsc.HasCoordinate ? HorizontalAlignment.Right : HorizontalAlignment.Center;

            UpdateLinkedSystemList(_linkSystem);
            tbManualSystemName.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
            tbManualSystemName.AutoCompleteSource = AutoCompleteSource.CustomSource;

            tbManualSystemName.SetAutoCompletor(EDDiscovery.DB.SystemClass.ReturnSystemListForAutoComplete);
        }
Beispiel #2
0
        public AssignTravelLogSystemForm(EliteDangerous.JournalEvents.JournalLocOrJump vsc)
        {
            InitializeComponent();
            this._travelLogEntry = vsc;
            SystemClass.GetSystemAndAlternatives(vsc, out _linkSystem, out _alternatives, out _namestatus);

            this.tbLogSystemName.Text  = vsc.StarSystem;
            this.tbVisitedDate.Text    = vsc.EventTimeLocal.ToString();
            this.tbLogCoordX.Text      = vsc.HasCoordinate ? vsc.StarPos[0].ToString("0.000") : "?";
            this.tbLogCoordY.Text      = vsc.HasCoordinate ? vsc.StarPos[1].ToString("0.000") : "?";
            this.tbLogCoordZ.Text      = vsc.HasCoordinate ? vsc.StarPos[2].ToString("0.000") : "?";
            this.tbLogCoordX.TextAlign = vsc.HasCoordinate ? HorizontalAlignment.Right : HorizontalAlignment.Center;
            this.tbLogCoordY.TextAlign = vsc.HasCoordinate ? HorizontalAlignment.Right : HorizontalAlignment.Center;
            this.tbLogCoordZ.TextAlign = vsc.HasCoordinate ? HorizontalAlignment.Right : HorizontalAlignment.Center;

            UpdateLinkedSystemList(_linkSystem);
            tbManualSystemName.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            tbManualSystemName.AutoCompleteSource = AutoCompleteSource.CustomSource;

            tbManualSystemName.SetAutoCompletor(EDDiscovery.DB.SystemClass.ReturnSystemListForAutoComplete);
        }
 public AssignTravelLogSystemForm(EliteDangerous.JournalEvents.JournalLocOrJump vsc)
     : this(new EliteDangerous.SystemClass {
     name = vsc.StarSystem, x = vsc.HasCoordinate ? vsc.StarPos.X : Double.NaN, y = vsc.HasCoordinate ? vsc.StarPos.Y : Double.NaN, z = vsc.HasCoordinate ? vsc.StarPos.Z : Double.NaN, id_edsm = vsc.EdsmID
 }, vsc.EventTimeLocal)
 {
 }
Beispiel #4
0
        private void selectCorrectSystemToolStripMenuItem_Click(object sender, EventArgs e)
        {
            List <JournalEntry> jents = JournalEntry.GetAll(EDCommander.CurrentCmdrID).OrderBy(j => j.EventTimeUTC).ThenBy(j => j.Id).ToList();
            int selindex = jents.FindIndex(j => j.Id == rightclicksystem.Journalid);
            int firstrow = selindex;
            int lastrow  = selindex;

            if (selindex < 0)
            {
                // Selected entry is not in history for commander - abort.
                return;
            }

            EliteDangerous.JournalEvents.JournalLocOrJump journalent = null;

            if (jents[selindex].EventTypeID != JournalTypeEnum.FSDJump)
            {
                for (int i = selindex - 1; i >= 0; i--)
                {
                    var jent = jents[i];
                    if (jent.EdsmID != rightclicksystem.System.id_edsm || jent.EventTypeID == JournalTypeEnum.Died)
                    {
                        break;
                    }
                    firstrow = i;
                    if (jent.EventTypeID == JournalTypeEnum.FSDJump)
                    {
                        break;
                    }
                }
            }

            for (int i = rightclickrow + 1; i < dataGridViewTravel.RowCount; i++)
            {
                var jent = jents[i];
                if (jent.EdsmID != rightclicksystem.System.id_edsm || jent.EventTypeID == JournalTypeEnum.FSDJump)
                {
                    break;
                }
                lastrow = i;
                if (jent.EventTypeID == JournalTypeEnum.Died)
                {
                    break;
                }
            }

            var _jents = jents;

            jents = new List <JournalEntry>();

            for (int i = firstrow; i <= lastrow; i++)
            {
                jents.Add(_jents[i]);
            }

            journalent = jents.OfType <EliteDangerous.JournalEvents.JournalLocOrJump>().FirstOrDefault();

            if (journalent == null)
            {
                ExtendedControls.MessageBoxTheme.Show("Could not find Location or FSDJump entry associated with selected journal entry");
                return;
            }

            using (Forms.AssignTravelLogSystemForm form = new Forms.AssignTravelLogSystemForm(journalent))
            {
                DialogResult result = form.ShowDialog();
                if (result == DialogResult.OK)
                {
                    foreach (var jent in jents)
                    {
                        jent.EdsmID = (int)form.AssignedEdsmId;
                        jent.Update();
                    }

                    discoveryform.RefreshHistoryAsync();
                }
            }
        }