public FrmTaskCheck(CheckTask task, System.Collections.Generic.List <SchemaRuleEx> ruleInfoList) { InitializeComponent(); this.CurrentTask = task; this.RuleInfoList = ruleInfoList; }
private void btnOpenFromFile_Click(object sender, EventArgs e) { FolderBrowserDialog folderDialog = new FolderBrowserDialog(); folderDialog.ShowNewFolderButton = false; folderDialog.Description = "请选择质检任务"; if (folderDialog.ShowDialog() == DialogResult.OK) { try { string strFolderPath = folderDialog.SelectedPath; string strConfigFile = strFolderPath + "\\" + COMMONCONST.File_Name_SystemConfig; CheckTask task = TaskHelper.FromTaskConfig(strConfigFile); // 修改task的path为上级目录,名称为当前文件夹名称 DirectoryInfo dirInfo = new DirectoryInfo(strFolderPath); task.Name = dirInfo.Name; task.Path = dirInfo.Parent.FullName; m_SelectedTask = task; if (m_SytemTask != null && m_SytemTask.Name == m_SelectedTask.Name && m_SytemTask.Path == m_SelectedTask.Path) { XtraMessageBox.Show("任务已打开"); return; } this.DialogResult = DialogResult.OK; } catch { XtraMessageBox.Show("从文件打开任务失败!", "提示"); } } }
/// <summary> /// 加载任务列表 /// 使用结构化的方法--由CheckTask和TaskHelper提供的方法,而不在此类中直接跟数据库及字段打交道 /// </summary> private void Init() { // 加载任务列表 m_AllTasks = TaskHelper.GetAllTasks(); if (m_AllTasks == null) { return; } DataTable tTask = ConstructTaskTable(); int count = m_AllTasks.Count; for (int i = 0; i < count; i++) { CheckTask task = m_AllTasks[i]; DataRow rowTask = tTask.NewRow(); rowTask[0] = task.Name; rowTask[1] = task.Path; rowTask[2] = task.SourcePath; rowTask[3] = task.DatasourceType.ToString(); tTask.Rows.Add(rowTask); } this.gridControlTasks.DataSource = tTask; this.gridControlTasks.RefreshDataSource(); }
private CheckTask GenerateTask() { CheckTask task = new CheckTask(); task.DatasourceType = m_DataType; task.SourcePath = this.txtDatasource.Text; task.UseSourceDirectly = checkBoxUseSourceDirectly.Checked; task.Name = this.txtTaskName.Text; task.Path = this.txtTaskPath.Text; task.StandardName = cmbStandard.SelectedItem as string; task.SchemaID = ((KeyValuePair <string, string>)cmbSchema.SelectedItem).Key; task.TopoTolerance = double.Parse(txtTopoTolerance.Text); task.MapScale = m_MapScales[cmbScale.SelectedIndex]; if (m_DicSpatialReference != null) { task.SpatialReference = m_DicSpatialReference[cmbSpatialRefLayer.SelectedItem as string]; } task.Institution = txtInstitute.Text; task.Creator = txtPerson.Text; task.CreateTime = dateTime.DateTime.ToString(); task.Remark = txtRemark.Text; return(task); }
void multiTask_TaskCreated(CheckTask curTask) { if (m_GifProgress != null) { m_GifProgress.Hide(); } }
public FrmTaskCheck(CheckTask task, System.Collections.Generic.List<SchemaRuleEx> ruleInfoList) { InitializeComponent(); this.CurrentTask = task; this.RuleInfoList = ruleInfoList; }
public UCResult(object hook, CheckTask currentTask) { InitializeComponent(); this.Hook = hook; this.m_CurrentTask = currentTask; this.m_ErrorHelper.ResultConnection = currentTask.ResultConnection; }
void multiTask_CheckingTaskChanged(Hy.Check.Engine.Checker curChecker, CheckTask curTask) { m_FrmCheck = new FrmTaskCheck(curTask, null); m_FrmCheck.CurrentTask = curTask; m_FrmCheck.AdaptCheckerEvents(curChecker); m_FrmCheck.Show(); m_FrmCheck.ReadyForCheck(); Application.DoEvents(); //if (m_FrmCheck.InvokeRequired) //{ //System.Threading.ThreadStart threadStart = delegate //{ // if (m_FrmCheck.InvokeRequired) // { // System.Threading.ThreadStart threadStartSub = delegate // { // m_FrmCheck.Show(); // m_FrmCheck.ReadyForCheck(); // }; // m_FrmCheck.Invoke(threadStartSub); // } // else // { // m_FrmCheck.ReadyForCheck(); // m_FrmCheck.ShowDialog(); // } //}; //System.Threading.Thread thread = new System.Threading.Thread(threadStart); //thread.Start(); //} //else //{ // m_FrmCheck.Show(); // if (m_FrmCheck.InvokeRequired) // { // m_FrmCheck.Invoke(new System.Threading.ThreadStart(m_FrmCheck.ReadyForCheck)); // } // else // { // m_FrmCheck.ReadyForCheck(); // } // Application.DoEvents(); //} }
private void gridViewTasks_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { int[] handleSelected = gridViewTasks.GetSelectedRows(); if (handleSelected == null || handleSelected.Length == 0) { btnOpenTask.Enabled = false; btnDeleteTask.Enabled = false; } else { btnOpenTask.Enabled = true; btnDeleteTask.Enabled = true; } int taskIndex = gridViewTasks.GetDataSourceRowIndex(handleSelected[0]); m_SelectedTask = m_AllTasks[taskIndex]; }
void multiTask_TaskChecked(Hy.Check.Engine.Checker curChecker, CheckTask curTask) { if (m_FrmCheck.InvokeRequired) { System.Threading.ThreadStart threadStart = delegate { m_FrmCheck.Close(); m_FrmCheck.Dispose(); }; //System.Threading.Thread thread = new System.Threading.Thread(threadStart); //thread.Start(); m_FrmCheck.Invoke(threadStart); } else { m_FrmCheck.Close(); m_FrmCheck.Dispose(); } }
/// <summary> /// 指写入数据库记录 /// </summary> /// <param name="task"></param> /// <returns></returns> public static bool AddTask(Task task) { try { IDbConnection sysConnection = SysDbHelper.GetSysDbConnection(); DataTable tTask = AdoDbHelper.GetDataTable(sysConnection, "select * from LR_ModelTask where 1=2"); DataRow rowNewTask = tTask.NewRow(); rowNewTask["TaskID"] = task.ID; rowNewTask["TaskName"] = task.Name; rowNewTask["TaskPath"] = task.Path; rowNewTask["LibraryName"] = task.SourcePath; rowNewTask["TaskType"] = (int)task.DatasourceType; rowNewTask["SchemaID"] = task.SchemaID; rowNewTask["ExeState"] =(int) task.State; rowNewTask["Institution"] = task.Institution; rowNewTask["Person"] = task.Creator; rowNewTask["CreateTime"] = task.CreateTime; rowNewTask["Remark"] = task.Remark; rowNewTask["MapScale"] = task.MapScale; rowNewTask["TopoTolerance"] = task.TopoTolerance; rowNewTask["UseDatasource"] = task.UseSourceDirectly; rowNewTask["StandardID"]=SysDbHelper.GetStandardID( task.StandardName); rowNewTask["LibraryID"] = 0; rowNewTask["BIsTemplate"] = 0; tTask.Rows.Add(rowNewTask); return AdoDbHelper.UpdateTable("LR_ModelTask", tTask, sysConnection); } catch { return false; } }
/// <summary> /// 从数据记录形成Task对象 /// </summary> /// <param name="rowTask"></param> /// <returns></returns> public static Task GetTaskFromDataRow(System.Data.DataRow rowTask) { if (rowTask == null) return null; try { Task task = new Task(); task.ID = rowTask["TaskID"] as string; task.Name = rowTask["TaskName"] as string; task.Path = rowTask["TaskPath"] as string; task.SourcePath = rowTask["LibraryName"] as string; task.DatasourceType =(enumDataType)Convert.ToInt32( rowTask["TaskType"]); task.SchemaID = rowTask["SchemaID"] as string; task.State =(enumTaskState) Convert.ToInt32(rowTask["ExeState"]); task.StandardName = SysDbHelper.GetStandardName(Convert.ToInt32(rowTask["StandardID"])); task.Institution = rowTask["Institution"] as string; task.Creator = rowTask["Person"] as string; task.CreateTime = rowTask["CreateTime"] as string; task.Remark = rowTask["Remark"] as string; task.MapScale = Convert.ToInt32(rowTask["MapScale"]); task.TopoTolerance = Convert.ToDouble(rowTask["TopoTolerance"]); task.UseSourceDirectly = (bool)rowTask["UseDatasource"]; return task; } catch { return null; } }
void multiTask_CreatingTaskChanged(CheckTask curTask) { m_GifProgress = new Hy.Common.UI.XGifProgress(); m_GifProgress.ShowHint(string.Format("正在创建任务“{0}”…", curTask.Name)); }
void multiTask_TaskCreated(CheckTask curTask) { if (m_GifProgress != null) m_GifProgress.Hide(); }
/// <summary> /// ����Task�����д��� /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void wizardControl_FinishClick(object sender, CancelEventArgs e) { this.m_Task = GenerateTask(); IDataImport dataImporter = null; switch (this.m_DataType) { case enumDataType.FileGDB: dataImporter = new FileGDBDataImport(); break; case enumDataType.PGDB: dataImporter = new MDBDataImport(); break; case enumDataType.SHP: dataImporter = new SHPDataImport(); break; case enumDataType.VCT: VCTDataImport vctDataImport=new VCTDataImport(); // vctDataImport.ConvertStepping += new VCTConvertStepHandler(vctDataImport_ConvertStepping); dataImporter = vctDataImport; break; } this.m_Task.DataImporter = dataImporter; this.m_Task.Messager = MessageHandler; //#if !DEBUG this.Hide(); //#endif #region ��̨�̵߳��뷽ʽ //Hy.Common.UI.frmProgress frmProgress = new Hy.Common.UI.frmProgress(); //dataImporter.ImportingObjectChanged += new ImportingObjectChangedHandler(frmProgress.ShowDoing); //System.Threading.Thread newThread = new System.Threading.Thread(new System.Threading.ThreadStart(RunTaskCreate)); //newThread.Start(); //frmProgress.ShowGifProgress(); //frmProgress.ShowDialog(); #endregion // �߳���ʾ���ȷ�ʽ dataImporter.ImportingObjectChanged += new ImportingObjectChangedHandler(dataImporter_ImportingObjectChanged); try { bool isSucceed = m_Task.Create(); isSucceed = isSucceed && m_Task.CreateMXD(); if (isSucceed) { //MessageBoxApi.ShowFinishedMessageBox("�����ɹ�!"); BolFinished = true; this.DialogResult = DialogResult.OK; } else { MessageBoxApi.ShowFinishedMessageBox("����ʧ��!"); this.DialogResult = DialogResult.Cancel; } } catch (Exception exp) { MessageHandler(enumMessageType.Exception, exp.ToString()); } finally { m_GifProgress.Hide(); //m_Progress.Hide(); } }
private CheckTask GenerateTask() { CheckTask task = new CheckTask(); task.DatasourceType = m_DataType; task.SourcePath = this.txtDatasource.Text; task.UseSourceDirectly = checkBoxUseSourceDirectly.Checked; task.Name = this.txtTaskName.Text; task.Path = this.txtTaskPath.Text; task.StandardName = cmbStandard.SelectedItem as string; task.SchemaID = (( KeyValuePair<string, string>)cmbSchema.SelectedItem ).Key; task.TopoTolerance = double.Parse(txtTopoTolerance.Text); task.MapScale = m_MapScales[cmbScale.SelectedIndex]; if (m_DicSpatialReference != null) { task.SpatialReference = m_DicSpatialReference[cmbSpatialRefLayer.SelectedItem as string]; } task.Institution = txtInstitute.Text; task.Creator = txtPerson.Text; task.CreateTime = dateTime.DateTime.ToString(); task.Remark = txtRemark.Text; return task; }
/// <summary> /// Sets the task. /// </summary> /// <param name="task">The task.</param> public void SetTask(CheckTask task) { XGifProgress progressbar = new XGifProgress(); try { //如果task为null则认为释放资源 if (task == null) { UCDispose(); return; } //如果不为空,做处理 m_CurrentTask = task; //如果打开新建的任务 progressbar.ShowHint("正在打开当前质检任务....."); //初始化规则树 this.ucRulesTree.CurrentSchemaId = task.SchemaID; this.ucRulesTree.CurrentTaskName = task.Name; //采用委托,在创建此控件的线程上调用加载tree方法,防止出现“当前对象正在其他地方使用”的错误; LoadRules Load = new LoadRules(this.ucRulesTree.LoadRulesTree); this.BeginInvoke(Load); this.ucResult.CurrentTask = m_CurrentTask; if (File.Exists(task.GetMXDFile())) { //打开配置的mxd模板图层 UcMap.LoadMxFile(task.GetMXDFile()); TocControl.SetBuddyControl(UcMap.Object); TocControl.Update(); UcMap.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); m_MapLayersController = new MapLayersController(UcMap.Map); } else { progressbar.Hide(); MessageBoxApi.ShowErrorMessageBox(task.GetMXDFile() + "不存在!无法打开此任务"); return; } //加载结果 if (task.ResultConnection != null) { //加载已经检查完成的任务 this.TabCtrl.ShowTabHeader = DefaultBoolean.True; this.TabCtrl.SelectedTabPage = this.TabPageCheckResults; this.ucResultsTree.CurrentSchemaId = task.SchemaID; this.ucResultsTree.CurrentTaskName = task.Name; Sundary.ResultDbOper resultOper = new Hy.Check.UI.UC.Sundary.ResultDbOper(task.ResultConnection); this.ucResultsTree.LayersResultsDt = resultOper.GetLayersResults(); this.ucResultsTree.ResultsDt = resultOper.GetAllResults(); this.ucResultsTree.CheckResultsCount = resultOper.GetResultsCount(); this.ucResultsTree.LoadResultsTree(); } else { TabCtrl.SelectedTabPage = this.TabPageRules; this.TabCtrl.ShowTabHeader = DefaultBoolean.False; this.ucResultsTree.CurrentTreeList.Nodes.Clear(); } //加载top错误图层到map if (task.TopoWorkspace != null) { //获取当前任务子库中的图层集名 m_pDatasetSon = TopoOperAPI.GetCurrentSonDataSet(task.TopoWorkspace as IFeatureWorkspace); // 获取子库中所有的要素类的名称 TopoOperAPI.GetFcTopoNameInSon(UcMap, task.TopoWorkspace as IFeatureWorkspace, m_pDatasetSon); } this.dockTree.Visibility = DockVisibility.Visible; this.dockTree.Text = "规则列表"; this.dockTree.Width = 260; this.dockLegend.Visibility = DockVisibility.Visible; } catch (Exception ex) { progressbar.Hide(); //GT_CONST.LogAPI.CheckLog.AppendErrLogs(ex.Message); XtraMessageBox.Show("打开结果库失败!", "提示"); } finally { progressbar.Hide(); //关闭打开结果库进度服务 } }
public UCResult(object hook,CheckTask currentTask) { InitializeComponent(); this.Hook = hook; this.m_CurrentTask = currentTask; this.m_ErrorHelper.ResultConnection = currentTask.ResultConnection; }
/// <summary> /// 任务改变时触发,一个系统只单独存在一个任务 /// </summary> /// <param name="NewTask"></param> public static void TaskChanged(Hy.Check.Task.Task NewTask) { //先将当前质检软件中的任务清空,然后再加载其他质检任务 //m_UCDataMap.SetTask(null); m_UCDataMap.SetTask(NewTask); }
/// <summary> /// 添加任务信息 /// </summary> /// <param name="task"></param> public void AddTask(Task task) { m_TaskList.Add(task); }
private void btnOpenFromFile_Click(object sender, EventArgs e) { FolderBrowserDialog folderDialog = new FolderBrowserDialog(); folderDialog.ShowNewFolderButton = false; folderDialog.Description = "��ѡ���ʼ�����"; if (folderDialog.ShowDialog() == DialogResult.OK) { try { string strFolderPath = folderDialog.SelectedPath; string strConfigFile = strFolderPath + "\\" + COMMONCONST.File_Name_SystemConfig; CheckTask task = TaskHelper.FromTaskConfig(strConfigFile); // ��task��pathΪ�ϼ�Ŀ¼������Ϊ��ǰ�ļ������� DirectoryInfo dirInfo = new DirectoryInfo(strFolderPath); task.Name = dirInfo.Name; task.Path = dirInfo.Parent.FullName; m_SelectedTask = task; if (m_SytemTask != null && m_SytemTask.Name == m_SelectedTask.Name && m_SytemTask.Path==m_SelectedTask.Path) { XtraMessageBox.Show("�����Ѵ�"); return; } this.DialogResult = DialogResult.OK; } catch { XtraMessageBox.Show("���ļ�������ʧ�ܣ�", "��ʾ"); } } }
/// <summary> /// 删除任务信息 /// </summary> /// <param name="task"></param> public void DeleteTask(Task task) { for(int i=0;i<m_TaskList.Count;i++) { if (this.m_TaskList[i].Name == task.Name) { m_TaskList.RemoveAt(i); return; } } }
/// <summary> /// Sets the task. /// </summary> /// <param name="task">The task.</param> public void SetTask(CheckTask task) { XGifProgress progressbar = new XGifProgress(); try { //���taskΪnull����Ϊ�ͷ���Դ if (task == null) { UCDispose(); return; } //�����Ϊ�գ������� m_CurrentTask = task; //������½������� progressbar.ShowHint("���ڴ�ǰ�ʼ�����....."); //��ʼ�������� this.ucRulesTree.CurrentSchemaId = task.SchemaID; this.ucRulesTree.CurrentTaskName = task.Name; //����ί�У��ڴ����˿ؼ����߳��ϵ��ü���tree��������ֹ���֡���ǰ�������������ط�ʹ�á��Ĵ���; LoadRules Load = new LoadRules(this.ucRulesTree.LoadRulesTree); this.BeginInvoke(Load); this.ucResult.CurrentTask = m_CurrentTask; if (File.Exists(task.GetMXDFile())) { //�����õ�mxdģ��ͼ�� UcMap.LoadMxFile(task.GetMXDFile()); TocControl.SetBuddyControl(UcMap.Object); TocControl.Update(); UcMap.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); m_MapLayersController = new MapLayersController(UcMap.Map); } else { progressbar.Hide(); MessageBoxApi.ShowErrorMessageBox(task.GetMXDFile() + "�����ڣ���������"); return; } //���ؽ�� if (task.ResultConnection != null) { //�����Ѿ������ɵ����� this.TabCtrl.ShowTabHeader = DefaultBoolean.True; this.TabCtrl.SelectedTabPage = this.TabPageCheckResults; this.ucResultsTree.CurrentSchemaId = task.SchemaID; this.ucResultsTree.CurrentTaskName = task.Name; Sundary.ResultDbOper resultOper = new Hy.Check.UI.UC.Sundary.ResultDbOper(task.ResultConnection); this.ucResultsTree.LayersResultsDt = resultOper.GetLayersResults(); this.ucResultsTree.ResultsDt = resultOper.GetAllResults(); this.ucResultsTree.CheckResultsCount = resultOper.GetResultsCount(); this.ucResultsTree.LoadResultsTree(); } else { TabCtrl.SelectedTabPage = this.TabPageRules; this.TabCtrl.ShowTabHeader = DefaultBoolean.False; this.ucResultsTree.CurrentTreeList.Nodes.Clear(); } //����top����ͼ�㵽map if (task.TopoWorkspace != null) { //��ȡ��ǰ�����ӿ��е�ͼ�㼯�� m_pDatasetSon = TopoOperAPI.GetCurrentSonDataSet(task.TopoWorkspace as IFeatureWorkspace); // ��ȡ�ӿ������е�Ҫ��������� TopoOperAPI.GetFcTopoNameInSon(UcMap, task.TopoWorkspace as IFeatureWorkspace, m_pDatasetSon); } this.dockTree.Visibility = DockVisibility.Visible; this.dockTree.Text = "�����б�"; this.dockTree.Width = 260; this.dockLegend.Visibility = DockVisibility.Visible; } catch (Exception ex) { progressbar.Hide(); //GT_CONST.LogAPI.CheckLog.AppendErrLogs(ex.Message); XtraMessageBox.Show("�����ʧ�ܣ�", "��ʾ"); } finally { progressbar.Hide(); //�رմ������ȷ��� } }
private void gridViewTasks_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { int[] handleSelected = gridViewTasks.GetSelectedRows(); if (handleSelected == null || handleSelected.Length == 0) { btnOpenTask.Enabled = false; btnDeleteTask.Enabled = false; } else { btnOpenTask.Enabled = true; btnDeleteTask.Enabled = true; } int taskIndex= gridViewTasks.GetDataSourceRowIndex(handleSelected[0]); m_SelectedTask = m_AllTasks[taskIndex]; }