ArcGIS Network Analyst extension Engine application
CommonFunctions.cs
// Copyright 2012 ESRI
// 
// All rights reserved under the copyright laws of the United States
// and applicable international laws, treaties, and conventions.
// 
// You may freely redistribute and use this sample code, with or
// without modification, provided you include the original copyright
// notice and use restrictions.
// 
// See the use restrictions.
// 

using ESRI.ArcGIS.Controls;

namespace NAEngine
{
  public static class CommonFunctions
  {
    public static IEngineNetworkAnalystEnvironment GetTheEngineNetworkAnalystEnvironment()
    {
      // The ArcGIS Network Analyst extension environment is a singleton, and must be accessed using the System.Activator
      System.Type t = System.Type.GetTypeFromProgID("esriControls.EngineNetworkAnalystEnvironment");
      var naEnv = System.Activator.CreateInstance(t) as IEngineNetworkAnalystEnvironment;
      return naEnv;
    }
  }
}