public override void OnClick() { Hy.Check.Task.Task task = Hy.Check.Command.CheckApplication.CurrentTask; if (task == null) { return; } if (task.State != Hy.Check.Task.enumTaskState.Created) { if (DevExpress.XtraEditors.XtraMessageBox.Show("当前任务已经执行过检查,您确定要覆盖之前的检查结果吗?", "提示", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No) { return; } } task.ReadyForCheck(true); TemplateRules templateRules = new TemplateRules(task.SchemaID); CheckApplication.TaskChanged(null); Hy.Check.UI.Forms.FrmTaskCheck frmCheck = new Hy.Check.UI.Forms.FrmTaskCheck(task, templateRules.CurrentSchemaRules); frmCheck.CheckTask(); //if (frmCheck.DialogResult == System.Windows.Forms.DialogResult.Abort) // return; CheckApplication.TaskChanged(task); }
public override void OnClick() { System.Data.IDbConnection resultConnection = CheckApplication.CurrentTask.ResultConnection as System.Data.OleDb.OleDbConnection; if (resultConnection == null) { DevExpress.XtraEditors.XtraMessageBox.Show("当前任务状态被标记为已创建,但结果库可能已被移除。"); return; } System.Windows.Forms.SaveFileDialog dlgShpFile = new System.Windows.Forms.SaveFileDialog(); dlgShpFile.FileName = Environment.CurrentDirectory + "\\" + CheckApplication.CurrentTask.Name + ".xls"; dlgShpFile.Filter = "SHP 文件|*.Shp"; if (dlgShpFile.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } string strFile = dlgShpFile.FileName; string strPath = System.IO.Path.GetDirectoryName(strFile); string strName = System.IO.Path.GetFileNameWithoutExtension(strFile); Hy.Check.Task.Task curTask = CheckApplication.CurrentTask; ErrorExporter exporter = new ErrorExporter(); exporter.BaseWorkspace = curTask.BaseWorkspace; exporter.ResultConnection = curTask.ResultConnection; exporter.SchemaID = curTask.SchemaID; exporter.Topology = curTask.Topology; exporter.ExportToShp(strPath, strName); }
public override void OnClick() { Hy.Check.Task.Task curTask = CheckApplication.CurrentTask; string strLogFile = curTask.GetTaskFolder() + "\\任务日志_" + curTask.Name + "_" + curTask.ID + ".txt"; if (!System.IO.File.Exists(strLogFile)) { DevExpress.XtraEditors.XtraMessageBox.Show("当前任务日志文件不存在,请确认是否人为丢失。"); return; } System.Diagnostics.Process.Start(System.Environment.SystemDirectory + "\\notepad.exe", strLogFile); }
public override void OnClick() { List <SchemaRuleEx> ruleSelection = null; FrmPreCheck frmPreCheck = new FrmPreCheck(); frmPreCheck.CurrentTemplateRules = CheckApplication.InitCurrentTemplateRules(); frmPreCheck.SchemaRulesSelection = ruleSelection; if (frmPreCheck.ShowDialog() == DialogResult.Yes) { Hy.Check.Task.Task task = Hy.Check.Command.CheckApplication.CurrentTask; task.ReadyForCheck(false); ruleSelection = frmPreCheck.SchemaRulesSelection; CheckApplication.TaskChanged(null); Hy.Check.UI.Forms.FrmTaskCheck frmCheck = new Hy.Check.UI.Forms.FrmTaskCheck(task, ruleSelection); frmCheck.CheckTask(); CheckApplication.TaskChanged(task); } }
/// <summary> /// Occurs when this command is clicked /// </summary> public override void OnClick() { System.Data.IDbConnection resultConnection = CheckApplication.CurrentTask.ResultConnection as System.Data.OleDb.OleDbConnection; if (resultConnection == null) { DevExpress.XtraEditors.XtraMessageBox.Show("当前任务状态被标记为已创建,但结果库可能已被移除。"); return; } System.Windows.Forms.SaveFileDialog dlgShpFile = new System.Windows.Forms.SaveFileDialog(); dlgShpFile.FileName = Environment.CurrentDirectory + "\\" + CheckApplication.CurrentTask.Name + ".shp"; dlgShpFile.Filter = "SHP 文件|*.Shp"; dlgShpFile.OverwritePrompt = true; if (dlgShpFile.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } string strFile = dlgShpFile.FileName; string strPath = System.IO.Path.GetDirectoryName(strFile); string strName = System.IO.Path.GetFileNameWithoutExtension(strFile); // 检查已存在 if (System.IO.File.Exists(strFile)) { //System.IO.File.Delete(dlgShpFile.FileName); try { IWorkspace ws = Hy.Common.Utility.Esri.AEAccessFactory.OpenWorkspace(enumDataType.SHP, strPath); IDataset dsShp = (ws as IFeatureWorkspace).OpenFeatureClass(strName) as IDataset; if (dsShp != null) { dsShp.Delete(); } } catch { try { System.IO.File.Delete(strFile); } catch { XtraMessageBox.Show("文件删除失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } // 开始导出 CheckApplication.GifProgress.ShowHint("正在导出错误结果到Shp文件,请稍候……"); Hy.Check.Task.Task curTask = CheckApplication.CurrentTask; ErrorExporter exporter = new ErrorExporter(); exporter.BaseWorkspace = curTask.BaseWorkspace; exporter.ResultConnection = curTask.ResultConnection; exporter.SchemaID = curTask.SchemaID; exporter.Topology = curTask.Topology; bool isSucceed = exporter.ExportToShp(strPath, strName); CheckApplication.GifProgress.Hide(); GC.Collect(); if (isSucceed) { XtraMessageBox.Show("导出Shp成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { XtraMessageBox.Show("导出Shp失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }