/// <summary> /// When overridden in a derived class, gives the custom Module a chance to initialize itself and return its status to the calling Framework. /// </summary> /// <remarks> /// <para> /// A custom Module has two opportunities to initialize itself: its class constructor and its Initialize method. The Framework calls both /// functions whenever a Module is loaded. Modules load either explicitly with <c>FrameworkApplication.FindModule</c> or implicitly whenever /// any of their DAML elements (Panes, DockPanes, Controls, etc) are loaded. For example, when a DockPane or a Button on a Ribbon Tab is created, /// their parent module will automatically load if it hasn't already done so. /// </para> /// <para> /// The Initialize method has the added benefit of returning whether the initialization was successful /// or not. If initialization fails, the Framework immediately calls <c>Uninitialize</c>. /// </para> /// </remarks> /// <returns/> protected override bool Initialize() { //Listen for feature selected events ArcGIS.Desktop.Mapping.Events.MapSelectionChangedEvent.Subscribe(async(mse) => { foreach (var kvp in mse.Selection) { if ((kvp.Key as BasicFeatureLayer) == null) { continue; } //Is a feature selected? Is it a Mil2525 feature? if (kvp.Value.Count > 0 && await HasMil2525Attributes((BasicFeatureLayer)kvp.Key)) { if (_symbolPreview == null) { _symbolPreview = FrameworkApplication.DockPaneManager.Find( SymbolPreviewViewModel._dockPaneID) as SymbolPreviewViewModel; } //Set the first feature as the selected feature if (_symbolPreview.IsVisible) { _symbolPreview.SetSelected((BasicFeatureLayer)kvp.Key, kvp.Value[0]); } } } }); return(true); }
protected override void OnClick() { SymbolPreviewViewModel.Show(); }
/// <summary> /// When overridden in a derived class, gives the custom Module a chance to initialize itself and return its status to the calling Framework. /// </summary> /// <remarks> /// <para> /// A custom Module has two opportunities to initialize itself: its class constructor and its Initialize method. The Framework calls both /// functions whenever a Module is loaded. Modules load either explicitly with <c>FrameworkApplication.FindModule</c> or implicitly whenever /// any of their DAML elements (Panes, DockPanes, Controls, etc) are loaded. For example, when a DockPane or a Button on a Ribbon Tab is created, /// their parent module will automatically load if it hasn't already done so. /// </para> /// <para> /// The Initialize method has the added benefit of returning whether the initialization was successful /// or not. If initialization fails, the Framework immediately calls <c>Uninitialize</c>. /// </para> /// </remarks> /// <returns/> protected override bool Initialize() { //Listen for feature selected events ArcGIS.Desktop.Mapping.Events.MapSelectionChangedEvent.Subscribe(async (mse) => { foreach (var kvp in mse.Selection) { if ((kvp.Key as BasicFeatureLayer) == null) continue; //Is a feature selected? Is it a Mil2525 feature? if (kvp.Value.Count > 0 && await HasMil2525Attributes((BasicFeatureLayer) kvp.Key)) { if (_symbolPreview == null) { _symbolPreview = FrameworkApplication.DockPaneManager.Find( SymbolPreviewViewModel._dockPaneID) as SymbolPreviewViewModel; } //Set the first feature as the selected feature if (_symbolPreview.IsVisible) { _symbolPreview.SetSelected((BasicFeatureLayer)kvp.Key, kvp.Value[0]); } } } }); return true; }