Microsoft Project VSTO C# - Event Listener when changed

纵饮孤独 提交于 2019-12-20 06:38:49

问题


I'm having a little trouble

I'm trying to write a handler for a Project 2013 addin to listen for changes that occur in a cell in MS Project. If the cell is changed, I want to then enter a flag into one of the hidden cells

Any ideas?


回答1:


You'll need to add an event handler like this:

    private void MyEventHandler(Task task, PjField field, object newValue, ref bool cancel)
    {
        // My code here
    }

As part of your Add-In's setup you need to add your event handler:

    Application.ProjectBeforeTaskChange += MyEventHandler;

As tasks are changed, your event handler will be called. You can then check to see which attribute is being changed, and if it is one that's relevant to you, you can make the changes you need to the project.



来源:https://stackoverflow.com/questions/37671970/microsoft-project-vsto-c-sharp-event-listener-when-changed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!