コード例 #1
0
        public override void Execute(DevComponents.DotNetBar.ICommandSource commandSource)
        {
            XMManagerControl pXMManagerControl = commandSource.CommandParameter as XMManagerControl;
            IXMRK            pXMRK             = pXMManagerControl.GetXMRK();
            bool             IsNewXMYD         = pXMRK.ID == -1;

            if (pXMRK.GetIsGeoCange() && !IsNewXMYD)
            {
                AcadApplication AcadApp = pXMManagerControl.AcadApp;
                UploadCurCAD(AcadApp, pXMRK);
            }
            try
            {
                pXMRK.Save();
                if (IsNewXMYD)
                {
                    AcadApplication AcadApp = pXMManagerControl.AcadApp;
                    UploadCurCAD(AcadApp, pXMRK);
                }
                ISTPoint MinPoint = pXMRK.STGeometry.GetMinPoint();
                ISTPoint MaxPoint = pXMRK.STGeometry.GetMaxPoint();
                pXMRK.UpdateMapServerCache(MinPoint.X, MinPoint.Y, MaxPoint.X, MaxPoint.Y);
                MessageBox.Show("保存成功", "消息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "保存出错", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        public override void Execute(DevComponents.DotNetBar.ICommandSource commandSource)
        {
            XMManagerControl pXMManagerControl = commandSource.CommandParameter as XMManagerControl;
            IXMRK            pXMRK             = pXMManagerControl.XMRK;

            if (pXMRK != null && pXMRK.ID != -1)
            {
                if (MessageBox.Show(string.Format("是否删除项目{0}", pXMRK.XMBH), "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)
                    == DialogResult.Cancel)
                {
                    return;
                }
                ISTPointCollection pSTPointCollection = pXMRK.SoucePoints;
                ISTPoint           MinPoint           = pSTPointCollection.GetMinPoint();
                ISTPoint           MaxPoint           = pSTPointCollection.GetMaxPoint();
                pXMRK.Delete();
                pXMRK.UpdateMapServerCache(MinPoint.X, MinPoint.Y, MaxPoint.X, MaxPoint.Y);
                MessageBox.Show("删除成功", "消息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
コード例 #3
0
        public override void Execute(DevComponents.DotNetBar.ICommandSource commandSource)
        {
            OpenFileDialog opoFile = new OpenFileDialog();

            opoFile.Filter = "CAD文件(*.dwg)|*.dwg|CAD图形文件(*.dxf)|*.dxf";
            opoFile.Title  = "打开入库文件";
            if (opoFile.ShowDialog() == DialogResult.OK)
            {
                string strFileName = opoFile.FileName;
                try
                {
                    AcadApplication  AcadApp           = (AcadApplication)System.Runtime.InteropServices.Marshal.GetActiveObject("AutoCAD.Application");
                    AcadDocument     AcadDoc           = AcadApp.Documents.Open(strFileName, null, null);
                    XMManagerControl pXMManagerControl = commandSource.CommandParameter as XMManagerControl;
                    pXMManagerControl.NewXM();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #4
0
        public override void Execute(DevComponents.DotNetBar.ICommandSource commandSource)
        {
            XMManagerControl pXMManagerControl = commandSource.CommandParameter as XMManagerControl;

            pXMManagerControl.NewXM();
        }