private void AddNewHistoryRow(bool insert, HistoryEntry item) // second part of add history row, adds item to view. { SystemNoteClass snc = SystemNoteClass.GetNoteOnJournalEntry(item.Journalid); if (snc == null && item.IsFSDJump) { snc = SystemNoteClass.GetNoteOnSystem(item.System.name, item.System.id_edsm); } // Try to fill EDSM ID where a system note is set but journal item EDSM ID is not set if (snc != null && snc.Name != null && snc.EdsmId > 0 && item.System.id_edsm <= 0) { item.System.id_edsm = 0; discoveryform.history.FillEDSM(item); if (snc.Journalid != item.Journalid && item.System.id_edsm > 0 && snc.EdsmId != item.System.id_edsm) { snc = null; } } if (snc != null && snc.Name != null && snc.Journalid == item.Journalid && item.System.id_edsm > 0 && snc.EdsmId != item.System.id_edsm) { snc.EdsmId = item.System.id_edsm; snc.Update(); } //string debugt = item.Journalid + " " + item.System.id_edsm + " " + item.System.GetHashCode() + " "; // add on for debug purposes to a field below object[] rowobj = { EDDiscoveryForm.EDDConfig.DisplayUTC?item.EventTimeUTC : item.EventTimeLocal, "", item.EventSummary, item.EventDescription, (snc != null) ? snc.Note : "" }; int rownr; if (insert) { dataGridViewTravel.Rows.Insert(0, rowobj); rownr = 0; } else { dataGridViewTravel.Rows.Add(rowobj); rownr = dataGridViewTravel.Rows.Count - 1; } dataGridViewTravel.Rows[rownr].Cells[TravelHistoryColumns.HistoryTag].Tag = item; dataGridViewTravel.Rows[rownr].Cells[TravelHistoryColumns.NoteTag].Tag = snc; dataGridViewTravel.Rows[rownr].DefaultCellStyle.ForeColor = (item.System.HasCoordinate || item.EntryType != JournalTypeEnum.FSDJump) ? discoveryform.theme.VisitedSystemColor : discoveryform.theme.NonVisitedSystemColor; string tip = item.EventSummary + Environment.NewLine + item.EventDescription + Environment.NewLine + item.EventDetailedInfo; dataGridViewTravel.Rows[rownr].Cells[0].ToolTipText = tip; dataGridViewTravel.Rows[rownr].Cells[1].ToolTipText = tip; dataGridViewTravel.Rows[rownr].Cells[2].ToolTipText = tip; dataGridViewTravel.Rows[rownr].Cells[3].ToolTipText = tip; dataGridViewTravel.Rows[rownr].Cells[4].ToolTipText = tip; }