예제 #1
0
        private void ActiveViews_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                ActiveViews.Add(e.NewItems[0].ToString());
                break;

            case NotifyCollectionChangedAction.Remove:
                ActiveViews.Remove(e.OldItems[0].ToString());
                break;

            case NotifyCollectionChangedAction.Replace:
                break;

            case NotifyCollectionChangedAction.Move:
                break;

            case NotifyCollectionChangedAction.Reset:
                ActiveViews.Clear();
                foreach (var view in region.ActiveViews)
                {
                    ActiveViews.Add(view.ToString());
                }
                break;

            default:
                break;
            }

            RemoveActiveViewCommand.RaiseCanExecuteChanged();

            SelectedViewName = ActiveViews.FirstOrDefault();
        }
예제 #2
0
        /// <summary>
        /// Marks the specified view as active.
        /// </summary>
        /// <param name="view">The view to activate.</param>
        /// <remarks>If there is an active view before calling this method,
        /// that view will be deactivated automatically.</remarks>
        public override void Activate(object view)
        {
            object currentActiveView = ActiveViews.FirstOrDefault();

            if (currentActiveView != null && currentActiveView != view && this.Views.Contains(currentActiveView))
            {
                base.Deactivate(currentActiveView);
            }
            base.Activate(view);
        }
예제 #3
0
        /// <summary>
        /// Marks the specified view as active.
        /// </summary>
        /// <param name="view">The view to activate.</param>
        /// <remarks>If there is an active view before calling this method,
        /// that view will be deactivated automatically.</remarks>
        public override void Activate(VisualElement view)
        {
            var currentActiveView = ActiveViews.FirstOrDefault();

            if (currentActiveView != null && currentActiveView != view && Views.Contains(currentActiveView))
            {
                base.Deactivate(currentActiveView);
            }

            base.Activate(view);
        }