private void OnMenuClick(object sender, EventArgs e) { switch (((ToolStripMenuItem)sender).Name) { case "menuAddLayer": _parent.AddLayer(); break; case "menuLayerProperties": ShowLayerProperties(); break; case "menuLayerAttributes": var sfa = ShapefileAttributesForm.GetInstance(_parent, _parent.MapInterActionHandler); if (!sfa.Visible) { sfa.Show(this); } else { sfa.BringToFront(); } break; case "menuRemoveLayer": MapLayers.RemoveLayer((int)layerGrid[0, _rowIndexFromMouseDown].Tag); break; } }
private void ShapefileAttributesForm_FormClosed(object sender, FormClosedEventArgs e) { MapInterActionHandler.MapLayersHandler.CurrentLayer -= OnCurrentLayer; MapInterActionHandler.Selection -= OnLayerSelection; _instance = null; Cleanup(); }
public static ShapefileAttributesForm GetInstance(MainWindowForm parentForm, MapInterActionHandler mapInterActionHandler) { if (_instance == null) { _instance = new ShapefileAttributesForm(parentForm, mapInterActionHandler); } return(_instance); }