/// <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());
        }
示例#2
0
 protected override void OnClick()
 {
     Construct_MarkerViewModel.Show();
 }