コード例 #1
0
        private DataGridViewRow CreateHistoryRow(HistoryEntry he, string search)
        {
            DateTime time = EDDiscoveryForm.EDDConfig.ConvertTimeToSelectedFromUTC(he.EventTimeUTC);

            he.journalEntry.FillInformation(out string EventDescription, out string EventDetailedInfo);
            string detail = EventDescription;

            detail = detail.AppendPrePad(EventDetailedInfo.LineLimit(15, Environment.NewLine + "..."), Environment.NewLine);

            if (search.HasChars())
            {
                string timestr  = time.ToString();
                int    rown     = EDDConfig.Instance.OrderRowsInverted ? he.Indexno : (discoveryform.history.Count - he.Indexno + 1);
                string entryrow = rown.ToStringInvariant();
                bool   matched  = timestr.IndexOf(search, StringComparison.InvariantCultureIgnoreCase) >= 0 ||
                                  he.EventSummary.IndexOf(search, StringComparison.InvariantCultureIgnoreCase) >= 0 ||
                                  detail.IndexOf(search, StringComparison.InvariantCultureIgnoreCase) >= 0 ||
                                  entryrow.IndexOf(search, StringComparison.InvariantCultureIgnoreCase) >= 0;

                if (!matched)
                {
                    return(null);
                }
            }

            var rw = dataGridViewJournal.RowTemplate.Clone() as DataGridViewRow;

            rw.CreateCells(dataGridViewJournal, time, "", he.EventSummary, detail);

            rw.Tag = he;

            rowsbyjournalid[he.Journalid] = rw;
            return(rw);
        }
コード例 #2
0
        private void AddNewJournalRow(bool insert, HistoryEntry item)            // second part of add history row, adds item to view.
        {
            item.journalEntry.FillInformation(out string EventDescription, out string EventDetailedInfo);

            string detail = EventDescription;

            detail = detail.AppendPrePad(EventDetailedInfo.LineLimit(15, Environment.NewLine + "..."), Environment.NewLine);

            var rw = dataGridViewJournal.RowTemplate.Clone() as DataGridViewRow;

            rw.CreateCells(dataGridViewJournal, EDDiscoveryForm.EDDConfig.DisplayUTC ? item.EventTimeUTC : item.EventTimeLocal, "", item.EventSummary, detail);
            rw.Cells[JournalHistoryColumns.HistoryTag].Tag = item;

            int rownr = 0;

            if (insert)
            {
                dataGridViewJournal.Rows.Insert(rownr, rw);
            }
            else
            {
                rownr = dataGridViewJournal.Rows.Add(rw);
            }

            rowsbyjournalid[item.Journalid] = dataGridViewJournal.Rows[rownr];
        }
コード例 #3
0
        private DataGridViewRow CreateHistoryRow(HistoryEntry item, string search)
        {
            DateTime time = EDDiscoveryForm.EDDConfig.DisplayUTC ? item.EventTimeUTC : item.EventTimeLocal;

            item.journalEntry.FillInformation(out string EventDescription, out string EventDetailedInfo);
            string detail = EventDescription;

            detail = detail.AppendPrePad(EventDetailedInfo.LineLimit(15, Environment.NewLine + "..."), Environment.NewLine);

            if (search.HasChars())
            {
                string timestr = time.ToString();
                bool   matched = timestr.IndexOf(search, StringComparison.InvariantCultureIgnoreCase) >= 0 ||
                                 item.EventSummary.IndexOf(search, StringComparison.InvariantCultureIgnoreCase) >= 0 ||
                                 detail.IndexOf(search, StringComparison.InvariantCultureIgnoreCase) >= 0;
                if (!matched)
                {
                    return(null);
                }
            }

            var rw = dataGridViewJournal.RowTemplate.Clone() as DataGridViewRow;

            rw.CreateCells(dataGridViewJournal, time, "", item.EventSummary, detail);

            rw.Cells[JournalHistoryColumns.HistoryTag].Tag = item;

            rowsbyjournalid[item.Journalid] = rw;
            return(rw);
        }
コード例 #4
0
        private DataGridViewRow CreateHistoryRow(HistoryEntry he, BaseUtils.StringSearchTerms search)
        {
            DateTime time = EDDConfig.Instance.ConvertTimeToSelectedFromUTC(he.EventTimeUTC);

            he.FillInformation(out string EventDescription, out string EventDetailedInfo);
            string detail = EventDescription;

            detail = detail.AppendPrePad(EventDetailedInfo.LineLimit(15, Environment.NewLine + "..."), Environment.NewLine);

            if (search.Enabled)
            {
                bool matched = false;

                if (search.Terms[0] != null)
                {
                    string timestr  = time.ToString();
                    int    rown     = EDDConfig.Instance.OrderRowsInverted ? he.EntryNumber : (discoveryform.history.Count - he.EntryNumber + 1);
                    string entryrow = rown.ToStringInvariant();
                    matched = timestr.IndexOf(search.Terms[0], StringComparison.InvariantCultureIgnoreCase) >= 0 ||
                              he.EventSummary.IndexOf(search.Terms[0], StringComparison.InvariantCultureIgnoreCase) >= 0 ||
                              detail.IndexOf(search.Terms[0], StringComparison.InvariantCultureIgnoreCase) >= 0 ||
                              entryrow.IndexOf(search.Terms[0], StringComparison.InvariantCultureIgnoreCase) >= 0;
                }

                if (!matched && search.Terms[1] != null)       // system
                {
                    matched = he.System.Name.WildCardMatch(search.Terms[1], true);
                }
                if (!matched && search.Terms[2] != null)       // body
                {
                    matched = he.Status.BodyName?.WildCardMatch(search.Terms[2], true) ?? false;
                }
                if (!matched && search.Terms[3] != null)       // station
                {
                    matched = he.Status.StationName?.WildCardMatch(search.Terms[3], true) ?? false;
                }
                if (!matched && search.Terms[4] != null)       // stationfaction
                {
                    matched = he.Status.StationFaction?.WildCardMatch(search.Terms[4], true) ?? false;
                }

                if (!matched)
                {
                    return(null);
                }
            }

            var rw = dataGridViewJournal.RowTemplate.Clone() as DataGridViewRow;

            rw.CreateCells(dataGridViewJournal, time, "", he.EventSummary, detail);

            rw.Tag = he;

            rowsbyjournalid[he.Journalid] = rw;
            return(rw);
        }