Ejemplo n.º 1
0
 private void SetupEvents()
 {
     activeViewEvent     = m_activeView as IActiveViewEvents_Event;
     mapSelectionChanged = new
                           IActiveViewEvents_SelectionChangedEventHandler(OnFeatureLayerSelectionChanged);
     activeViewEvent.SelectionChanged += mapSelectionChanged;
 }
Ejemplo n.º 2
0
        internal void OnDocumentsLoad()
        {
            logger.InfoEx("Document loaded.");

            IActiveViewEvents_Event activeViewEvents = (IActiveViewEvents_Event)View.ActiveView.FocusMap;
            IActiveViewEvents_SelectionChangedEventHandler handler = new IActiveViewEvents_SelectionChangedEventHandler(OnMapSelectionChangedLocal);

            activeViewEvents.SelectionChanged += handler;
        }
Ejemplo n.º 3
0
        private void _form_Closed(object sender, EventArgs e)
        {
            // Decouple event handlers
            this._form.Closed-=new EventHandler(_form_Closed);
            this._form.ErrorSelection-=new ErrorSelectionEventHandler(_form_ErrorSelection);
            this._form.FilterChange-=new FilterChangeEventHandler(_form_FilterChange);
            this._form.StatusChange-=new StatusChangeEventHandler(_form_StatusChange);
            this._form.Zoom-=new ZoomEventHandler(_form_Zoom);
            this._form.Pan-=new EventHandler(_form_Pan);

            IMap theMap = this.Extension.FocusMap;
            try
            {
                // Stop listening to map selection events
                if (this._selectionEventHandler != null)
                {
                    try
                    {
                        ((IActiveViewEvents_Event)theMap).SelectionChanged -= this._selectionEventHandler;
                    }
                    catch (Exception ex) {
                        util.Logger.Write("Exception caught disposing selection evt handler in ErrorManagerCmd::_form_Closed(): " + Environment.NewLine
                            + ex.Message + Environment.NewLine + ex.StackTrace);
                    }
                    this._selectionEventHandler = null;
                }

                // Clean up the error layer in the map
                IFeatureLayer theErrorLayer = this.ErrorLayer;
                if (theErrorLayer != null)
                    theMap.DeleteLayer((ILayer)theErrorLayer);

                // Remove any extra feedback
                if (this._extraFeedback != null)
                {
                    IGraphicsContainer theGCont = util.GraphicsHelper.get_GraphicsContainer(theMap);
                    theGCont.DeleteElement(this._extraFeedback);
                    this._extraFeedback = null;
                }

                this._form.Dispose();

            }
            catch (Exception ex)
            {
                util.Logger.Write("Exception caught disposing of the Error Management form:" + Environment.NewLine
                    + ex.Message + ex.StackTrace);
            }
            finally
            {
                this._form = null;
                ((IActiveView)theMap).Refresh();
                Marshal.ReleaseComObject(theMap);
            }
        }
Ejemplo n.º 4
0
 private void toolStripButton7_Click(object sender, EventArgs e)
 {
     this.selectionChangedHandler = new IActiveViewEvents_SelectionChangedEventHandler(this.onSelectionChanged);
     this.pMap = this.mainMapControl.ActiveView.FocusMap;
     ((IActiveViewEvents_Event)this.pMap).SelectionChanged += this.selectionChangedHandler;
 }
Ejemplo n.º 5
0
        public void Open()
        {
            IMap theMap = this.Extension.FocusMap;
            try
            {
                if (this.Extension.QAManager.ErrorCount == 0)
                {
                    MessageBox.Show("No errors to show.", "Error Manager", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                // Make a note of the current transaction id
                this._transactionID = "-1";
                tm.Transaction theTX = this.Extension.TransactionManager.Current();
                if (theTX != null)
                    this._transactionID = theTX.TxId;

                // Show errors in the map
                this.CreateErrorLayer();

                // Create error management dialog
                this._form = new ErrorManagerForm(false);

                // Establish event handlers
                this._form.Closed+=new EventHandler(_form_Closed);
                this._form.ErrorSelection+=new ErrorSelectionEventHandler(_form_ErrorSelection);
                this._form.FilterChange+=new FilterChangeEventHandler(_form_FilterChange);
                this._form.StatusChange+=new StatusChangeEventHandler(_form_StatusChange);
                this._form.Zoom+=new ZoomEventHandler(_form_Zoom);
                this._form.Pan+=new EventHandler(_form_Pan);

                // Start listening to map selection events
                if (this._selectionEventHandler != null)
                {
                    try
                    {
                        ((IActiveViewEvents_Event)theMap).SelectionChanged -= this._selectionEventHandler;
                    }
                    catch (Exception ex)
                    {
                        util.Logger.Write("Exception caught disposing selection evt handler in ErrorManagerCmd::Open(): " + Environment.NewLine
                            + ex.Message + Environment.NewLine + ex.StackTrace);
                    }
                    this._selectionEventHandler = null;
                }

                try
                {
                    this._selectionEventHandler = new IActiveViewEvents_SelectionChangedEventHandler(ErrorManagerCmd_SelectionChanged);
                    ((IActiveViewEvents_Event)theMap).SelectionChanged += this._selectionEventHandler;
                }
                catch (Exception ex)
                {
                    util.Logger.Write("Exception caught creating selection evt handler in ErrorManagerCmd::Open(): " + Environment.NewLine
                        + ex.Message + Environment.NewLine + ex.StackTrace);
                }

                // Show the dialog non-modally
                SetWindowLongA(this._form.Handle.ToInt32(), GWL_HWNDPARENT, this._App.hWnd);
                this._form.Show();

                // Send it the list of errors
                this.FilterErrors("");
            }
            catch (Exception ex)
            {
                if (this._form != null)
                {
                    this._form.Dispose();
                    this._form = null;
                }

                util.Logger.Write("Exception caught opening the error manager: " + Environment.NewLine
                    + ex.Message + Environment.NewLine + ex.StackTrace);
            }
            finally
            {
                Marshal.ReleaseComObject(theMap);
            }
        }