Esempio n. 1
0
        public override void OnClick()
        {
            FrmSDEWorkspaceAdd frmCreate = new FrmSDEWorkspaceAdd();
            if (frmCreate.ShowDialog() == DialogResult.OK)
            {
                ICatalogItem itemWorkspace = new WorkspaceCatalogItem(
                    frmCreate.ConnectionProperty.Args,
                    enumWorkspaceType.SDE,
                    m_HookHelper.RootCatalogItem,
                    frmCreate.ConnectionProperty.Name);

                (m_HookHelper.RootCatalogItem as RootCatalogItem).AddItem(itemWorkspace);
            }
        }
        public override void OnClick()
        {
            FrmLocalWorkspaceAdd frmCreate = new FrmLocalWorkspaceAdd();
            if (frmCreate.ShowDialog() == DialogResult.OK)
            {
                if (frmCreate.CreateNew)
                {
                    IWorkspace wsNew = Hy.Esri.Utility.WorkspaceHelper.CreateWorkspace(
                        frmCreate.WorkspaceType, frmCreate.WorkspacePath, frmCreate.WorkspaceName);

                    if (wsNew == null)
                    {
                        DevExpress.XtraEditors.XtraMessageBox.Show("抱歉,创建本地数据库出错啦!");

                    }
                    else
                    {
                        DevExpress.XtraEditors.XtraMessageBox.Show("已成功创建本地数据库!");

                    }
                }

                WorkspaceInfo wsInfo=new WorkspaceInfo();
                wsInfo.Name=frmCreate.WorkspaceAlias;
                wsInfo.Type=frmCreate.WorkspaceType;
                wsInfo.Args=System.IO.Path.Combine(frmCreate.WorkspacePath,frmCreate.WorkspaceName);

                Environment.NhibernateHelper.SaveObject(wsInfo);
                Environment.NhibernateHelper.Flush();

                ICatalogItem itemNew = new WorkspaceCatalogItem(
                    System.IO.Path.Combine(frmCreate.WorkspacePath, frmCreate.WorkspaceName),
                    frmCreate.WorkspaceType,
                    m_HookHelper.RootCatalogItem,
                    frmCreate.WorkspaceAlias);

                RootCatalogItem itemRoot = m_HookHelper.RootCatalogItem as RootCatalogItem;
                itemRoot.AddItem(itemNew);
            }
        }