public void WireFabricTableEditEvents()
        {
            if (_objectClassEventList == null)
            {
                _objectClassEventList = new List <ESRI.ArcGIS.Geodatabase.IObjectClassEvents_Event>();
            }

            //create event handler for each fabric class in the edit workspace
            try
            {
                _objectClassEventList.Clear();
                for (int i = 0; i < _fabricObjectClassIds.Count; i++)
                {
                    IObjectClass pObjClass = (IObjectClass)_fabricObjectClasses.get_Element(i);
                    //Create event handler.
                    ESRI.ArcGIS.Geodatabase.IObjectClassEvents_Event ev = (ESRI.ArcGIS.Geodatabase.IObjectClassEvents_Event)pObjClass;
                    ev.OnChange += new ESRI.ArcGIS.Geodatabase.IObjectClassEvents_OnChangeEventHandler(FabricRowChange);
                    ev.OnChange += new ESRI.ArcGIS.Geodatabase.IObjectClassEvents_OnChangeEventHandler(FabricGeometryRowChange);
                    //ev.OnCreate += new ESRI.ArcGIS.Geodatabase.IObjectClassEvents_OnCreateEventHandler(FabricRowCreate);
                    _objectClassEventList.Add(ev);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + " in Wire Fabric Events");
            }
        }
Пример #2
0
        /// <summary>
        /// Signals the telecom workspace helpers objects to stop listening for edits etc.
        /// </summary>
        /// <param name="save">Should any edits be saved</param>
        private void m_editEvents_OnStopEditing(Boolean save)
        {
            _logHelper.addLogEntry(DateTime.Now.ToString(), "INFO", "On stop editing");

            try
            {
                _logHelper.addLogEntry(DateTime.Now.ToString(), "INFO", "Stopped editing telecom workspace.");

                // -------------------------------------
                // Hide the cable configuration window
                // -------------------------------------
                //UID dockWinID = new UIDClass();
                //dockWinID.Value = @"esriTelcoTools_FiberCableConfigWindow";
                //IDockableWindow dockWindow = ArcMap.DockableWindowManager.GetDockableWindow(dockWinID);
                //dockWindow.Show(false);

                // ------------------------------------
                // Stop the helpers to deal with
                // telecom workspace editing.
                // ------------------------------------
                _logHelper.addLogEntry(DateTime.Now.ToString(), "INFO", "Stopping telecom helpers.");
                _fiberCableHelper.onStopEditing();
                _fiberDeviceHelper.onStopEditing();

                // If we are dealing with non-shapefile, non-coverage data no need to remove
                // event handlers since no GDB relationships etc can exist.
                if (ArcMap.Editor.EditWorkspace.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace ||
                    ArcMap.Editor.EditWorkspace.Type == esriWorkspaceType.esriLocalDatabaseWorkspace)
                {
                    // --------------------------------------------
                    // Stop listening for feature template changes
                    // --------------------------------------------
                    Events5.OnCurrentTemplateChanged -= new IEditEvents5_OnCurrentTemplateChangedEventHandler(Events5_OnCurrentTemplateChanged);

                    // -----------------------------
                    // Stop listening for deletions
                    // -----------------------------
                    Events.OnDeleteFeature -= new IEditEvents_OnDeleteFeatureEventHandler(Events_OnDeleteFeature);

                    // -----------------------------------
                    //  Stop listening for Dynamic Values changes
                    // -----------------------------------
                    Events.OnChangeFeature += new IEditEvents_OnChangeFeatureEventHandler(m_editEvents_OnChangeFeature);
                    Events.OnCreateFeature += new IEditEvents_OnCreateFeatureEventHandler(m_editEvents_OnCreateFeature);
                }

                if (!save)
                {
                    lastValueProperties = null;
                }

                // ---------------------------------------
                // Remove non feature class event tracking
                // ---------------------------------------
                if (null != _nonFeatureObjClassEvents)
                {
                    for (int i = _nonFeatureObjClassEvents.Count - 1; i > -1; i--)
                    {
                        ESRI.ArcGIS.Geodatabase.IObjectClassEvents_Event nonFtClassOCE = _nonFeatureObjClassEvents[i];
                        nonFtClassOCE.OnCreate -= new IObjectClassEvents_OnCreateEventHandler(m_editEvents_OnCreateFeature);
                        nonFtClassOCE.OnChange -= new IObjectClassEvents_OnChangeEventHandler(m_editEvents_OnChangeFeature);
                        _nonFeatureObjClassEvents.Remove(nonFtClassOCE);
                    }
                    _nonFeatureObjClassEvents = null;
                }
            }
            catch (Exception ex)
            {
                _logHelper.addLogEntry(DateTime.Now.ToString(), "ERROR", "Error on stop editing.", ex.ToString());

                MessageBox.Show("Error: \n" + ex.ToString());
            }
        }