You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							106 lines
						
					
					
						
							3.2 KiB
						
					
					
				
			
		
		
	
	
							106 lines
						
					
					
						
							3.2 KiB
						
					
					
				using System; | 
						|
using DevExpress.XtraBars; | 
						|
using ESRI.ArcGIS.Controls; | 
						|
using KGIS.Framework.Commands; | 
						|
using KGIS.Framework.Menus; | 
						|
using KGIS.Framework.Utils; | 
						|
 | 
						|
namespace Kingo.Plugin.EngineEditor.Commands.Commands | 
						|
{ | 
						|
    public class CmdTargetEditLayerLable : BaseMenuCommand, ICombox | 
						|
    { | 
						|
        private IHookHelper m_hookHelper; | 
						|
        private EngineEditorClass editor = new EngineEditorClass(); | 
						|
        private BarHeaderItem _baritem = null; | 
						|
        private ControlsEditingEditTool editTool = null; | 
						|
        //Framework.Common.Utils.RegionAuthorize RegionAuthorize = null; | 
						|
        public object BarEditItem | 
						|
        { | 
						|
            get | 
						|
            { | 
						|
                return _baritem; | 
						|
            } | 
						|
        } | 
						|
 | 
						|
        public bool IsShowCaption | 
						|
        { | 
						|
            get | 
						|
            { | 
						|
                return true; | 
						|
            } | 
						|
        } | 
						|
        //public override string Caption | 
						|
        //{ | 
						|
        //    get | 
						|
        //    { | 
						|
        //        return "目标图层"; | 
						|
        //    } | 
						|
        //} | 
						|
        public override bool Enabled | 
						|
        { | 
						|
            get | 
						|
            { | 
						|
                if (editor.EditState != esriEngineEditState.esriEngineStateEditing) | 
						|
                { | 
						|
                    //if (_baritem != null) | 
						|
                    //    _baritem.EditValue = null; | 
						|
                    return false; | 
						|
                } | 
						|
                return true; | 
						|
            } | 
						|
        } | 
						|
 | 
						|
        public override void OnClick() | 
						|
        { | 
						|
            //UCWpfPanel ucWpfPanel = new UCWpfPanel(); | 
						|
            //Platform.Instance.GetViewManager().OpenView(comboxEdit, false); | 
						|
        } | 
						|
 | 
						|
        public override void OnCreate(object hook) | 
						|
        { | 
						|
            try | 
						|
            { | 
						|
                if (m_hookHelper == null) | 
						|
                { | 
						|
                    m_hookHelper = new HookHelper(); | 
						|
                    m_hookHelper.Hook = hook; | 
						|
                    editor.OnTargetLayerChanged += () => | 
						|
                    { | 
						|
                        if (_baritem != null) | 
						|
                        { | 
						|
                            if (editor.EditState == esriEngineEditState.esriEngineStateEditing) | 
						|
                                _baritem.Caption = string.Format("当前编辑:{0}", editor.TargetLayer == null ? "未选择" : editor.TargetLayer.Name); | 
						|
                        } | 
						|
                    }; | 
						|
                    editor.OnStopEditing += (b) => | 
						|
                    { | 
						|
                        if (_baritem != null) | 
						|
                        { | 
						|
                            _baritem.Caption = string.Format("当前编辑:{0}", "未开启"); | 
						|
                        } | 
						|
                    }; | 
						|
                } | 
						|
 | 
						|
            } | 
						|
            catch (Exception ex) | 
						|
            { | 
						|
                //LogAPI.Debug("目标图层获取异常!" + ex.Message); | 
						|
 | 
						|
                LogAPI.Debug("初始化 目标图层 命令时异常,异常信息如下:"); | 
						|
                LogAPI.Debug(ex); | 
						|
                LogAPI.Debug("初始化 目标图层 命令时异常信息结束"); | 
						|
            } | 
						|
        } | 
						|
 | 
						|
        public void SetBarEditItem(object barItem) | 
						|
        { | 
						|
            if (barItem is BarHeaderItem) | 
						|
            { | 
						|
                _baritem = barItem as BarHeaderItem; | 
						|
                //_baritem.EditWidth = 120; | 
						|
                _baritem.Caption = "当前编辑:未开启"; | 
						|
            } | 
						|
        } | 
						|
    } | 
						|
 | 
						|
}
 | 
						|
 |