public void Activate(IGTCustomCommandHelper CustomCommandHelper) { try { m_oGTApp = GTClassFactory.Create <IGTApplication>(); m_oGTCustomCommandHelper = CustomCommandHelper; if (Validate()) { if (m_oGTExplorerService == null) { m_oGTExplorerService = GTClassFactory.Create <IGTFeatureExplorerService>(m_oGTCustomCommandHelper); } m_oGTExplorerService.Slide(true); if (m_oGTPlacementService == null) { m_oGTPlacementService = GTClassFactory.Create <IGTFeaturePlacementService>(m_oGTCustomCommandHelper); } if (!m_oGTTransactionManager.TransactionInProgress) { m_oGTTransactionManager.Begin("Tree Trimming Request Estimate"); } m_oStatusBarMessage = "Draw a polygon encompassing all affected Work Points"; SubscribeEvents(); m_oGTTreeTrimmingfeature = m_oGTApp.DataContext.NewFeature(190); m_oGTPlacementService.StartFeature(m_oGTTreeTrimmingfeature); } else { ExitCommand(); } } catch (Exception ex) { m_oGTExplorerService_CancelClick(null, EventArgs.Empty); if (m_oGTTransactionManager.TransactionInProgress) { m_oGTTransactionManager.Rollback(); } MessageBox.Show("Error in TreeTrim Request Estimate command: " + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error); ExitCommand(); } }
/// <summary> /// Activates the install service process. Creates the new service line and sets up the listeners. /// </summary> /// <param name="CustomCommandHelper"></param> public void Activate(IGTCustomCommandHelper CustomCommandHelper) { try { if (gtTransactionManager != null) { serviceLine = null; dataContext = m_gtApp.DataContext; customCommandHelper = CustomCommandHelper; featurePlacementService = GTClassFactory.Create <IGTFeaturePlacementService>(customCommandHelper); featureExplorerService = GTClassFactory.Create <IGTFeatureExplorerService>(); featureExplorerVisible = featureExplorerService.Visible; SubscribeEvents(); placeServiceLine(); } }catch (Exception e) { } }
/// <summary> /// Ends the process. /// </summary> public void Terminate() { dataContext = null; gtTransactionManager = null; UnsubscribeEvents(); customCommandHelper = null; if (featurePlacementService != null) { featurePlacementService.Dispose(); featurePlacementService = null; } if (featureExplorerService != null) { featureExplorerService.Clear(); featureExplorerService.Dispose(); featureExplorerService = null; } m_gtApp.EndWaitCursor(); }
/// <summary> /// Method to Exit the command. /// </summary> private void ExitCommand() { try { m_oGTApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, ""); if (m_oEventsSubscribed) { UnsubscribeEvents(); } if (m_oGTCustomCommandHelper != null) { m_oGTCustomCommandHelper.Complete(); m_oGTCustomCommandHelper = null; } } catch { throw; } finally { if (m_oGTCustomCommandHelper != null) { m_oGTCustomCommandHelper = null; } if (m_oGTTransactionManager != null) { m_oGTTransactionManager = null; } if (m_oGTExplorerService != null) { m_oGTExplorerService.Dispose(); m_oGTExplorerService = null; } if (m_oGTPlacementService != null) { m_oGTPlacementService.Dispose(); m_oGTPlacementService = null; } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnStructure_Click(object sender, EventArgs e) { if (streetLightAcct.MiscStructFid == default(int)) { if (string.IsNullOrEmpty(streetLightAcct.BOUNDARY_CLASS)) { _gtPlacementSrvc = GTClassFactory.Create <IGTFeaturePlacementService>(_gtCustomCommandHelper); _gtPlacementSrvc.Finished += gtPlacementSrvc_Finished; PlaceMiscStructure(false); } else { PlaceMiscStructure(true); btnStructure.Text = "Locate Structue"; } } else { //Locate Miscellaneous Struture CommonUtil.FitSelectedFeature(CommonUtil.MiscStructG3eFno, streetLightAcct.MiscStructFid); } }
/// <summary> /// /// </summary> private void CleanUp() { SubscribEvents(false); if (_gtFeatureExplorerSrvc != null) { _gtFeatureExplorerSrvc.Clear(); _gtFeatureExplorerSrvc.Dispose(); _gtFeatureExplorerSrvc = null; } if (_gtPlacementSrvc != null) { _gtPlacementSrvc.Dispose(); _gtPlacementSrvc = null; } streetLights = null; if (stltNonLocatedCtx != null) { stltNonLocatedCtx.Dispose(); } stltNonLocatedCtx = null; streetLightAcct = null; _gtKeyObj = null; _gtKeyEditObj = null; }