Assembly: ESRI.ArcGISExplorer.Application (in ESRI.ArcGISExplorer.Application.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public virtual void OnStartup() |
Visual Basic (Declaration) |
---|
Public Overridable Sub OnStartup |
Remarks
The OnStartup method is called after the application has been started, but may be called before the application window is shown to the user.
During the OnStartup method the ESRI.ArcGISExplorer.Application and MapDisplay classes are initialized and available in code. However, if you make changes to the MapDisplay during this method, there is no guarantee that the changes will not be overridden by other code therefore other approaches should be used; for example if initial map display extent or Viewpoint needs to be set, this can be done using a default map and application configuration. See the ArcGIS Explorer Application Configuration Manager and help system for more information about application configurations.
Examples
using System; using System.Text; // Import some typical namespaces. using System.Windows.Forms; using System.Drawing; // Additional ArcGIS Explorer namespaces. using ESRI.ArcGISExplorer.Application; using ESRI.ArcGISExplorer.Mapping; namespace EventExtension { class SettingsChangedExtension : ESRI.ArcGISExplorer.Application.Extension { private DisplayUnits currentUnits = DisplayUnits.DecimalDegrees; public override void OnStartup() { // Add event handlers for the SettingsChanged event. ESRI.ArcGISExplorer.Application.Application.SettingsChanged += new EventHandler(Application_SettingsChanged); // Initialize the value of the DisplayUnits. currentUnits = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Settings.DisplayUnits; } public override void OnShutdown() { // Remove the handlers for the events. ESRI.ArcGISExplorer.Application.Application.SettingsChanged -= new EventHandler(Application_SettingsChanged); } void Application_SettingsChanged(object sender, EventArgs e) { // Update the cached settings data. currentUnits = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Settings.DisplayUnits; } } }
Imports System Imports System.Text ' Import some typical namespaces. Imports System.Windows.Forms Imports System.Drawing ' Additional ArcGIS Explorer namespaces. Imports ESRI.ArcGISExplorer.Application Imports ESRI.ArcGISExplorer.Mapping Namespace EventExtension Public Class SettingsChangedExtension Inherits ESRI.ArcGISExplorer.Application.Extension Private currentUnits As DisplayUnits = DisplayUnits.DecimalDegrees Public Overrides Sub OnStartup() ' Add event handlers for the DocumentOpened and DocumentClosed events. AddHandler ESRI.ArcGISExplorer.Application.Application.SettingsChanged, AddressOf Application_SettingsChanged ' Initialize the value of the DisplayUnits. currentUnits = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Settings.DisplayUnits End Sub Public Overrides Sub OnShutdown() ' Remove the handlers for the events. RemoveHandler ESRI.ArcGISExplorer.Application.Application.SettingsChanged, AddressOf Application_SettingsChanged End Sub Sub Application_SettingsChanged(ByVal sender As Object, ByVal e As EventArgs) ' Update the cached settings data. currentUnits = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Settings.DisplayUnits End Sub End Class End Namespace