C# 如何在每次更改字段时使用NotifyPSEvent激发事件?
我试图在表示空间更改时运行事件处理程序方法。我对本地AUTPS方法不是最熟悉,但PS.NotifyPSEvents似乎很有前途 我在IBM网站上尝试了一些在线示例,但似乎无法理解它们C# 如何在每次更改字段时使用NotifyPSEvent激发事件?,c#,event-handling,C#,Event Handling,我试图在表示空间更改时运行事件处理程序方法。我对本地AUTPS方法不是最熟悉,但PS.NotifyPSEvents似乎很有前途 我在IBM网站上尝试了一些在线示例,但似乎无法理解它们 public partial class Form1 : Form { public AutPS A_PS = new AutPS(); public AutOIA A_OI = new AutOIA(); public Form1() { InitializeCo
public partial class Form1 : Form
{
public AutPS A_PS = new AutPS();
public AutOIA A_OI = new AutOIA();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
A_PS.SetConnectionByName("A");
A_OI.SetConnectionByName("A");
A_PS.NotifyPSEvent += A_PS_NotifyPSEvent();
A_PS.RegisterPSEvent(true);
}
private AutPSTypeLibrary.IPSEvent_NotifyPSEventEventHandler A_PS_NotifyPSEvent()
{
if (A_PS.SearchText("GEEP", PsDir.pcSrchForward, 1, 1))
{
MessageBox.Show("BLAH"); return null;
}
}
}
我希望当PS注册一个字段更改时,我可以捕获它并记录更改的内容,但是它只是在启动我的程序时触发事件,而不管屏幕上有什么更新。随后,当我更新屏幕上的任何内容时,事件不会触发。我肯定我只是误解了这个特殊的方法是如何工作的,但我已经搜索了一周,没有找到真正的答案,我可以翻译得足够好,让它工作。任何信息将不胜感激 我想起来了,我参加的活动是正确的,但错过了一点信息。以下是对我有效的决议:
private void Form1_Load(object sender, EventArgs e)
{
A_PS.SetConnectionByName("A");
A_OI.SetConnectionByName("A");
//Added a new A_PS_NotifyPSEvent handler and it works perfectly now.
A_PS.NotifyPSEvent += A_PS_NotifyPSEvent1;
A_PS.RegisterPSEvent(true);
A_Reco.AddPS(A_PS);
}
private void A_PS_NotifyPSEvent1()
{
MessageBox.Show("BLAH");
throw new NotImplementedException();
}