Called when ArcGIS Explorer is shutting down, providing an opportunity to run code.

Namespace:  ESRI.ArcGISExplorer.Application

Assembly:  ESRI.ArcGISExplorer.Application (in ESRI.ArcGISExplorer.Application.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public virtual void OnShutdown()
Visual Basic (Declaration)
Public Overridable Sub OnShutdown

Remarks

The OnShutdown method is called after the application has been asked to exit, but before the application process exits.

During the OnShutdown method the ESRI.ArcGISExplorer.Application and MapDisplay classes are still available; however, no changes should be made to the MapDisplay at this point.

Examples

The code below updates cached information about the current DisplayUnits selected in the Display tab. This is useful if you are providing a user interface which provides information about coordinates, as you can provide information using the same units as the rest of the application.
CopyC#
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;
    }


  }
}
CopyVB.NET
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

See Also