private void closeForm() { if (BoundariesPanel != null) { BoundariesPanel = null; } if (CensusPanel != null) { CensusPanel = null; } if (EmergencyPanel != null) { EmergencyPanel = null; } if (EnvironmentPanel != null) { EnvironmentPanel = null; } if (InfrastructPanel != null) { InfrastructPanel = null; } if (PhotoPanel != null) { PhotoPanel = null; } if (ServiceDistrictsPanel != null) { ServiceDistrictsPanel = null; } if (SoilsTopoPanel != null) { SoilsTopoPanel = null; } if (StructuresPanel != null) { StructuresPanel.Dispose(); } if (TaxlotsPanel != null) { TaxlotsPanel = null; } if (TransportationPanel != null) { TransportationPanel = null; } if (WaterPanel != null) { WaterPanel = null; } if (ZoningPanel != null) { ZoningPanel = null; } if (UtilityPanel != null) { UtilityPanel = null; } if (EditorPanel != null) { EditorPanel = null; } if (MapServicePanel != null) { MapServicePanel = null; } string sTag = m_CurrentControl.Tag.ToString(); try { CMedToolsSubs.writeRegKey(Microsoft.Win32.Registry.LocalMachine, "SOFTWARE\\City of Medford", "AddLayersTab", sTag); } catch (Exception ex) { // just move on ... don't throw an error } //CAddLayers oAddLayers = new CAddLayers(); //oAddLayers.closeForm(); this.Close(); this.Dispose(); //reloadForm(); }
private Control returnNewControl(string pCurrentButtonTag) { Control pRetVal; switch (pCurrentButtonTag.ToUpper()) { case "MEDFORDTOOLSEXTENSION.ADDLAYER.UCBOUNDARIES": if (BoundariesPanel == null) { BoundariesPanel = new ucBoundary(); } BoundariesPanel.Tag = pCurrentButtonTag; BoundariesPanel.Dock = DockStyle.Fill; pRetVal = (Control)BoundariesPanel; break; case "MEDFORDTOOLSEXTENSION.ADDLAYER.UCCENSUS": if (CensusPanel == null) { CensusPanel = new ucCensus(); } CensusPanel.Tag = pCurrentButtonTag; CensusPanel.Dock = DockStyle.Fill; pRetVal = (Control)CensusPanel; break; case "MEDFORDTOOLSEXTENSION.ADDLAYER.UCEMERGENCY": if (EmergencyPanel == null) { EmergencyPanel = new ucEmergency(); } EmergencyPanel.Tag = pCurrentButtonTag; EmergencyPanel.Dock = DockStyle.Fill; pRetVal = (Control)EmergencyPanel; break; case "MEDFORDTOOLSEXTENSION.ADDLAYER.UCENVIRONMENT": if (EnvironmentPanel == null) { EnvironmentPanel = new ucEnvironment(); } EnvironmentPanel.Tag = pCurrentButtonTag; EnvironmentPanel.Dock = DockStyle.Fill; pRetVal = (Control)EnvironmentPanel; break; case "MEDFORDTOOLSEXTENSION.ADDLAYER.UCINFRASTRUCTURE": if (InfrastructPanel == null) { InfrastructPanel = new ucInfrastructure(); } InfrastructPanel.Tag = pCurrentButtonTag; InfrastructPanel.Dock = DockStyle.Fill; pRetVal = (Control)InfrastructPanel; break; case "MEDFORDTOOLSEXTENSION.ADDLAYER.UCPHOTO": if (PhotoPanel == null) { PhotoPanel = new ucPhoto(); } PhotoPanel.Tag = pCurrentButtonTag; PhotoPanel.Dock = DockStyle.Fill; pRetVal = (Control)PhotoPanel; break; case "MEDFORDTOOLSEXTENSION.ADDLAYER.UCSERVICEDISTRICTS": if (ServiceDistrictsPanel == null) { ServiceDistrictsPanel = new ucServiceDistricts(); } ServiceDistrictsPanel.Tag = pCurrentButtonTag; ServiceDistrictsPanel.Dock = DockStyle.Fill; pRetVal = (Control)ServiceDistrictsPanel; break; case "MEDFORDTOOLSEXTENSION.ADDLAYER.UCSOILSTOPO": if (SoilsTopoPanel == null) { SoilsTopoPanel = new ucSoilsTopo(); } SoilsTopoPanel.Tag = pCurrentButtonTag; SoilsTopoPanel.Dock = DockStyle.Fill; pRetVal = (Control)SoilsTopoPanel; break; case "MEDFORDTOOLSEXTENSION.ADDLAYER.UCSTRUCTURES": if (StructuresPanel == null) { StructuresPanel = new ucStructures(); } StructuresPanel.Tag = pCurrentButtonTag; StructuresPanel.Dock = DockStyle.Fill; pRetVal = (Control)StructuresPanel; break; case "MEDFORDTOOLSEXTENSION.ADDLAYER.UCTAXLOTS": if (TaxlotsPanel == null) { TaxlotsPanel = new ucTaxlots(); } TaxlotsPanel.Tag = pCurrentButtonTag; TaxlotsPanel.Dock = DockStyle.Fill; pRetVal = (Control)TaxlotsPanel; break; case "MEDFORDTOOLSEXTENSION.ADDLAYER.UCTRANSPORTATION": if (TransportationPanel == null) { TransportationPanel = new ucTransportation(); } TransportationPanel.Tag = pCurrentButtonTag; TransportationPanel.Dock = DockStyle.Fill; pRetVal = (Control)TransportationPanel; break; case "MEDFORDTOOLSEXTENSION.ADDLAYER.UCWATER": if (WaterPanel == null) { WaterPanel = new ucWater(); } WaterPanel.Tag = pCurrentButtonTag; WaterPanel.Dock = DockStyle.Fill; pRetVal = (Control)WaterPanel; break; case "MEDFORDTOOLSEXTENSION.ADDLAYER.UCZONING": if (ZoningPanel == null) { ZoningPanel = new ucZoning(); } ZoningPanel.Tag = pCurrentButtonTag; ZoningPanel.Dock = DockStyle.Fill; pRetVal = (Control)ZoningPanel; break; case "MEDFORDTOOLSEXTENSION.ADDLAYER.UCUTILITY": if (UtilityPanel == null) { UtilityPanel = new ucUtility(); } UtilityPanel.Tag = pCurrentButtonTag; UtilityPanel.Dock = DockStyle.Fill; pRetVal = (Control)UtilityPanel; break; case "MEDFORDTOOLSEXTENSION.ADDLAYER.UCEDITOR": if (EditorPanel == null) { EditorPanel = new ucEditor(); } EditorPanel.Tag = pCurrentButtonTag; EditorPanel.Dock = DockStyle.Fill; pRetVal = (Control)EditorPanel; break; case "MEDFORDTOOLSEXTENSION.ADDLAYER.UCMAPSERVICES": if (MapServicePanel == null) { MapServicePanel = new ucMapService(); } MapServicePanel.Tag = pCurrentButtonTag; MapServicePanel.Dock = DockStyle.Fill; pRetVal = (Control)MapServicePanel; break; default: ////ucBoundaries defaultPanel = new ucBoundaries(); //ucBoundary defaultPanel = new ucBoundary(); //defaultPanel.Tag = pCurrentButtonTag; //defaultPanel.Dock = DockStyle.Fill; if (BoundariesPanel == null) { BoundariesPanel = new ucBoundary(); } BoundariesPanel.Tag = pCurrentButtonTag; BoundariesPanel.Dock = DockStyle.Fill; pRetVal = (Control)BoundariesPanel; break; } return(pRetVal); }