/// <summary> /// Restores the execution of actions related to tracking /// </summary> /// <param name="t"></param> private static void Watch(ITrackable t) { if (t == null || t.IsBeingWatched()) { return; } _watchedITrackables.Add(t); }
/// <summary> /// Adds event handlers and tracks the passed ITrackable. Best practice is to call in the constructor of an ITrackableForm /// </summary> /// <param name="t"></param> public static void Register(ITrackable t) { if (t == null || t.IsBeingWatched()) { return; //watched -> registered } t.Enter += Entered; t.FormClosed += Closed; t.VisibleChanged += WatchIfVisible; Watch(t); }