年度变更建库软件5.0版本
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.
 
 

109 lines
3.8 KiB

using KGIS.Framework.Commands;
using KGIS.Framework.Maps;
using KGIS.Framework.Utils.Helper;
using Kingo.Plugin.DTBYCL.View;
using Kingo.PluginServiceInterface;
using System;
namespace Kingo.Plugin.DTBYCL.Commands
{
/// <summary>
/// 导入导出
/// </summary>
class CmdTaskExportAndImport : BaseMenuCommand
{
private UCYSResultExport uCYSResultExport { get; set; }
private string SaveResultPath { get; set; }
public override void OnCreate(object hook)
{
}
public override void OnClick()
{
try
{
ProjectInfo ProjectInfo = MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo;
if (string.IsNullOrWhiteSpace(ProjectInfo.JCKPath))
{
MessageHelper.Show("请先使用“基础数据加载”功能设置基础库数据!");
return;
}
if (ProjectInfo.ListTaskPackage == null || ProjectInfo.ListTaskPackage.Count == 0)
{
MessageHelper.Show("请先使用“任务目录设置或新建任务包”功能加载或创建外业任务包!");
return;
}
if (string.IsNullOrWhiteSpace(ProjectInfo.UserName))
{
MessageHelper.Show("请先使用“用户设置”功能设置用户名!");
return;
}
if (uCYSResultExport == null)
{
uCYSResultExport = new UCYSResultExport(true);
uCYSResultExport.Title = "批量导入导出";
uCYSResultExport.Width = 850;
uCYSResultExport.Height = 450;
uCYSResultExport.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
uCYSResultExport.Closed += UCYSResultExport_Closed;
uCYSResultExport.ShowInMainForm(false);
}
}
catch (Exception ex)
{
KGIS.Framework.Utils.LogAPI.Debug("预处理成果输出界面加载异常:" + ex.Message);
MessageHelper.ShowError("预处理成果输出界面加载异常:" + ex.Message);
}
finally
{
try
{
if (System.IO.File.Exists(this.SaveResultPath))
{
System.IO.File.Delete(this.SaveResultPath);
}
}
catch (Exception ex)
{
KGIS.Framework.Utils.LogAPI.Debug(ex);
}
}
}
private void UCYSResultExport_Closed(object sender, EventArgs e)
{
try
{
if (uCYSResultExport != null)
{
uCYSResultExport.Close();
}
uCYSResultExport = null;
}
catch (Exception ex)
{
KGIS.Framework.Utils.LogAPI.Debug(ex);
}
}
public override bool Enabled
{
get
{
//IEngineEditor engineEditor = new EngineEditorClass();
//if (engineEditor.EditState == esriEngineEditState.esriEngineStateEditing || KGIS.Framework.Platform.Platform.Instance.GetProjectInfo() == null)
//{
// return false;
//}
//return true;
ProjectInfo prj = MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo;
if (prj == null)
{
return false;
}
return true;
}
}
}
}