/// <summary>
        /// Called by Framework whenever this Module is loaded.
        /// </summary>
        /// <returns></returns>
        protected override bool Initialize()
        {
            //Subscribe to the TOC selection changed event to find out if a Point feature layer is selected.
            //This will activate the context menu item to open the "Construct Marker from Fonts" dockpane.
            TOCSelectionChangedEvent.Subscribe((args) =>
            {
                if (args.MapView == null)
                {
                    return;
                }
                Construct_MarkerViewModel vm = FrameworkApplication.DockPaneManager.Find("ConstructMarkerFromFont_Construct_Marker") as Construct_MarkerViewModel;
                if (GetSelectedPointLayers(args.MapView).Count() == 1)
                {
                    //activate state
                    FrameworkApplication.State.Activate(StateId); //Activates the custom state when the context is set.

                    if (vm != null)
                    {
                        vm.DockpaneVisible = Visibility.Visible;
                        vm.GetSelectedPointFeatureLayer();
                    }
                }
                else
                {
                    FrameworkApplication.State.Deactivate(StateId);
                    if (vm != null)
                    {
                        vm.DockpaneVisible = Visibility.Collapsed;
                    }
                }
            });
            return(base.Initialize());
        }
        protected Dockpane1ViewModel()
        {
            BindingOperations.EnableCollectionSynchronization(FeatureData, _collectionLock);
            BindingOperations.EnableCollectionSynchronization(Fields, _collectionLock);

            TOCSelectionChangedEvent.Subscribe(UpdateFields);
            SelectedLayer = @"Select Feature Layer in TOC";
        }
        /// <summary>
        /// Categories Combo Box constructor
        /// </summary>
        public CategoriesComboBox()
        {
            Enabled = false;

            // Subscribe to the table of contents selection changed event.
            // This allows us to populate the combo box based on the selected layer
            TOCSelectionChangedEvent.Subscribe(UpdateCategoryList);
        }
 private void AddEvents()
 {
     LayersAddedEvent.Subscribe(OnLayersAdded);
     LayersMovedEvent.Subscribe(OnLayersMoved);
     LayersRemovedEvent.Subscribe(OnLayersRemoved);
     MapMemberPropertiesChangedEvent.Subscribe(OnMapMemberPropertiesChanged);
     TOCSelectionChangedEvent.Subscribe(OnTocSelectionChanged);
     DrawStartedEvent.Subscribe(OnDrawStarted);
     DrawCompleteEvent.Subscribe(OnDrawCompleted);
     ActiveToolChangedEvent.Subscribe(OnActiveToolChangedEvent);
     EditCompletedEvent.Subscribe(OnEditCompleted);
 }
        // Called when the visibility of the DockPane changes.
        protected override void OnShow(bool isVisible)
        {
            if (isVisible && _eventToken == null) //Subscribe to event when dockpane is visible
            {
                _eventToken    = MapSelectionChangedEvent.Subscribe(OnMapSelectionChangedEvent);
                _toceventToken = TOCSelectionChangedEvent.Subscribe(OnTOCSelectionChangeEvent);
            }

            if (!isVisible && _eventToken != null) //Unsubscribe as the dockpane closes.
            {
                MapSelectionChangedEvent.Unsubscribe(_eventToken);
                TOCSelectionChangedEvent.Unsubscribe(_toceventToken);
                _eventToken = null;
            }
        }
        private async void OnMapClosed(MapClosedEventArgs args)
        {
            LayersAddedEvent.Unsubscribe(OnLayersAdded);
            LayersMovedEvent.Unsubscribe(OnLayersMoved);
            LayersRemovedEvent.Unsubscribe(OnLayersRemoved);
            MapMemberPropertiesChangedEvent.Unsubscribe(OnMapMemberPropertiesChanged);
            TOCSelectionChangedEvent.Unsubscribe(OnTocSelectionChanged);
            ActiveToolChangedEvent.Unsubscribe(OnActiveToolChangedEvent);
            EditCompletedEvent.Unsubscribe(OnEditCompleted);
            DrawCompleteEvent.Unsubscribe(OnDrawCompleted);
            DrawStartedEvent.Unsubscribe(OnDrawStarted);

            while (Count >= 1)
            {
                VectorLayer vectorLayer = this[0];
                await RemoveLayer(vectorLayer);
            }
        }
Beispiel #7
0
 /// <summary>
 /// Combo Box contructor
 /// </summary>
 public DomainsComboBox()
 {
     Enabled = false;
     TOCSelectionChangedEvent.Subscribe(UpdateDomainList);
 }
Beispiel #8
0
 protected Dockpane1ViewModel()
 {
     TOCSelectionChangedEvent.Subscribe(UpdateFields);
 }