public ReferenceListener(ReferenceTarget target, RefMessage message, Action action) { this.target = target; this.message = message; this.action = action; Kernel.listeners.Add(this); ReplaceReference(0, target._Target, true); }
public override RefResult NotifyRefChanged(IInterval changeInt, IReferenceTarget hTarget, ref UIntPtr partID, RefMessage message) { if (hTarget.Handle != target._Target.Handle) return RefResult.Dontcare; if (message == this.message) action(); if (message == RefMessage.RefDeleted) { Kernel.listeners.Remove(this); Dispose(); } return RefResult.Succeed; }
/// <summary> /// helper for the notifiy dependands on node /// if you change anything on a node the node have to notify all dependents /// this is similar to events in c# /// </summary> /// <param name="node"></param> /// <param name="interval"></param> /// <param name="part"></param> /// <param name="message"></param> public static void NotifyDependents(this IINode node, IInterval interval, int part, RefMessage message) { node.NotifyDependents(interval, new UIntPtr((uint)part), message, Globals.NOTIFY_ALL, true, null); }
public override RefResult NotifyRefChanged(IInterval changeInt, IReferenceTarget hTarget, ref UIntPtr partID, RefMessage message) { if (hTarget.Handle != target._Target.Handle) { return(RefResult.Dontcare); } if (message == this.message) { action(); } if (message == RefMessage.RefDeleted) { Kernel.listeners.Remove(this); Dispose(); } return(RefResult.Succeed); }
public RefResult NotifyDependents_(IInterval changeInt, UIntPtr partID, RefMessage message, SClass_ID sclass, bool propagate, IReferenceTarget hTarg) { throw new NotImplementedException(); }
public RefResult NotifyRefChanged(IInterval changeInt, IReferenceTarget hTarget, ref UIntPtr partID, RefMessage message, bool propagate) { throw new NotImplementedException(); }