

Public Class FrameworkApplication Inherits System.Windows.Application Implements System.Windows.Markup.IQueryAmbient
public class FrameworkApplication : System.Windows.Application, System.Windows.Markup.IQueryAmbient
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::
The FrameworkApplication class follows the singleton pattern to provide easy access to its functionality.
{
Window window = Application.Current.MainWindow;
// center it
Rect rect = SystemParameters.WorkArea;
Application.Current.MainWindow.Left = rect.Left + (rect.Width - Application.Current.MainWindow.ActualWidth) / 2;
Application.Current.MainWindow.Top = rect.Top + (rect.Height - Application.Current.MainWindow.ActualHeight) / 2;
}
{
// 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
Func<object[], Task> overrideFunction = (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);
if (wrapper is ICommand command && command.CanExecute(null))
command.Execute(null);
}
catch (Exception e)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show($"ERROR: {e}", "Error running command");
}
});
// Use overrideFunction to get the jobId from the step args when the command is executed
}
System.Object
System.Windows.Threading.DispatcherObject
System.Windows.Application
ArcGIS.Desktop.Framework.FrameworkApplication
ArcGIS.Desktop.Core.Licensing.LicensedApplication
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)