Beispiel #1
0
 protected override void StartListeningCore(WeakReference <object> reference)
 {
     if (_nameScope.TryGetTarget(out var scope))
     {
         _subscription = NameScopeLocator.Track(scope, _name).Subscribe(ValueChanged);
     }
     else
     {
         _subscription = null;
     }
 }
        protected ExpressionObserver CreateElementObserver(
            IStyledElement target,
            string elementName,
            ExpressionNode node)
        {
            _ = target ?? throw new ArgumentNullException(nameof(target));

            if (NameScope is null || !NameScope.TryGetTarget(out var scope) || scope is null)
            {
                throw new InvalidOperationException("Name scope is null or was already collected");
            }
            var result = new ExpressionObserver(
                NameScopeLocator.Track(scope, elementName),
                node,
                null);

            return(result);
        }
Beispiel #3
0
        protected ExpressionObserver CreateElementObserver(
            IStyledElement target,
            string elementName,
            ExpressionNode node)
        {
            Contract.Requires <ArgumentNullException>(target != null);

            NameScope.TryGetTarget(out var scope);
            if (scope == null)
            {
                throw new InvalidOperationException("Name scope is null or was already collected");
            }
            var result = new ExpressionObserver(
                NameScopeLocator.Track(scope, elementName),
                node,
                null);

            return(result);
        }