/// <summary>
        /// Fills the locations list view.
        /// </summary>
        private void PopulateLocations()
        {
            var currentSuppressState = _SuppressItemSelectedEventHandler;

            try {
                _SuppressItemSelectedEventHandler = true;
                var selected = SelectedReceiverLocation;

                listViewReceiverLocations.Items.Clear();
                foreach (var location in ReceiverLocations)
                {
                    var item = new ListViewItem()
                    {
                        Tag = location
                    };
                    PopulateListViewItem(item);
                    listViewReceiverLocations.Items.Add(item);
                }

                if (ReceiverLocations.Contains(selected))
                {
                    SelectedReceiverLocation = selected;
                }
            } finally {
                _SuppressItemSelectedEventHandler = currentSuppressState;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Returns the receiver location.
 /// </summary>
 /// <param name="locationUniqueId"></param>
 /// <returns></returns>
 /// <remarks>
 /// Originally the program didn't need to know where the receiver was located, but after ADS-B decoding
 /// was added it needed to know for local surface position decoding. Because all of this data is being
 /// serialised we unfortunately can't have direct references to <see cref="ReceiverLocation"/> objects
 /// in the classes so when a receiver location needs to be recorded only its ID is stored. This looks
 /// up the location for the ID passed across in a consistent fashion. It may return null if the receiver
 /// location with that name no longer exists.
 /// </remarks>
 public ReceiverLocation ReceiverLocation(int locationUniqueId)
 {
     return(ReceiverLocations.FirstOrDefault(r => r.UniqueId == locationUniqueId));
 }