/// <summary>
        /// Updates the listbox with the feature/Symbol list
        /// </summary>
        /// <returns></returns>
        internal Task UpdateSymbolList()
        {
            if (MapView.Active?.Map == null)
            {
                return(Task.FromResult(0));
            }
            return(QueuedTask.Run(() =>
            {
                var activeMapView = MapView.Active;
                if (activeMapView == null)
                {
                    return;
                }
                var features = activeMapView.Map.GetSelection();
                foreach (var kvp in features)
                {
                    if (kvp.Key is FeatureLayer)
                    {
                        var lyr = kvp.Key as FeatureLayer;
                        if (lyr.CanLookupSymbol())
                        {
                            var symbol = lyr.LookupSymbol(kvp.Value[0], activeMapView);
                            lock (_lock)
                                FeatureItems.Add(new FeatureItem(lyr, kvp.Value[0], symbol));
                        }
                    }
                }

                var defSelectionAction = (Action)(() =>
                {
                    SelectedFeatureItem = FeatureItems.Count > 0 ? FeatureItems[0] : null;
                });
                ActionOnGuiThread(defSelectionAction);
            }));
        }
Esempio n. 2
0
        public static void GetSongsByFeature(ObservableCollection <Song> songs, FeatureItems item)
        {
            var allSongs      = GetSongs();
            var filteredSongs = allSongs.Where(song => song.Item == item).ToList();

            songs.Clear();
            filteredSongs.ForEach(song => songs.Add(song)); //lambda expression
        }
        /// <summary>
        /// Event handler when the selected features changes
        /// </summary>
        /// <param name="obj"></param>

        private void OnMapSelectionChangedEvent(MapSelectionChangedEventArgs obj)
        {
            //Clear the list first
            if (FeatureItems?.Count > 0)
            {
                FeatureItems.Clear();
            }
            UpdateSymbolList();
        }
        /// <summary>
        /// Event handler when the active MapView changes
        /// </summary>
        /// <param name="obj"></param>
        private void OnActiveMapViewChangedEvent(ActiveMapViewChangedEventArgs obj)
        {
            if (obj.IncomingView == null)
            {
                FeatureItems.Clear();
                return;
            }
            //Clear the list first
            if (FeatureItems?.Count > 0)
            {
                FeatureItems.Clear();
            }

            UpdateSymbolList();
        }