ArcObjects Library Reference  

LicenseInitializer

About the ArcGIS GPConsole Sample

[C#]

LicenseInitializer.cs

using System;
using ESRI.ArcGIS;

namespace ArcGIS_GPConsole_CSharp
{
    internal partial class LicenseInitializer
    {
        public LicenseInitializer()
        {
            ResolveBindingEvent += new EventHandler(BindingArcGISRuntime);
        }

        void BindingArcGISRuntime(object sender, EventArgs e)
        {
            //
            // TODO: Modify ArcGIS runtime binding code as needed
            //
            if (!RuntimeManager.Bind(ProductCode.Server))
            {
                // Failed to bind, announce and force exit
                Console.WriteLine("Invalid ArcGIS runtime binding. Application will shut down.");
                System.Environment.Exit(0);
            }
        }
    }
}
[Visual Basic .NET]

LicenseInitializer.vb

Imports Microsoft.VisualBasic
Imports System
Imports ESRI.ArcGIS


Partial Friend Class LicenseInitializer

  Public Sub New()

  End Sub

  Private Sub BindingArcGISRuntime(ByVal sender As Object, ByVal e As EventArgs)
    '
    ' TODO: Modify ArcGIS runtime binding code as needed
    '
    If (Not RuntimeManager.Bind(ProductCode.Server)) Then
      ' Failed to bind, announce and force exit
      Console.WriteLine("Invalid ArcGIS runtime binding. Application will shut down.")
      System.Environment.Exit(0)
    End If
  End Sub
End Class