コード例 #1
0
        public override void OnClick()
        {
            frmObjectClass _frmObjectClass = new frmObjectClass()
            {
                UseType = enumUseType.enumUTObjectClass
            };
            IObjectClass objectClass = null;

            if (((IGxSelection)_context.GxSelection).FirstObject is IGxDatabase)
            {
                GxCatalogCommon.ConnectGDB(((IGxSelection)_context.GxSelection).FirstObject as IGxDatabase);
                if ((((IGxSelection)_context.GxSelection).FirstObject as IGxDatabase).Workspace == null)
                {
                    return;
                }
                _frmObjectClass.Dataset = (((IGxSelection)_context.GxSelection).FirstObject as IGxDatabase).Workspace;
                if (_frmObjectClass.ShowDialog() == DialogResult.OK)
                {
                    objectClass = _frmObjectClass.ObjectClass;
                }
            }
            if (objectClass != null)
            {
                ((IGxSelection)_context.GxSelection).FirstObject.Refresh();
            }
        }
コード例 #2
0
        public override void OnClick()
        {
            frmObjectClass _frmObjectClass = new frmObjectClass()
            {
                UseType = enumUseType.enumUTFeatureClass
            };
            IObjectClass      objectClass = null;
            IWorkspaceFactory shapefileWorkspaceFactoryClass = new ShapefileWorkspaceFactory();
            IWorkspace        workspace =
                shapefileWorkspaceFactoryClass.OpenFromFile(((IGxSelection)_context.GxSelection).FirstObject.FullName,
                                                            0);

            _frmObjectClass.Dataset = workspace;
            if (_frmObjectClass.ShowDialog() == DialogResult.OK)
            {
                objectClass = _frmObjectClass.ObjectClass;
            }
            if (objectClass != null)
            {
                ((IGxSelection)_context.GxSelection).FirstObject.Refresh();
            }
        }