Beispiel #1
0
        /// <summary>
        /// Unsubscribes the specified <paramref name="handler"/> from the controller with the specified <paramref name="controllerId"/>.
        /// The handler won't get executed on a change of the controller.
        /// </summary>
        /// <param name="controllerId">The id of the controller to not anymore observe.</param>
        /// <param name="handler">The handler to unsubscribe.</param>
        public void UnsubsribeFromControllerChanges(int controllerId, Action <IController> handler)
        {
            IController controller = ControllerTree.GetController(controllerId);

            foreach (Tag controllerTag in controller.GetAllAssociatedTags())
            {
                controllerTag.ValueChanged -= NotifySubscribers;
                SlowTagListener.RemoveTag(controllerTag);
            }

            lock (_lockSubscribers)
            {
                _subscribers.RemoveAll(t => Equals(t.Item2, handler));
            }
        }