Initialize license files in ArcGIS Engine Product Development

Source: Internet
Author: User
After the ArcGIS Engine developer kit product and corresponding product licenses are installed, it is only for your application Program Implementing the features allowed by the license provides the possibility that you still need to initialize the license file to make your application have these features.
Note: If you do not perform this initialization, you may encounter a prompt that you do not have the required permission when implementing some features.
The initial test of this License file needs to be implemented at the entrance of your application. Below is the initialization of C # Code Example

Using ESRI. ArcGIS. esrisystem;

Namespace licenseinitializer
{
Public class licenseinitializer
{
Private iaoinitialize m_aoinitialize = new aoinitializeclass ();

Public bool initializeapplication ()
{
Bool binitialized = true;

If (m_aoinitialize = NULL)
{
System. Windows. Forms. MessageBox. Show ("unable to initialize. This application cannot run! ");
Binitialized = false;
}

// Initialize the application
Esrilicensestatus licensestatus = esrilicensestatus. esrilicenseunavailable;

Licensestatus = checkoutlicenses (esrilicenseproductcode. esrilicenseproductcodeengine );
If (licensestatus! = Esrilicensestatus. esrilicensecheckedout)
{
Licensestatus = checkoutlicenses (esrilicenseproductcode. esrilicenseproductcodearcview );
If (licensestatus! = Esrilicensestatus. esrilicensecheckedout)
{
Licensestatus = checkoutlicenses (esrilicenseproductcode. esrilicenseproductcodearceditor );
If (licensestatus! = Esrilicensestatus. esrilicensecheckedout)
{
Licensestatus = checkoutlicenses (esrilicenseproductcode. esrilicenseproductcodearcinfo );
If (licensestatus! = Esrilicensestatus. esrilicensecheckedout)
{
System. Windows. Forms. MessageBox. Show (licensemessage (licensestatus ));
Binitialized = false;
}
}
}
}

Return binitialized;
}

Public void shutdownapplication ()
{
If (m_aoinitialize = NULL) return;

// Close the aoinitilaize object
M_aoinitialize.shutdown ();
M_aoinitialize = NULL;
}

Private esrilicensestatus checkoutlicenses (esrilicenseproductcode productcode)
{
Esrilicensestatus licensestatus;

// Whether the product is possible
Licensestatus = m_aoinitialize.isproductcodeavailable (productcode );
If (licensestatus = esrilicensestatus. esrilicenseavailable)
{

// Use the corresponding license file for initialization
Licensestatus = m_aoinitialize.initialize (productcode );
}
Return licensestatus;
}

Private string licensemessage (esrilicensestatus licensestatus)
{
String message = "";

// No license
If (licensestatus = esrilicensestatus. esrilicensenotinitialized)
{< br> message = "You are not licensed to run this product! ";
}< br> // license in use
else if (licensestatus = esrilicensestatus. esrilicenseunavailable)
{< br> message = "there are insuffient licenses to run! ";
}< br> // unknown error
else if (licensestatus = esrilicensestatus. esrilicensefailure)
{< br> message =" unexpected license failure! Please contact your administrator. ";
}< br> // It has been initialized.
else if (licensestatus = esrilicensestatus. esrilicensealreadyinitialized)
{< br> message = "the license has already been initialized! Please check your implementation. ";
}< br> return message;
}< BR >}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.