示例#1
0
        private bool editorCheckedOut()
        {
            bool         bRetVal      = false;
            CSpatialSubs oSpatialSubs = new CSpatialSubs();

            ESRI.ArcGIS.esriSystem.esriLicenseProductCode productCode = oSpatialSubs.returnCurrentProductCode();


            if (productCode == ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcEditor)
            {
                bRetVal = true;
            }
            else
            {
                //if (CMedToolsSubs.isProductAvailable(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcEditor) == ESRI.ArcGIS.esriSystem.esriLicenseStatus.esriLicenseAvailable)
                //{
                ESRI.ArcGIS.esriSystem.esriLicenseStatus status = oSpatialSubs.checkOutLicenses(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcEditor);
                if ((status == ESRI.ArcGIS.esriSystem.esriLicenseStatus.esriLicenseAlreadyInitialized) || (status == ESRI.ArcGIS.esriSystem.esriLicenseStatus.esriLicenseAlreadyInitialized))
                {
                    bRetVal = true;
                }

                //}
            }
            oSpatialSubs.Dispose();
            return(bRetVal);
        }
示例#2
0
        private string returnCurrentLicense()
        {
            string       sRetVal      = "";
            CSpatialSubs oSpatialSubs = new CSpatialSubs();

            switch (oSpatialSubs.returnCurrentProductCode())
            {
            case ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcView:
                sRetVal = "ArcView";
                break;

            case ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcEditor:
                sRetVal = "ArcEditor";
                break;

            case ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcInfo:
                sRetVal = "ArcInfo";
                break;

            default:
                sRetVal = "unspecified";
                break;
            }
            oSpatialSubs.Dispose();
            return(sRetVal);
        }
示例#3
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            CSpatialSubs oSpatialSubs = new CSpatialSubs();

            if (oSpatialSubs.returnCurrentProductCode() == ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcView)
            {
                string sMsg = "This action requires that you use at least an ArcEditor license\r\n\r\n";
                sMsg += "Click 'YES' below to have the application restart for you (you will NOT be prompted to save)\r\n";
                sMsg += "or\r\nclick 'No' below to restart later and then checkout an Editor license from the Desktop Administrator";
                sMsg += "\r\n\r\nDo you want to restart the application?";

                if (MessageBox.Show(sMsg, "Editor License Required", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
                {
                    //if (CMedToolsSubs.isProductAvailable(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcEditor) == ESRI.ArcGIS.esriSystem.esriLicenseStatus.esriLicenseAvailable)
                    //{
                    //// shut down the app and restart
                    CMedToolsSubs.ResetAsEditor = true;
                    CloseForm();
                    //}
                    //else
                    //{
                    //    MessageBox.Show("There is no Editor license available at the moment.", "License problem", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    //}
                }
            }
            else
            {
                Cursor = Cursors.WaitCursor;
                try
                {
                    ///
                    /// rev. 12/13/2007
                    /// by: David Renz
                    /// changed to just use the selected featureclass
                    ///
                    oSpatialSubs.addFeatureLayerToMap(this.App, lbEditabelLayers.SelectedItem.ToString(), true);

                    // add the layers to ArcMap
                    //foreach (object obj in lbEditabelLayers.Items)
                    //{
                    //    CMedToolsSubs.addFeatureLayerToMap(this.App, obj.ToString(), true);
                    //}
                    CloseForm();
                }
                catch (Exception ex)
                {
                    //MessageBox.Show("An error occurred while loading the layers into the application.\r\n\r\nPlease check with the GIS administrator to ensure that you have edit priviledges on the selected layers.");
                    this.lblEditMsg.Text = ex.Message.ToString(); //"An error occurred while starting an editing session.\r\n\r\nPlease check with the GIS administrator to ensure\r\nthat you have edit priviledges on the selected layers.";
                    //this.lblEditMsg.Text += "\r\n\r\n" + ex.Message;
                    return;
                }
                finally
                {
                    Cursor = Cursors.Default;
                    oSpatialSubs.Dispose();
                }
            }
        }