ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Framework Namespace / FrameworkApplication Class
Members Example

In This Topic
    FrameworkApplication Class
    In This Topic
    Encapsulates the ArcGISPro application.
    Object Model
    FrameworkApplication ClassTool ClassApplicationProperties ClassDockPaneManager ClassIEventAggregator InterfaceModule ClassIPlugInWrapper InterfacePaneCollection ClassPane ClassState Class
    Syntax
    Remarks

    The FrameworkApplication object is the central object in the Framework API. Its main purpose is to pull together all of the extensions and add-ins into one application. The FrameworkApplication encapsulates application-specific functionality, including the following::

    • Access to the modules, commands, backstage, panes, and dock panes.
    • The application state.
    • The event aggregator.
    • Customization filters.
    • Custom drop handlers.
    • Notifications.
    • The help system.

    The FrameworkApplication class follows the singleton pattern to provide easy access to its functionality.

    Example
    Get the Application main window
    System.Windows.Window window = FrameworkApplication.Current.MainWindow;
    
    // center it
    Rect rect = System.Windows.SystemParameters.WorkArea;
    FrameworkApplication.Current.MainWindow.Left = rect.Left + (rect.Width - FrameworkApplication.Current.MainWindow.ActualWidth) / 2;
    FrameworkApplication.Current.MainWindow.Top = rect.Top + (rect.Height - FrameworkApplication.Current.MainWindow.ActualHeight) / 2;
    
    How to get the job Id associated with a running OpenProProjectItems step
    // 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");
        }
    });
    Inheritance Hierarchy

    System.Object
       System.Windows.Threading.DispatcherObject
          System.Windows.Application
             ArcGIS.Desktop.Framework.FrameworkApplication
                ArcGIS.Desktop.Core.Licensing.LicensedApplication

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also