예제 #1
0
        /// <summary>
        /// Subscribes to the parent view model container.
        /// </summary>
        private void SubscribeToParentViewModelContainer()
        {
            if (!SupportParentViewModelContainers)
            {
                return;
            }

            if (HasParentViewModelContainer)
            {
                return;
            }

            _parentViewModelContainer = TargetView.FindParentViewModelContainer();
            if (_parentViewModelContainer != null)
            {
                Log.Debug("Found the parent view model container '{0}' for '{1}'", _parentViewModelContainer.GetType().Name, TargetView.GetType().Name);
            }
            else
            {
                Log.Debug("Couldn't find parent view model container");
            }

            ApiCop.UpdateRule <UnusedFeatureApiCopRule>("UserControlLogic.SupportParentViewModelContainers",
                                                        rule => rule.IncreaseCount(_parentViewModelContainer != null, TargetViewType.FullName));

            if (_parentViewModelContainer != null)
            {
                _parentViewModelContainer.ViewModelChanged += OnParentViewModelContainerViewModelChanged;

                SubscribeToParentViewModel(_parentViewModelContainer.ViewModel);
            }
        }