/// <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() { List <KeyValuePair <int, string> > featureTypes = null; try { gtApp = GTClassFactory.Create <IGTApplication>(); if (gtApp.DataContext.IsRoleGranted("PRIV_MGMT_LAND")) { featureTypes = GetFeatureClass(); detectOverlappingAnalysis = new DetectOverlappingAnalysis(featureTypes); if (detectOverlappingAnalysis.ShowDialog() == DialogResult.OK) { DetectOverlapping(detectOverlappingAnalysis.SelectedFeatureType, detectOverlappingAnalysis.IsSelfOverlap); } } else { MessageBox.Show("Command Access Denied. Please contact System Administrator", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBox.Show("Error " + ex.Message, msgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { CleanUp(); } }
/// <summary> /// Dispose all method before command exit /// </summary> private void CleanUp() { if (detectOverlappingAnalysis != null) { detectOverlappingAnalysis.Dispose(); } detectOverlappingAnalysis = null; if (gtTransactionManager != null) { if (gtTransactionManager.TransactionInProgress) { gtTransactionManager.Rollback(); } } gtTransactionManager = null; }
/// <summary> /// Dispose all method before command exit /// </summary> private void CleanUp() { gtCustomCommandHelper.MouseMove -= gtCustomCommandHelper_MouseMove; if (detectOverlappingAnalysis != null) { detectOverlappingAnalysis.Dispose(); } detectOverlappingAnalysis = null; if (gtTransactionManager != null) { if (gtTransactionManager.TransactionInProgress) { gtTransactionManager.Rollback(); } } gtTransactionManager = null; if (gtCustomCommandHelper != null) { gtCustomCommandHelper.Complete(); } gtCustomCommandHelper = null; }