ArcFM Desktop Developer Guide
MainApp Class
Members 


Version: 10.2.1b and 10.2.1b SP1

Resource Center Home

Product Availability
ArcFM Desktop and ArcFM Engine
Required Licenses
ArcFM, Designer, ArcFM Viewer, ArcFM Engine, ArcFM Engine Editor, or ArcFM Viewer for ArcGIS Engine
.NET Assembly
Miner.Windows.dll
Provides access to the primary objects and services of this framework.
Object Model
MainApp Class
Syntax
'Declaration
 
Public NotInheritable Class MainApp 
'Usage
 
Dim instance As MainApp
public sealed class MainApp 
Remarks
A primary service of this class is the "Run" method which starts the application. The following code shows a simple example of starting an application using the framework. /// <summary> /// Provides a generic class to get this application started. /// </summary> static class Program { /// <summary> /// Provides the execution entry point for this application. /// </summary> [STAThread] static void Main() { MainApp.Run(new LayoutManager()); }

For the above example, the application uses the default initialization provided by reflection and does not read any type of persisted display layout information. To add the capability of persisting the display layout (so that the layout will be restored the next time the application is run), change the class to LayoutFile which is derived from LayoutManager and will process persisted layout information. See the Miner.Windows.Layout.LayoutFile class for more information.

The framework provides a splash screen that is displayed during program initialization. Use the custom assembly attribute AssemblySplashScreenInfoAttribute to define the bitmap for the splash screen as well as the foreground color of the version, copyright, and status text and the special text to display in the upper right corner.

While the splash screen is being shown, the internal "InitializeApplication" method of this class is called to initialize the application. If the first parameter is not null, then the user's application initialization method is called rather than using the framework's built-in routines. If the framework's initialization is used, it first determines if an XML layout file exists. If not, it then checked the main assembly to see if a default XML layout file is stored in the EXE as an embedded resource. If so, the embedded XML layout is retrieved and used to provide the initialization. If the embedded file is not found, then the framework uses reflection to check each type and determine if it derived from one of the framework objects (Command, CommandBar, MdiTabForm, or DockControl) and then creates an instance of that type. The BeforeApplicationInitialize event can be used to perform additional initialization before the objects are created. The AfterApplicationInitialize can be used to complete the display layout of the objects.

An instance of this MainApp class is never created. The MainApp class provides some static properties that are used to obtain the various objects of the framework. For example, the following code shows how to obtain a reference to the main window of the application: MainWindow mainWin = MainApp.MainWin; The main window is by far the most commonly accessed framework object. It, in turn, provides properties which allow access to the command manager, the tabbed MDI window manager, the dock manager, and the main status bar of the application: CommandManager cmdMgr = MainApp.MainWin.CommandManager; DockManager dockMgr = MainApp.MainWin.DockManager; MdiTabManager mdiMgr = MainApp.MainWin.MdiTabManager; MainStatusBar stsBar = MainApp.MainWin.MainStsBar; The command manager (Miner.Windows.Commands.CommandManager) manages all of the CommandBars (menus and toolbars) and Commands (menu items and toolbar tools) defined by the application. The tabbed MDI window manager (Miner.Windows.TabbedMdi.MdiTabManager) manages all of the tabbed MDI windows defined for the application. The dock manager (Miner.Windows.Docking.DockManager) manages all of the dockable windows for the application. The MainStatusBar MainStatusBar) is a custom status bar that allows the programmer to add special panels to simplify the display of user information.

Inheritance Hierarchy

System.Object
   Miner.Windows.MainApp

Requirements

Target Platforms: Windows XP SP3 (32-bit and 64-bit), Windows 7 (32-bit and 64-bit)

Not all Operating Systems are supported on all products. Visit the ArcFM Solution Supported Versions page for full details.

See Also

Reference

MainApp Members
Miner.Windows Namespace

 

 


Send Comment