Beispiel #1
0
        private void UpdateListViewItem(ListViewItem listViewItem, AircraftOnlineLookupLogEntry freshValues)
        {
            while (listViewItem.SubItems.Count < 11)
            {
                listViewItem.SubItems.Add("");
            }

            var displayRow = (DisplayRow)listViewItem.Tag;

            displayRow.Country      = freshValues.Detail == null ? null : freshValues.Detail.Country;
            displayRow.Icao         = freshValues.Icao;
            displayRow.Manufacturer = freshValues.Detail == null ? null : freshValues.Detail.Manufacturer;
            displayRow.Model        = freshValues.Detail == null ? null : freshValues.Detail.Model;
            displayRow.ModelIcao    = freshValues.Detail == null ? null : freshValues.Detail.ModelIcao;
            displayRow.Operator     = freshValues.Detail == null ? null : freshValues.Detail.Operator;
            displayRow.OperatorIcao = freshValues.Detail == null ? null : freshValues.Detail.OperatorIcao;
            displayRow.Registration = freshValues.Detail == null ? null : freshValues.Detail.Registration;
            displayRow.Serial       = freshValues.Detail == null ? null : freshValues.Detail.Serial;
            displayRow.Time         = freshValues.ResponseUtc;
            displayRow.Year         = freshValues.Detail == null ? null : freshValues.Detail.YearBuilt;

            for (var i = 0; i < listViewItem.SubItems.Count; ++i)
            {
                var subItem = listViewItem.SubItems[i];
                switch (i)
                {
                case 0:  subItem.Text = displayRow.Time.ToLocalTime().ToString("HH:mm:ss"); break;

                case 1:  subItem.Text = displayRow.Icao; break;

                case 2:  subItem.Text = displayRow.Registration ?? ""; break;

                case 3:  subItem.Text = displayRow.Country ?? ""; break;

                case 4:  subItem.Text = displayRow.Manufacturer ?? ""; break;

                case 5:  subItem.Text = displayRow.Model ?? ""; break;

                case 6:  subItem.Text = displayRow.ModelIcao ?? ""; break;

                case 7:  subItem.Text = displayRow.Operator ?? ""; break;

                case 8:  subItem.Text = displayRow.OperatorIcao ?? ""; break;

                case 9:  subItem.Text = displayRow.Serial ?? ""; break;

                case 10: subItem.Text = displayRow.Year == null ? "" : displayRow.Year.ToString(); break;
                }
            }
        }
        public LogEntry(AircraftOnlineLookupLogEntry entry)
        {
            Time = String.Format("{0:HH:mm:ss}", entry.ResponseUtc.ToLocalTime());
            Icao = entry.Icao;

            var detail = entry.Detail;

            if (detail != null)
            {
                Registration = detail.Registration;
                Country      = detail.Country;
                Manufacturer = detail.Manufacturer;
                Model        = detail.Model;
                ModelIcao    = detail.ModelIcao;
                Operator     = detail.Operator;
                OperatorIcao = detail.OperatorIcao;
                Serial       = detail.Serial;
                YearBuilt    = detail.YearBuilt;
            }
        }