/// <summary> /// Prepare the editor for editing. /// </summary> public static void StartEditing() { // Select a layer to edit first int rasterLayerCount = ArcMapApp.RasterLayerCount; if (rasterLayerCount == 1) { Editor.activeLayer = ArcMapApp.GetRasterLayer(); } else { SelectLayerForm selectLayerForm = new SelectLayerForm(); selectLayerForm.ShowDialog(); if (selectLayerForm.ReturnLayer == null) { return; } Editor.activeLayer = selectLayerForm.ReturnLayer; } Editor.IsEditing = true; Editor.Edits.Clear(); // Enable the save button SaveEditsButton saveButton = AddIn.FromID <SaveEditsButton>(ThisAddIn.IDs.SaveEditsButton); saveButton.IsEnabled = true; // Enable the save as button SaveEditsAsButton saveAsButton = AddIn.FromID <SaveEditsAsButton>(ThisAddIn.IDs.SaveEditsAsButton); saveAsButton.IsEnabled = true; // Enable the stop button StopEditingButton stopButton = AddIn.FromID <StopEditingButton>(ThisAddIn.IDs.StopEditingButton); stopButton.IsEnabled = true; // Enable the edit tool. EditTool selectTool = AddIn.FromID <EditTool>(ThisAddIn.IDs.EditTool); selectTool.IsEnabled = true; // Disable the start button StartEditingButton startEditingButton = AddIn.FromID <StartEditingButton>(ThisAddIn.IDs.StartEditingButton); startEditingButton.IsEnabled = false; // Enable the ShowEditsButton ShowEditsButton showEditsButton = AddIn.FromID <ShowEditsButton>(ThisAddIn.IDs.ShowEditsButton); showEditsButton.IsEnabled = true; }
private void btnAdd_Click(object sender, EventArgs e) { using (SelectLayerForm frm = new SelectLayerForm()) { if (frm.ShowDialog(this) == DialogResult.OK) { INetworkLayerFactory layer = frm.Factory; layer.Binding = Binding; _layers.Add(layer); UpdateLayers(); listViewLayers.SelectedIndices.Add(_layers.Count - 1); OnLayersUpdated(); } } }