示例#1
0
文件: Action.cs 项目: agamat/Ribbon-1
        private static void SetTargetCore(DependencyPropertyChangedEventArgs e, DependencyObject d, bool setContext)
        {
            if (_controller == null)
            {
                return;
            }

            if (e.NewValue != e.OldValue && e.NewValue != null)
            {
                var target = e.NewValue;

#if SILVERLIGHT
                var containerKey = e.NewValue as string;

                if (containerKey != null)
                {
                    target = _serviceLocator.GetInstance(null, containerKey);
                }
#endif

                var handler = new ActionMessageHandler(
                    new ActionHost(
                        target.GetType(),
                        _actionFactory,
                        _serviceLocator
                        ),
                    target
                    );

                _controller.AddHandler(d, handler, setContext);
            }
        }
示例#2
0
文件: Action.cs 项目: Mrding/Ribbon
        private static void SetTargetCore(DependencyPropertyChangedEventArgs e, DependencyObject d, bool setContext)
        {
            if(_controller == null) return;

            if(e.NewValue != e.OldValue && e.NewValue != null)
            {
                var target = e.NewValue;

#if SILVERLIGHT
                var containerKey = e.NewValue as string;

                if(containerKey != null)
                    target = _serviceLocator.GetInstance(null, containerKey);
#endif

                var handler = new ActionMessageHandler(
                    new ActionHost(
                        target.GetType(),
                        _actionFactory,
                        _serviceLocator
                        ),
                    target
                    );

                _controller.AddHandler(d, handler, setContext);
            }
        }