So i have class “A” and i have list “L” in there which i’d like to empty with its private method “ClearList” at the beginning of every frame.
public class A
{
public List<T> L
public A() { }
private void ClearList()
{
this.L.Clear();
}
}
I don’t really like to do it inside the plugin because when i hand the object “A” over to another plugin while the source plugin looses it then the “ClearList” method won’t run every frame anymore.
now what i found was IMainLoop described here: idxdeviceservice-and-imainloop so i ended up with this:
public class A : IPartImportsSatisfiedNotification
{
[Import](Import)
IHDEHost FHDEHost;
public List<T> L
public A() { }
public void OnImportsSatisfied()
{
FHDEHost.MainLoop.OnPrepareGraph += ClearList;
}
private void ClearList(object sender, EventArgs e)
{
this.L.Clear();
}
}
but: I’ve put a breakpoint at the “FHDEHost.MainLoop.OnPrepareGraph += ClearList;” part and at the “this.L.Clear();” part in visual studio. It stopped properly when i was subscribing to the mainloop event but it never stopped on “this.L.Clear();” and apparently “ClearList” was never executed.
What am I doing wrong? Thanks for any help!