private void LoadTreeView() { // Mantém a consistência dos nós no MapTTreeView loadingTreeView = true; foreach (TreeNode ly in MaptTreeView.Nodes) { ly.Checked = MaintainConsistency.StatusChecked(ly.Name, listLayerView); foreach (TreeNode pj in ly.Nodes) { pj.Checked = MaintainConsistency.StatusChecked(pj.Name, listLayerView); foreach (TreeNode qy in pj.Nodes) { qy.Checked = MaintainConsistency.StatusChecked(qy.Name, listLayerView); // Torna a layer invisível/visível if (qy.Checked) { MapTAxMap.set_LayerVisible(MaintainConsistency.LoadIdLayer(qy.Name, listLayerView), true); } else { MapTAxMap.set_LayerVisible(MaintainConsistency.LoadIdLayer(qy.Name, listLayerView), false); } } } } loadingTreeView = false; }
private void MaptTreeView_AfterCheck(object sender, TreeViewEventArgs e) { if ((e.Node.Name != "") && (!loadingTreeView)) { string idTypeObject = ""; foreach (LayerView layerview in listLayerView.LayerViews) { if (layerview.IdTree == e.Node.Name) { idTypeObject = layerview.IdTypeObject; } foreach (ProjectView projectView in layerview.ProjectViews) { if (projectView.IdTree == e.Node.Name) { idTypeObject = projectView.IdTypeObject; } foreach (QueryView queryView in projectView.QueryViews) { if (queryView.IdTree == e.Node.Name) { idTypeObject = queryView.IdTypeObject; } } } } MaintainConsistency.ConsistencyCheckedTree(idTypeObject, e.Node.Name, e.Node.Checked, listLayerView); } }