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.
		
		
		
		
		
			
		
			
				
					
					
						
							81 lines
						
					
					
						
							2.6 KiB
						
					
					
				
			
		
		
	
	
							81 lines
						
					
					
						
							2.6 KiB
						
					
					
				using ESRI.ArcGIS.Carto; | 
						|
using ESRI.ArcGIS.Controls; | 
						|
using KGIS.Framework.Commands; | 
						|
using KGIS.Framework.Maps; | 
						|
using KGIS.Framework.Utils; | 
						|
using KGIS.Framework.Utils.Helper; | 
						|
using Kingo.Plugin.MapView.Views; | 
						|
using System; | 
						|
 | 
						|
namespace Kingo.Plugin.MapView.Commands | 
						|
{ | 
						|
    /// <summary> | 
						|
    /// 打开最近工程文件 | 
						|
    /// </summary> | 
						|
    public class CmdOpenAerialView : BaseMenuCommand | 
						|
    { | 
						|
        /// <summary> | 
						|
        /// 打开工程页面 | 
						|
        /// </summary> | 
						|
        FrmAerialView mView = null; | 
						|
        IHookHelper hookHelper = null; | 
						|
        public override void OnClick() | 
						|
        { | 
						|
            try | 
						|
            { | 
						|
                EngineEditorClass engineEditorClass = new EngineEditorClass(); | 
						|
                if (engineEditorClass.EditState != esriEngineEditState.esriEngineStateNotEditing) | 
						|
                { | 
						|
                    MessageHelper.ShowTips("当前工程正处于编辑状态,打开工程之前请先结束编辑!"); | 
						|
                    return; | 
						|
                } | 
						|
                ILayer layer = MapsManager.Instance.MapService.GetFeatureLayerByLayerName("行政区"); | 
						|
                if (layer == null) | 
						|
                { | 
						|
                    MessageHelper.ShowTips("请进行基础数据加载-行政区!"); | 
						|
                    return; | 
						|
                } | 
						|
                if (mView == null) | 
						|
                { | 
						|
                    mView = new FrmAerialView(layer); | 
						|
                    mView.Closed += UcOpenProject_Closed; | 
						|
                } | 
						|
                mView.ShowInMainWindow(false); | 
						|
            } | 
						|
            catch (Exception ex) | 
						|
            { | 
						|
                LogAPI.Debug("在打开工程时发生异常,异常信息如下:" + ex.Message); | 
						|
            } | 
						|
        } | 
						|
        private void UcOpenProject_Closed(object sender, EventArgs e) | 
						|
        { | 
						|
            try | 
						|
            { | 
						|
                if (mView != null) | 
						|
                    mView = null; | 
						|
            } | 
						|
            catch (Exception ex) | 
						|
            { | 
						|
                LogAPI.Debug("在关闭工程时发生异常,异常信息如下:" + ex.Message); | 
						|
            } | 
						|
        } | 
						|
 | 
						|
        public override void OnCreate(object Hook) | 
						|
        { | 
						|
            try | 
						|
            { | 
						|
                if (hookHelper == null) | 
						|
                { | 
						|
                    hookHelper = new HookHelper(); | 
						|
                    hookHelper.Hook = Hook; | 
						|
                } | 
						|
            } | 
						|
            catch (Exception ex) | 
						|
            { | 
						|
                LogAPI.Debug("在 初始化 打开工程 命令时异常,异常信息如下:"); | 
						|
                LogAPI.Debug(ex); | 
						|
                LogAPI.Debug("在 初始化 打开工程 命令时异常信息结束"); | 
						|
            } | 
						|
        } | 
						|
    } | 
						|
}
 | 
						|
 |