示例#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);
            }
        }
        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);
            }
        }