/// <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(); //关闭打开结果库进度服务 } }
/// <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(); //�رմ������ȷ��� } }