public abstract class Module : PropertyChangedBase, System.ComponentModel.INotifyPropertyChanged
Public MustInherit Class Module Inherits PropertyChangedBase Implements System.ComponentModel.INotifyPropertyChanged
public abstract class Module : PropertyChangedBase, System.ComponentModel.INotifyPropertyChanged
Public MustInherit Class Module Inherits PropertyChangedBase Implements System.ComponentModel.INotifyPropertyChanged
Modules are singletons that are instantiated automatically by the Framework when access is explicitly requested in executing code, or when the Module becomes "relevant" due to a context shift. Modules have program elements that are explicitly declared as such; these elements include: Ribbon Buttons, Tools, Galleries, Combo Boxes, Edit Boxes, Palettes, and other controls, as well as application Panes and Docking Panes. The well-defined relationship between a Module and its associated components lets the application initialize, un-initialize, and remove entire subsystems as a whole.
Modules act as the hub and central access point for their subsystem; if you need access to the functionality within a subsystem, you start with the Module. By convention, all public properties and methods on Modules should be static; clients can reference the associated assembly and then directly use the Module class without having to call Find (or pass the Module ID).
Most of the logic in a sub system should reside in a module or a helper (non-UI) class the module directly manages. For example, when writing a button, the Button class itself should have no business logic in it; all the logic should be centralized in its parent module. Centralizing the business logic reduces the spaghetti-effect. For example, instead of several buttons each listening to a particular event, it’s better to have one Module listen to the event and each Button instead polls the Module in OnUpdate.
Modules support several patterns to make centralizing business logic much easier; for instance, modules automatically load whenever one of their plug-ins (program elements) load. For example, in most cases a button on the ribbon doesn’t load until it is clicked; when this happens, the button’s parent Module is also loaded. Similarly, when a dock pane loads, its parent Module also loads.
Modules also have a pattern for working with Panes. Modules are automatically notified whenever one of its panes are activated, deactivated, opened, or closed. This means a Module doesn’t have to listen to the Framework’s ActivePaneChanged event and from here filter for its panes; instead, Modules are given direct notification that one of their panes changed.
Declaring Modules in DAML:
DAML attributes:
// Get the job Id associated with a running OpenProItems step for a Pro Add-In module // In the Add-In Module class, override the ExecuteCommandArgs(string id) method and return a Func<Object[], Task> object like the sample below // Refer to the Workflow Manager ProConcepts Sample Code link for an example //protected override Func<Object[], Task> ExecuteCommandArgs(string id) //{ // return func1; //} Func<Object[], Task> func1 = (object[] args) => QueuedTask.Run(() => { try { // Get the jobId property from the OpenProProjectItemsStep arguments and store it. OpenProProjectItemsStepCommandArgs stepArgs = (OpenProProjectItemsStepCommandArgs)args[0]; var jobId = stepArgs.JobId; ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show($"Got job id from ProMappingStep args: {jobId}", "Project Info"); // Run the command specified by the id passed into ExecuteCommandArgs IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper(id); var command = wrapper as ICommand; if (command != null && command.CanExecute(null)) command.Execute(null); } catch (System.Exception e) { ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show($"ERROR: {e}", "Error running command"); } });
System.Object
ArcGIS.Desktop.Framework.Contracts.PropertyChangedBase
ArcGIS.Desktop.Framework.Contracts.Module
ArcGIS.Desktop.Core.CoreModule
ArcGIS.Desktop.GeoProcessing.GeoprocessingModule
ArcGIS.Desktop.Reports.ReportsModule
ArcGIS.Desktop.Workflow.Client.WorkflowClientModule
ArcGIS.Desktop.Workflow.WorkflowModule
Target Platforms: Windows 11, Windows 10