private string ReportInformation(ILicenseInformation licInfo,
                                         esriLicenseProductCode code, esriLicenseStatus status)
        {
            string prodName = string.Empty;

            try
            {
                prodName = licInfo.GetLicenseProductName(code);
            }
            catch
            {
                prodName = code.ToString();
            }

            string statusInfo = string.Empty;

            switch (status)
            {
            case esriLicenseStatus.esriLicenseAlreadyInitialized:
            case esriLicenseStatus.esriLicenseCheckedOut:
                statusInfo = string.Format(MessageProductAvailable, prodName);
                break;

            default:
                statusInfo = string.Format(MessageProductNotLicensed, prodName);
                break;
            }

            return(statusInfo);
        }
Exemplo n.º 2
0
        private bool IsArcInfoLicense()
        {
            IAoInitialize       aoi     = new AoInitializeClass();
            ILicenseInformation licInfo = (ILicenseInformation)aoi;

            return(licInfo.GetLicenseProductName(aoi.InitializedProduct()) == "ArcInfo");
        }
        // This is used to return whether the function tool is licensed to execute.
        public bool IsLicensed()
        {
            IAoInitialize       aoi     = new AoInitializeClass();
            ILicenseInformation licInfo = (ILicenseInformation)aoi;

            string licName = licInfo.GetLicenseProductName(aoi.InitializedProduct());

            if (licName == "Advanced")
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        ///     Gets the product status.
        /// </summary>
        /// <param name="licenseInformation">The license information.</param>
        /// <param name="licenseProductCode">The license product code.</param>
        /// <param name="licenseStatus">The license status.</param>
        /// <returns>Returns a <see cref="string" /> representing the status of the initialization.</returns>
        private string GetProductStatus(ILicenseInformation licenseInformation, esriLicenseProductCode licenseProductCode, esriLicenseStatus licenseStatus)
        {
            string productName;

            try
            {
                productName = licenseInformation.GetLicenseProductName(licenseProductCode);
            }
            catch
            {
                productName = licenseProductCode.ToString();
            }

            switch (licenseStatus)
            {
            case esriLicenseStatus.esriLicenseAlreadyInitialized:
            case esriLicenseStatus.esriLicenseCheckedOut:
                return(string.Format(MESSAGE_PRODUCT_AVAILABLE, productName));

            default:
                return(string.Format(MESSAGE_PRODUCT_NOT_LICENSED, productName));
            }
        }
    private string ReportInformation(ILicenseInformation licInfo,
       esriLicenseProductCode code, esriLicenseStatus status)
    {
      string prodName = string.Empty;
      try
      {
        prodName = licInfo.GetLicenseProductName(code);
      }
      catch
      {
        prodName = code.ToString();
      }

      string statusInfo = string.Empty;

      switch (status)
      {
        case esriLicenseStatus.esriLicenseAlreadyInitialized:
        case esriLicenseStatus.esriLicenseCheckedOut:
          statusInfo = string.Format(MessageProductAvailable, prodName);
          break;
        default:
          statusInfo = string.Format(MessageProductNotLicensed, prodName);
          break;
      }

      return statusInfo;
    }