protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // attempting to load the revision tables from the map
            if (m_currentMap != null)
            {
                FindTablesInsideCurrentMap();
            }

            // and/or use the provided list of tables of revision
            if (m_revisionTables != null)
            {
                for (int m_revionTabIndex = 0; m_revionTabIndex < m_revisionTables.Count; m_revionTabIndex++)
                {
                    IDataset tableDataset = m_revisionTables[m_revionTabIndex] as IDataset;

                    if (m_allRevisionTables.ContainsKey(tableDataset.Name) == false)
                    {
                        m_allRevisionTables.Add(tableDataset.Name, m_revisionTables[m_revionTabIndex]);
                    }
                }
            }

            // warn the user that no revision info is available
            if (m_allRevisionTables.Count == 0)
            {
                MessageBox.Show(resourceManager.GetString("OSMEditor_ConflictEditor_norevisionTables"), resourceManager.GetString("OSMEditor_ConflictEditor_norevisionTables_title"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            // prepare the map controls
            for (int layerIndex = 0; layerIndex < axMapControl1.LayerCount; layerIndex++)
            {
                axMapControl1.DeleteLayer(layerIndex);
            }

            for (int layerIndex = 0; layerIndex < axMapControl2.LayerCount; layerIndex++)
            {
                axMapControl2.DeleteLayer(layerIndex);
            }

            if (m_currentMap != null)
            {
                IEnumLayer enumLayer = m_currentMap.get_Layers(null, false);

                ILayer basemapLayer = enumLayer.Next();

                while (basemapLayer != null)
                {
                    if (basemapLayer.Valid == true)
                    {
                        if (basemapLayer is IBasemapLayer)
                        {
                            axMapControl1.Map.AddLayer(basemapLayer);
                            axMapControl2.Map.AddLayer(basemapLayer);
                        }
                    }

                    basemapLayer = enumLayer.Next();
                }
            }

            axMapControl1.OnExtentUpdated += new IMapControlEvents2_Ax_OnExtentUpdatedEventHandler(mapControlOnExtentUpdated);
            axMapControl2.OnExtentUpdated += new IMapControlEvents2_Ax_OnExtentUpdatedEventHandler(mapControlOnExtentUpdated);

            m_osmPointsFC = CreatePointFeatureClass("osm_points", null, null);
            m_osmLinesFC = CreateLineFeatureClass("osm_lines", null, null);
            m_osmPolygonFC = CreatePolygonFeatureClass("osm_polygons", null, null);

            errorTreeView.Nodes.Add(resourceManager.GetString("OSMEditor_ConflictEditor_prepareCollectData"));
            errorTreeView.Refresh();

            // prepare the tree view
            errorTreeView.BeginUpdate();

            errorTreeView.Nodes.Clear();
            int firstLevelNodeIndex = 0;

            foreach (ITable revisionTable in m_allRevisionTables.Values)
            {
                errorTreeView.Nodes.Add(new TreeNode(((IDataset)revisionTable).Name));

                // Find the elements with a conflict
                int osmIDFieldIndex = revisionTable.Fields.FindField("osmoldid");
                int sourceFCNameFieldIndex = revisionTable.Fields.FindField("sourcefcname");
                int errorMessageFieldIndex = revisionTable.Fields.FindField("osmerrormessage");
                int elementTypeFieldIndex = revisionTable.Fields.FindField("osmelementtype");
                int errorStatusCodeFieldIndex = revisionTable.Fields.FindField("osmstatuscode");

                IQueryFilter searchFilter = new QueryFilterClass();
                searchFilter.WhereClause = SqlFormatterExt.SqlIdentifier(revisionTable, "osmstatuscode") + " <> 200";

                using (ESRI.ArcGIS.OSM.OSMClassExtension.ComReleaser comReleaser = new ESRI.ArcGIS.OSM.OSMClassExtension.ComReleaser())
                {
                    IFeatureWorkspace featureWorkspace = ((IDataset)revisionTable).Workspace as IFeatureWorkspace;
                    comReleaser.ManageLifetime(featureWorkspace);

                    ICursor searchCursor = revisionTable.Search(searchFilter, false);
                    comReleaser.ManageLifetime(searchCursor);

                    IRow errorRow = searchCursor.NextRow();
                    comReleaser.ManageLifetime(errorRow);

                    while (errorRow != null)
                    {
                        string osmElementType = errorRow.get_Value(elementTypeFieldIndex).ToString();
                        string osmIDString = errorRow.get_Value(osmIDFieldIndex).ToString();

                        RequestOSMServerData(osmElementType, osmIDString, m_osmPointsFC, m_osmLinesFC, m_osmPolygonFC);

                        string osmTypeSuffix = RetrieveOSMTypeAddendum(errorRow, sourceFCNameFieldIndex);

                        string errorMessage = errorRow.get_Value(errorMessageFieldIndex) as string;

                        TreeNode errorNode = new TreeNode("(" + osmIDString + ", " + osmTypeSuffix + ")");

                        if (String.IsNullOrEmpty(errorMessage) == false)
                        {
                            errorNode.ToolTipText = errorMessage;
                        }

                        int errorStatusCode = -1;
                        if (errorStatusCodeFieldIndex != -1)
                        {
                            errorStatusCode = (int) errorRow.get_Value(errorStatusCodeFieldIndex);
                        }

                        conflictTag errorNodeConflictTag = new conflictTag(errorRow.OID, osmIDString, errorStatusCode, errorRow.get_Value(sourceFCNameFieldIndex).ToString());

                        errorNode.Tag = errorNodeConflictTag;
                        errorNode.ContextMenuStrip = CreateErrorContextMenu(errorStatusCode, "");

                        errorTreeView.Nodes[firstLevelNodeIndex].Nodes.Add(errorNode);

                        errorTreeView.Nodes[firstLevelNodeIndex].ExpandAll();

                        errorRow = searchCursor.NextRow();
                        comReleaser.ManageLifetime(errorRow);
                    }
                }

                firstLevelNodeIndex = firstLevelNodeIndex + 1;
            }

            errorTreeView.EndUpdate();

            // clean the remaining UI components
            UpdateDataGridViewColumn(1, Color.White);
            UpdateDataGridViewColumn(2, Color.White);
            dataGridView2.Rows.Clear();
            dataGridView2.Invalidate();

            DeleteAllGraphicElements();
        }
 private void UpdateConflictUIBasedOnSelectedResolution(conflictTag.osmConflictResolution selectedConflictResolution)
 {
     switch (selectedConflictResolution)
     {
         case conflictTag.osmConflictResolution.osmNoResolution:
             UpdateDataGridViewColumn(1, Color.White);
             UpdateDataGridViewColumn(2, Color.White);
             DeleteAllMarkerElements();
             break;
         case conflictTag.osmConflictResolution.osmUpdateLocalVersionNumber:
             UpdateDataGridViewColumn(2, Color.FromArgb(255, 192, 192));
             UpdateDataGridViewColumn(1, Color.FromArgb(192, 255, 192));
             DeleteAllMarkerElements();
             UpdateMapControlWithMarker((IMapControl4)axMapControl1.Object, "AcceptMarker");
             UpdateMapControlWithMarker((IMapControl4)axMapControl2.Object, "DeleteMarker");
             break;
         case conflictTag.osmConflictResolution.osmUpdateLocalGeometryServerAttributes:
             UpdateDataGridViewColumn(1, Color.FromArgb(255, 192, 192));
             UpdateDataGridViewColumn(2, Color.FromArgb(192, 255, 192));
             DeleteAllMarkerElements();
             UpdateMapControlWithMarker((IMapControl4)axMapControl1.Object, "AcceptMarker");
             UpdateMapControlWithMarker((IMapControl4)axMapControl2.Object, "DeleteMarker");
             break;
         case conflictTag.osmConflictResolution.osmUpdateServerGeometryLocalAttributes:
             UpdateDataGridViewColumn(2, Color.FromArgb(255, 192, 192));
             UpdateDataGridViewColumn(1, Color.FromArgb(192, 255, 192));
             DeleteAllMarkerElements();
             UpdateMapControlWithMarker((IMapControl4)axMapControl2.Object, "AcceptMarker");
             UpdateMapControlWithMarker((IMapControl4)axMapControl1.Object, "DeleteMarker");
             break;
         case conflictTag.osmConflictResolution.osmUpdateServerGeometryServerAttributes:
             UpdateDataGridViewColumn(1, Color.FromArgb(255, 192, 192));
             UpdateDataGridViewColumn(2, Color.FromArgb(192, 255, 192));
             DeleteAllMarkerElements();
             UpdateMapControlWithMarker((IMapControl4)axMapControl2.Object, "AcceptMarker");
             UpdateMapControlWithMarker((IMapControl4)axMapControl1.Object, "DeleteMarker");
             break;
         case conflictTag.osmConflictResolution.osmDeleteLocalFeature:
             UpdateDataGridViewColumn(2, Color.White);
             UpdateDataGridViewColumn(1, Color.FromArgb(255, 192, 192));
             DeleteAllMarkerElements();
             UpdateMapControlWithMarker((IMapControl4)axMapControl1.Object, "DeleteMarker");
             break;
         case conflictTag.osmConflictResolution.osmChangeUpdateToCreate:
             UpdateDataGridViewColumn(1, Color.White);
             UpdateDataGridViewColumn(2, Color.White);
             DeleteAllMarkerElements();
             break;
         case conflictTag.osmConflictResolution.osmClearRevisionStatus:
             UpdateDataGridViewColumn(1, Color.White);
             UpdateDataGridViewColumn(2, Color.White);
             DeleteAllMarkerElements();
             break;
         case conflictTag.osmConflictResolution.osmRemoveRevisionIncident:
             UpdateDataGridViewColumn(1, Color.White);
             UpdateDataGridViewColumn(2, Color.White);
             DeleteAllMarkerElements();
             break;
         default:
             break;
     }
 }