Exemplo n.º 1
0
        private void FormSolveConflicts_Load(object sender, EventArgs e)
        {
            if (_doc == null || _doc.FocusMap == null)
            {
                this.Close();
                return;
            }

            tvConflicts.Nodes.Add(_rootNode);

            foreach (IDatasetElement element in _doc.FocusMap.MapElements)
            {
                if (element == null || !(element.Class is IFeatureClass))
                {
                    continue;
                }

                List <Guid> guids = Replication.FeatureClassConflictsParentGuids(element.Class as IFeatureClass);
                if (guids == null || guids.Count == 0)
                {
                    continue;
                }

                string title = element.Title;
                if (_doc.FocusMap.TOC != null && element is ILayer)
                {
                    ITOCElement tocElement = _doc.FocusMap.TOC.GetTOCElement((ILayer)element);
                    if (tocElement != null)
                    {
                        title = tocElement.Name;
                    }
                }
                FeatureClassNode fcNode = new FeatureClassNode(element.Class as IFeatureClass, title);
                _rootNode.Nodes.Add(fcNode);

                foreach (Guid guid in guids)
                {
                    fcNode.Nodes.Add(new GuidTreeNode(guid));
                }
                fcNode.Expand();
            }

            _rootNode.ExpandAll();

            if (_rootNode.Nodes.Count == 0)
            {
                MessageBox.Show("No conflicts in current map detected.");
                this.Close();
            }
        }