Microsoft Project VSTO C# - 更改时的事件侦听器 [英] Microsoft Project VSTO C# - Event Listener when changed

查看:19
本文介绍了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.

这篇关于Microsoft Project VSTO C# - 更改时的事件侦听器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆