/// <summary>
        /// Makes the filter aware of the <see cref="IRoutedMessageHandler"/>.
        /// </summary>
        /// <param name="messageHandler">The message handler.</param>
        public void MakeAwareOf(IRoutedMessageHandler messageHandler)
        {
            var notifier = messageHandler.Unwrap() as INotifyPropertyChanged;
            if (notifier == null) return;

            var helper = messageHandler.GetMetadata<DependencyObserver>();
            if (helper != null) return;

            helper = new DependencyObserver(messageHandler, _methodFactory, notifier);
            messageHandler.AddMetadata(helper);
        }
Exemple #2
0
        /// <summary>
        /// Makes the filter aware of the <see cref="IRoutedMessageHandler"/>.
        /// </summary>
        /// <param name="messageHandler">The message handler.</param>
        public void MakeAwareOf(IRoutedMessageHandler messageHandler)
        {
            var notifier = messageHandler.Unwrap() as INotifyPropertyChanged;

            if (notifier == null)
            {
                return;
            }

            var helper = messageHandler.GetMetadata <DependencyObserver>();

            if (helper != null)
            {
                return;
            }

            helper = new DependencyObserver(messageHandler, _methodFactory, notifier);
            messageHandler.AddMetadata(helper);
        }
        private void TryHookDependencyObserver(IRoutedMessageHandler messageHandler)
        {
            if (!IsGetter)
            {
                return;
            }

            var notifier = messageHandler.Unwrap() as INotifyPropertyChanged;

            if (notifier == null)
            {
                return;
            }

            var helper = messageHandler.Metadata.FirstOrDefaultOfType <DependencyObserver>();

            if (helper != null)
            {
                return;
            }

            helper = new DependencyObserver(messageHandler, methodFactory, notifier);
            messageHandler.Metadata.Add(helper);
        }
Exemple #4
0
        /// <summary>
        /// Makes the filter aware of the <see cref="IRoutedMessageHandler"/>.
        /// </summary>
        /// <param name="messageHandler">The message handler.</param>
        public void MakeAwareOf(IRoutedMessageHandler messageHandler)
        {
            if (!AffectsTriggers)
                return;

            var notifier = messageHandler.Unwrap() as INotifyPropertyChanged;
            if (notifier == null) return;

            var helper = messageHandler.Metadata.FirstOrDefaultOfType<DependencyObserver>();
            if (helper != null) return;

            helper = new DependencyObserver(messageHandler, _methodFactory, notifier);
            messageHandler.Metadata.Add(helper);
        }
        private void TryHookDependencyObserver(IRoutedMessageHandler messageHandler)
        {
            //if (!IsGetter()) return;

            var notifier = messageHandler.Unwrap() as INotifyPropertyChanged;
            if (notifier == null) return;

            var helper = messageHandler.Metadata.FirstOrDefaultOfType<DependencyObserver>();
            if (helper != null) return;

            helper = new DependencyObserver(messageHandler, _methodFactory, notifier);
            messageHandler.Metadata.Add(helper);
        }