Microsoft Project VSTO C# - 更改时的事件侦听器
我有点麻烦
我正在尝试为 Project 2013 插件编写处理程序,以侦听 MS Project 中单元格中发生的更改.如果单元格被更改,我想然后在其中一个隐藏单元格中输入一个标志
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
有什么想法吗?
您需要添加这样的事件处理程序:
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.