Exemple #1
0
        public void Connect(Application application, object changeDefinition, Inventor._Document document)
        {
            //get the change manager object
            ChangeManager oChangeManager = application.ChangeManager;

            //get the change definitions collection for this AddIn
            ChangeDefinitions oChangeDefinitions = oChangeManager["{c29d5be2-c9f7-4783-9191-5070d4944568}"];

            //create the change processor associated with the change definition
            m_changeProcessor = oChangeDefinitions[changeDefinition].CreateChangeProcessor();

            //connect event handler in order to receive change processor events
            m_changeProcessor_OnExecute_Delegate = new ChangeProcessorSink_OnExecuteEventHandler(ChangeProcessorEvnets_OnExecute);
            m_changeProcessor.OnExecute         += m_changeProcessor_OnExecute_Delegate;

            m_changeProcessor_OnTerminate_Delegate = new ChangeProcessorSink_OnTerminateEventHandler(ChangeProcessorEvnets_OnTerminate);
            m_changeProcessor.OnTerminate         += m_changeProcessor_OnTerminate_Delegate;

            //execute the change processor
            m_changeProcessor.Execute(document);
        }
        /// <summary>
        /// Method that is used to encapsulate a series of actions into a single transaction for the user
        /// to undo or redo.
        /// </summary>
        public void Connect()
        {
            //Establish a reference to the change manager
            _changeManager = _inventorApplication.ChangeManager;

            //Establish a reference to the Change Definitions collection for this add-in
            _changeDefinitions = _changeManager.Add(_clientID);

            _changeDefinition = _changeDefinitions.Add(_changeDefInternalName, _changeDefCommandName);

            //Create a change processor
            _changeProcessor = _changeDefinition.CreateChangeProcessor();

            //Connect the events
            this._onExecute_Delegate = new ChangeProcessorSink_OnExecuteEventHandler(changeProcessor_OnExecute);
            _changeProcessor.OnExecute += this._onExecute_Delegate;

            this._onTerminate_Delegate = new ChangeProcessorSink_OnTerminateEventHandler(changeProcessor_OnTerminate);
            _changeProcessor.OnTerminate += this._onTerminate_Delegate;

            //Calling the Execute method is what causes the transaction to occur.
            _changeProcessor.Execute(_inventorApplication.ActiveEditDocument);
        }
Exemple #3
0
        /// <summary>
        /// Method that is used to encapsulate a series of actions into a single transaction for the user
        /// to undo or redo.
        /// </summary>
        public void Connect()
        {
            //Establish a reference to the change manager
            _changeManager = _inventorApplication.ChangeManager;

            //Establish a reference to the Change Definitions collection for this add-in
            _changeDefinitions = _changeManager.Add(_clientID);

            _changeDefinition = _changeDefinitions.Add(_changeDefInternalName, _changeDefCommandName);

            //Create a change processor
            _changeProcessor = _changeDefinition.CreateChangeProcessor();

            //Connect the events
            this._onExecute_Delegate    = new ChangeProcessorSink_OnExecuteEventHandler(changeProcessor_OnExecute);
            _changeProcessor.OnExecute += this._onExecute_Delegate;

            this._onTerminate_Delegate    = new ChangeProcessorSink_OnTerminateEventHandler(changeProcessor_OnTerminate);
            _changeProcessor.OnTerminate += this._onTerminate_Delegate;

            //Calling the Execute method is what causes the transaction to occur.
            _changeProcessor.Execute(_inventorApplication.ActiveEditDocument);
        }