/// <summary> /// The main entry point for the application. /// </summary> public void Activate(IGTCustomCommandHelper CustomCommandHelper) { m_oGTCustomCommandHelper = CustomCommandHelper; try { if (ManualLandbaseReviewCtl == null) { m_application = (IGTApplication)GTClassFactory.Create <IGTApplication>(); ManualLandbaseReviewCtl = this; Application.EnableVisualStyles(); ManualLandbaseReviewFrm = new ManualLandbaseReviewFrm(m_oGTCustomCommandHelper, m_oGTTransactionManager); ManualLandbaseReviewFrm.Show(m_application.ApplicationWindow); } else { MessageBox.Show("Command already running"); } } catch (Exception ex) { ManualLandbaseReviewCtl = null; if (ManualLandbaseReviewFrm != null) { ManualLandbaseReviewFrm.CloseForm(); ManualLandbaseReviewFrm.Close(); } if (m_oGTCustomCommandHelper != null) { m_oGTCustomCommandHelper.Complete(); } } }
public void Terminate() { transactionManager.Commit(); transactionManager = null; dataContext = null; customCommandHelper = null; }
/// <summary> /// The entry point for the custom command. /// </summary> /// <param name="CustomCommandHelper">Provides notification to the system that the command has finished</param> public void Activate(IGTCustomCommandHelper CustomCommandHelper) { // Get the active job. This will be used later to reset the job if it is changed by the plug-in module. m_StartingJob = m_Application.DataContext.ActiveJob; // Parse the comma-delimited argument string passed in by the monitor. if (!GetCommandArguments()) { CustomCommandHelper.Complete(); } // Reset queue table REQUEST_STATUS = 'NEW' if any records for the instance ID are set to = 'PROCESSING'. if (!ResetRequestStatus()) { CustomCommandHelper.Complete(); } // Set an application property named “UnattendedMode” as an indicator to other custom code that processing should not display messages and wait for user input. // Note that the value of this property is not important; the presence of the named property indicates unattended mode, and its absence indicates interactive mode. try { m_Application.Properties.Add("UnattendedMode", true); } catch { // ignore error if property is already set } // Process any pending requests if (!Process()) { CustomCommandHelper.Complete(); } }
/// <summary> /// Intialize variables and check selected feature is valid. /// </summary> /// <param name="CustomCommandHelper"></param> public void Activate(Intergraph.GTechnology.API.IGTCustomCommandHelper CustomCommandHelper) { IGTDDCKeyObjects ddcKeyObjects = GTClassFactory.Create <IGTDDCKeyObjects>(); gtApp = GTClassFactory.Create <IGTApplication>(); try { gtCustomCommandHelper = CustomCommandHelper; gtApp.SelectedObjectsChanged += GtApp_SelectedObjectsChanged; gtCustomCommandHelper.MouseMove += new EventHandler <GTMouseEventArgs>(gtCustomCommandHelper_MouseMove); if (gtApp.DataContext.IsRoleGranted("PRIV_MGMT_LAND")) { if (gtApp.SelectedObjects.FeatureCount == 1) { g3eFno_trg = gtApp.SelectedObjects.GetObjects()[0].FNO; g3eFid_trg = gtApp.SelectedObjects.GetObjects()[0].FID; if (!ValidateSelectedFeature(g3eFno_trg)) { MessageBox.Show(ValidationMsg, msgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); CleanUp(); } } } else { MessageBox.Show("Command Access Denied. Please contact System Administrator", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); CleanUp(); } } catch (Exception ex) { MessageBox.Show("Error " + ex.Message, msgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); CleanUp(); } }
/// <summary> /// Intialize variables and check selected feature is valid. /// </summary> /// <param name="CustomCommandHelper"></param> public void Activate(Intergraph.GTechnology.API.IGTCustomCommandHelper CustomCommandHelper) { gtApp = GTClassFactory.Create <IGTApplication>(); List <KeyValuePair <int, string> > featureTypes = null; try { gtCustomCommandHelper = CustomCommandHelper; gtCustomCommandHelper.MouseMove += gtCustomCommandHelper_MouseMove; featureTypes = GetFeatureClass(); detectOverlappingAnalysis = new DetectOverlappingAnalysis(featureTypes); if (detectOverlappingAnalysis.ShowDialog() == DialogResult.OK) { // RunProcess(detectOverlappingAnalysis.SelectedFeatureType, detectOverlappingAnalysis.IsSelfOverlap); DetectOverlapping(detectOverlappingAnalysis.SelectedFeatureType, detectOverlappingAnalysis.IsSelfOverlap); } } catch (Exception ex) { MessageBox.Show("Error " + ex.Message, msgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { CleanUp(); } }
public void Activate(IGTCustomCommandHelper CustomCommandHelper) { try { this.oCustomCmdHelper = CustomCommandHelper; oDiag = new GTDiagnostics(GTDiagSS.IDotNetCustomCmd, GTDiagMaskWord.IDotNetCustomCmd, "StreetLightHistory.cs"); InitializeAppResources(); SetupLocationCriteria(); DoActiveMapWindowByStreetlight(); DoActiveMapWindowByStructure(); DoAssetHistory(); DoEvaluation(); DoTempGeometries(); DoExit(); } catch (Exception ex) { CommandUtilities.LogException(oDiag, "Activate", ex); DoExit(); } }
/// <summary> /// Method to Exit the command. /// </summary> private void ExitCommand() { try { try { if (m_oGTApp.Application.Properties.Count > 0) { m_oGTApp.Application.Properties.Remove("StreetLightImportToolMSFID"); } } catch { } if (m_oGTCustomCommandHelper != null) { m_oGTCustomCommandHelper.Complete(); m_oGTCustomCommandHelper = null; } } catch { throw; } finally { m_oGTCustomCommandHelper = null; m_oGTTransactionManager = null; } }
/// <summary> /// The entry point for the custom command. /// </summary> /// <param name="CustomCommandHelper">Provides notification to the system that the command has finished</param> public void Activate(IGTCustomCommandHelper CustomCommandHelper) { try { m_CustomCommandHelper = CustomCommandHelper; // Get the job information. Used for validating command enabling. if (!CommonDT.GetJobInformation()) { m_CustomCommandHelper.Complete(); return; } IGTDDCKeyObjects oGTDCKeys = GTClassFactory.Create <IGTDDCKeyObjects>(); // Check if selected feature is a Transformer. oGTDCKeys = m_Application.SelectedObjects.GetObjects(); if (!(oGTDCKeys[0].FNO == ConstantsDT.FNO_OH_XFMR || oGTDCKeys[0].FNO == ConstantsDT.FNO_UG_XFMR)) { MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_SC_INVALID_FEATURE_SELECTED, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); m_CustomCommandHelper.Complete(); return; } frmStreetLightVoltageDrop.m_CustomCommandHelper = CustomCommandHelper; frmStreetLightVoltageDrop.m_TransactionManager = m_TransactionManager; frmStreetLightVoltageDrop.StartPosition = FormStartPosition.CenterScreen; frmStreetLightVoltageDrop.Show(m_Application.ApplicationWindow); } catch (Exception ex) { MessageBox.Show(m_Application.ApplicationWindow, ex.Message, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); CustomCommandHelper.Complete(); } }
public CheckValidation(IGTDataContext gTDC, IGTDDCKeyObjects gTDDCKey, IGTApplication gTApp, IGTCustomCommandHelper gTCCHeler) { gTDataContext = gTDC; gTDDCKeyObjects = gTDDCKey; gTApplication = gTApp; gTCustomCommandHelper = gTCCHeler; }
public void CompleteCC() { if (m_gTCustomCommandHelper != null) { m_gTCustomCommandHelper.Complete(); m_gTCustomCommandHelper = null; } }
public SupplementalAgreementPlotModel(IGTDataContext gTDC, IGTDDCKeyObjects gTDDCKey, IGTApplication gTApp, IGTCustomCommandHelper gTCCHeler) { gTDataContext = gTDC; gTDDCKeyObjects = gTDDCKey; gTApplication = gTApp; gTCustomCommandHelper = gTCCHeler; }
public void Activate(IGTCustomCommandHelper CustomCommandHelper) { try { m_oGTApp = GTClassFactory.Create <IGTApplication>(); m_oGTCustomCommandHelper = CustomCommandHelper; if (m_oGTApp.DataContext.IsRoleGranted("PRIV_MGMT_STLT")) { if (Validate()) { string streetlightImportSheet = OpenFileDialog(); if (!String.IsNullOrEmpty(streetlightImportSheet)) { m_oGTApp.BeginWaitCursor(); StreetLightImportWorkSheet importWorkSheet = new StreetLightImportWorkSheet(); importWorkSheet.InitializeExcel(streetlightImportSheet); if (importWorkSheet.ExcelTable != null) { ImportSpreadsheetFormatValidation formatValidation = new ImportSpreadsheetFormatValidation(m_oGTApp.DataContext); m_oGTApp.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Street Light Import Tool : Validating Spreadsheet Format"); if (formatValidation.ValidateSpreadsheetFormat(importWorkSheet.ExcelTable)) { ImportSpreadsheetRecordValidation recordValidation = new ImportSpreadsheetRecordValidation(m_oGTApp, m_oGTTransactionManager); DataTable excelDataTable = recordValidation.ValidateSpreadsheetRecord(importWorkSheet.ExcelTable); ValidateProcessing(streetlightImportSheet, importWorkSheet, excelDataTable, recordValidation); } } m_oGTApp.EndWaitCursor(); } } ExitCommand(); } else { MessageBox.Show("User does not have PRIV_MGMT_STLT role.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); ExitCommand(); } } catch (Exception ex) { m_oGTApp.EndWaitCursor(); if (m_oGTTransactionManager.TransactionInProgress) { m_oGTTransactionManager.Rollback(); } if (ex.GetType().Name == "DuplicateNameException") { MessageBox.Show("WorkSheet contains duplicate column names.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Error in StreetLight Import Tool command: " + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error); } ExitCommand(); } }
public void Activate(IGTCustomCommandHelper CustomCommandHelper) { try { customCommandHelper = CustomCommandHelper; if (transactionManager != null) { transactionManager.Begin("Blanket Unitization"); selectedFeatures = gtApp.SelectedObjects.GetObjects(); bool oneFeatureType = true; short fnoChecker; string errorMessage = ""; if (selectedFeatures.Count > 1) { fnoChecker = selectedFeatures[0].FNO; foreach (IGTDDCKeyObject feature in selectedFeatures) { if (fnoChecker != feature.FNO) { oneFeatureType = false; errorMessage = "Multiple feature types selected, please retry command after selecting features of the same type."; } } } if (oneFeatureType) { switch (selectedFeatures[0].FNO) { case g_Service_Line_FNO: case g_Secondary_Box_FNO: featureHandler(); break; case g_Gaurd_Light_FNO: guardLightHandler(); break; default: MessageBox.Show("Invalid feature selected, please select a service line, secondary box, or guard light."); break; } customCommandHelper.Complete(); } else { MessageBox.Show(errorMessage, "GTechnology"); customCommandHelper.Complete(); } } }catch (Exception e) { MessageBox.Show("Error in ccFieldActivity.Activate " + e.Message + "."); transactionManager.Rollback(); customCommandHelper.Complete(); } }
public SupplementalAgreementPresenter(ISupplementalAgreementView supplementalAgreementView, IGTCustomCommandHelper CustomCommandHelper , IGTTransactionManager gTTransactionManager) { m_view = supplementalAgreementView; m_model = new Model.SupplementalAgreementModel(m_view.GTDataContext, m_view.GTDDCKeyObjects); m_gTCustomCommandHelper = CustomCommandHelper; m_oGTTransactionManager = gTTransactionManager; }
public void Activate(IGTCustomCommandHelper CustomCommandHelper) { IGTDDCKeyObjects ddcKeyObjects = GTClassFactory.Create <IGTDDCKeyObjects>(); List <int> fidList = new List <int>(); try { m_oGTApp = GTClassFactory.Create <IGTApplication>(); m_oGTCustomCommandHelper = CustomCommandHelper; m_ooddcKeyObjects = GTClassFactory.Create <IGTDDCKeyObjects>(); ddcKeyObjects = m_oGTApp.Application.SelectedObjects.GetObjects(); foreach (IGTDDCKeyObject ddcKeyObject in ddcKeyObjects) { if (!fidList.Contains(ddcKeyObject.FID)) { fidList.Add(ddcKeyObject.FID); m_ooddcKeyObjects.Add(ddcKeyObject); } } m_oGTApp.Application.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Initializing RemoveFeature..."); m_oGTApp.Application.BeginWaitCursor(); SetJobAttributes(); if (Validate()) { RemoveFeature(); if (!m_ostatusExit) { SynchronizeWP(); } if (m_oCorrectionsModeIndex != -1) { m_oGTApp.Application.Properties.Remove("CorrectionsMode"); string mapCaption = m_oGTApp.Application.ActiveMapWindow.Caption.Replace("CORRECTIONS MODE - ", ""); m_oGTApp.Application.ActiveMapWindow.Caption = mapCaption; } } if (!m_ostatusExit) { ExitCommand(); } } catch (Exception ex) { m_oGTTransactionManager.Rollback(); MessageBox.Show("Error in Remove Feature command: " + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error); ExitCommand(); } }
/// <summary> /// Dispose all method before command exit /// </summary> private void CleanUp() { gtApp.SelectedObjectsChanged -= GtApp_SelectedObjectsChanged; gtCustomCommandHelper.MouseMove -= gtCustomCommandHelper_MouseMove; if (gtCustomCommandHelper != null) { gtCustomCommandHelper.Complete(); } gtCustomCommandHelper = null; }
public void Activate(IGTCustomCommandHelper CustomCommandHelper) { PremiseNumberDialog dialogWindow = new PremiseNumberDialog(); dataProvider.ccHelper = CustomCommandHelper; if (dataProvider.ErrorMessage == null) { dialogWindow.Show(dataProvider.gtApp.ApplicationWindow); } }
public ManageNonLocatedSTLT(IGTCustomCommandHelper customCommandHelper, IGTTransactionManager gtTransaction) : this() { this._gtCustomCommandHelper = customCommandHelper; this._gtTransactionManager = gtTransaction; if (isJobActive) { _gtFeatureExplorerSrvc = GTClassFactory.Create <IGTFeatureExplorerService>(_gtCustomCommandHelper); _gtFeatureExplorerSrvc.Locked = false; } //Subscrive eventds SubscribEvents(true); }
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(); } }
public void Activate(IGTCustomCommandHelper CustomCommandHelper) { try { #region Perform validations m_oGTCustomCommandHelper = CustomCommandHelper; m_oGTTransactionManager.Begin(" begin Repeat reconductoring..."); if (CheckIfNonWrJob()) { ExitCommand(); MessageBox.Show("This command applies only to WR jobs.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } IGTDDCKeyObjects selectedObjects = GTClassFactory.Create <IGTDDCKeyObjects>(); List <int> fidList = new List <int>(); m_ooddcKeyObjects = m_iGtApplication.SelectedObjects.GetObjects(); foreach (IGTDDCKeyObject ddcKeyObject in m_ooddcKeyObjects) { if (!fidList.Contains(ddcKeyObject.FID)) { fidList.Add(ddcKeyObject.FID); selectedObjects.Add(ddcKeyObject); } } m_originalObject = selectedObjects[0]; if (!CheckIfConductorFeature()) { ExitCommand(); MessageBox.Show("This command only applies to conductors.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (!ValidateFeatureState()) { ExitCommand(); MessageBox.Show("Select a PPX conductor span from which to copy reconductoring information.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } #endregion SubscribeEvents(); CheckFeatureAndGetCno(); ReadCUsWithActivity(); } catch (Exception ex) { ExitCommand(); MessageBox.Show("Error during execution of Repeat Reconductoring custom command." + Environment.NewLine + ex.Message, "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Terminate() { try { m_TransactionManager = null; m_CustomCommandHelper = null; m_frmSecondaryCalculator.m_CustomCommandHelper = null; m_frmSecondaryCalculator.m_TransactionManager = null; m_frmSecondaryCalculator = null; } catch (Exception ex) { MessageBox.Show(m_Application.ApplicationWindow, ex.Message, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public void Activate(IGTCustomCommandHelper CustomCommandHelper) { FieldActivityErrorResolutionDialog dialogWindow = new FieldActivityErrorResolutionDialog(); dataProvider.ccHelper = CustomCommandHelper; dataProvider.LoadData(); if (dataProvider.dtList == null) { MessageBox.Show("Field Activity Error Resolution command - No errors to display ", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Information); dataProvider.ccHelper.Complete(); dataProvider.dispose(); return; } dialogWindow.ShowDialog(); }
public void Terminate() { try { m_TransactionManager = null; m_CustomCommandHelper = null; frmStreetLightVoltageDrop.m_CustomCommandHelper = null; frmStreetLightVoltageDrop.m_TransactionManager = null; frmStreetLightVoltageDrop = null; } catch (Exception ex) { MessageBox.Show(m_Application.ApplicationWindow, ex.Message, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
/// <summary> /// Custom Command activate method: This mwthos checks all validation and once it is passed RelocateFeature class will be called to relocate the feature. /// </summary> /// <param name="CustomCommandHelper"></param> public void Activate(IGTCustomCommandHelper CustomCommandHelper) { bool ccValidation = false; IGTKeyObjects relatedFeaturesOWB = GTClassFactory.Create <IGTKeyObjects>(); try { m_GTCustomCommandHelper = CustomCommandHelper; // check if the command is called multiple times for (int i = 0; i < m_gtApplication.Application.Properties.Keys.Count; i++) { if (string.Equals("RelocateFeatureCC", Convert.ToString(m_gtApplication.Application.Properties.Keys.Get(i)))) { return; } } m_gtApplication.Application.Properties.Add("RelocateFeatureCC", "RelocateFeature"); GTClassFactory.Create <IGTApplication>().SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Relocate Feature custom command...."); ccValidation = ValidateCC(out relatedFeaturesOWB); if (ccValidation) { RelocateFeature feature_T = new RelocateFeature(m_GTCustomCommandHelper, m_gtApplication, m_oActiveKeyObject, relatedFeaturesOWB, TransactionManager, m_strStatus, m_strJobtype); GTClassFactory.Create <IGTApplication>().SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Relocate Feature Custom Command: Please select new owner feature or press Esc key to exit the command."); } else { ExitCmd(); } } catch (Exception ex) { if (m_gtApplication.Application.Properties.Count > 0) { m_gtApplication.Application.Properties.Remove("RelocateFeatureCC"); } MessageBox.Show(ex.Message, "Relocate Feature", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } finally { } }
/// <summary> /// Command has terminated. Release the objects. /// </summary> public void Terminate() { try { m_Application = null; m_TransactionManager = null; m_CustomCommandHelper = null; frmCablePullTension.m_CustomCommandHelper = null; frmCablePullTension.m_TransactionManager = null; frmCablePullTension = null; } catch (Exception ex) { MessageBox.Show(m_Application.ApplicationWindow, "IGTCustomCommandModeless_Terminate:" + Environment.NewLine + "Error (" + ex.Source + ") - " + ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public ReviewAssetHistoryForm(AssetHistoryModel assetHistoryModel, IGTTransactionManager oGTTransactionManager, IGTCustomCommandHelper GTCustomCommandHelper) { try { m_dataGridViewColumnSelector = null; m_assetHistoryModel = assetHistoryModel; m_oGTTransactionManager = oGTTransactionManager; m_GTCustomCommandHelper = GTCustomCommandHelper; InitializeComponent(); if (!assetHistoryModel.m_DataContext.IsRoleGranted("ADMINISTRATOR")) { btnSaveView.Visible = false; } if (m_assetHistoryModel.m_FID != 0 && !m_assetHistoryModel.m_isStructure) { txtFid.Text = Convert.ToString(m_assetHistoryModel.m_FID); } LoadDatagridView(null); LoadComboBox(); cmbNamedView.SelectedIndex = -1; m_dataGridViewColumnSelector = new DataGridViewColumnSelector(dgHistory, m_assetHistoryModel); if (dgHistory.Rows.Count > 0) { btnSaveView.Enabled = true; btnExport.Enabled = true; } else { btnSaveView.Enabled = false; btnExport.Enabled = false; } } catch (Exception ex) { MessageBox.Show("Error during execution of Review Asset History custom command." + Environment.NewLine + ex.Message, "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// The entry point for the custom command. /// </summary> /// <param name="CustomCommandHelper">Provides notification to the system that the command has finished</param> public void Activate(IGTCustomCommandHelper CustomCommandHelper) { try { m_CustomCommandHelper = CustomCommandHelper; // Get the job information. Used for validating command enabling. if (!CommonDT.GetJobInformation()) { m_CustomCommandHelper.Complete(); return; } if (m_Application.SelectedObjects.FeatureCount > 1) { MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_CPT_MULTIPLE_FEATURES_SELECTED, ConstantsDT.COMMAND_NAME_CABLE_PULL_TENSION, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); m_CustomCommandHelper.Complete(); return; } else if (m_Application.SelectedObjects.FeatureCount == 1) { // Only one feature in select set. Check if selected feature is a Duct Bank. IGTDDCKeyObjects oGTDCKeys = m_Application.SelectedObjects.GetObjects(); IGTDDCKeyObject objKeyObject = GTClassFactory.Create <IGTDDCKeyObject>(); if (oGTDCKeys[0].FNO != ConstantsDT.FNO_UG_SECCOND && oGTDCKeys[0].FNO != ConstantsDT.FNO_UG_COND) { MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_CPT_INVALID_FEATURE_SELECTED, ConstantsDT.COMMAND_NAME_CABLE_PULL_TENSION, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); m_CustomCommandHelper.Complete(); return; } } frmCablePullTension.m_CustomCommandHelper = CustomCommandHelper; frmCablePullTension.StartPosition = FormStartPosition.CenterScreen; frmCablePullTension.Show(m_Application.ApplicationWindow); return; } catch (Exception ex) { MessageBox.Show(m_Application.ApplicationWindow, "IGTCustomCommandModeless_Activate:" + Environment.NewLine + "Error (" + ex.Source + ") - " + ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); CustomCommandHelper.Complete(); } }
/// <summary> /// Intialize variables and check selected feature is valid. /// </summary> /// <param name="CustomCommandHelper"></param> public void Activate(Intergraph.GTechnology.API.IGTCustomCommandHelper CustomCommandHelper) { try { m_oGTCustomCommandHelper = CustomCommandHelper; m_oGTApplication.BeginWaitCursor(); if (m_oGTApplication.SelectedObjects.FeatureCount > 0) { //Get Source feature FNO,FID m_sourceFNO = m_oGTApplication.SelectedObjects.GetObjects()[0].FNO; m_sourceFID = m_oGTApplication.SelectedObjects.GetObjects()[0].FID; //Get Primary Graphic component m_primaryGeoCNO = GetPrimaryGeographicCNO(m_sourceFNO); int m_componentType = GetComponentType(m_primaryGeoCNO); //if selected feature is not valid then show the error message if ((m_componentType != 8) || (!ValidateSelectedFeature(m_sourceFNO))) { MessageBox.Show(sValidationMsg, sMsgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); ExitCommand(); } else { //subscribe the events SubscribeEvents(); //Get target feature FNO and source geometry m_targetFNO = GetTargetFeature(m_sourceFNO); m_gSrcGeometry = m_oGTApplication.SelectedObjects.GetObjects()[0].Geometry; m_oGTApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, sStatusBarMsg1); m_oGTApplication.ActiveMapWindow.MousePointer = GTMousePointerConstants.gtmwmpCrossHair; } } } catch (Exception ex) { MessageBox.Show("Error " + ex.Message, sMsgBoxCaption, 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(); }