示例#1
0
        internal MasterStyle AddMasterStyle(AdaptiveView view)
        {
            MasterStyle style = new MasterStyle(this, view.Guid);

            _masterStyles.Add(style.ViewGuid, style);
            return(style);
        }
示例#2
0
        public void ChangeParent(IAdaptiveView view, IAdaptiveView newParent)
        {
            if (view == _base)
            {
                throw new ArgumentException("Cannot change parent of Base adaptive view!");
            }

            AdaptiveView viewToChange  = view as AdaptiveView;
            AdaptiveView newParentView = newParent as AdaptiveView;

            if (viewToChange == null)
            {
                throw new ArgumentNullException("view");
            }

            if (newParentView == null)
            {
                throw new ArgumentNullException("newParent");
            }

            // Remove view from old parent
            AdaptiveView oldParentView = viewToChange.ParentView as AdaptiveView;

            if (oldParentView != null && oldParentView != newParentView)
            {
                oldParentView.RemoveChildView(viewToChange);
            }

            newParentView.AddChildView(viewToChange);

            _document.OnChangeAdaptiveViewParent(viewToChange, oldParentView);
        }
示例#3
0
        public void DeleteAdaptiveView(IAdaptiveView view)
        {
            if (view == _base)
            {
                throw new ArgumentException("Cannot delete Base adaptive view!");
            }

            AdaptiveView viewToDelete = view as AdaptiveView;

            if (viewToDelete != null)
            {
                AdaptiveView parent = viewToDelete.ParentView as AdaptiveView;
                if (parent != null)
                {
                    // Remove this view from parent
                    parent.RemoveChildView(viewToDelete);

                    // Add child view to new parent
                    foreach (AdaptiveView childView in viewToDelete.ChildViews)
                    {
                        if (childView != null)
                        {
                            parent.AddChildView(childView);
                        }
                    }
                }

                // Remove this view from views
                _views.Remove(viewToDelete);

                _document.OnDeleteAdaptiveView(viewToDelete);
            }
        }
示例#4
0
 internal void DeleteWidgetStyle(AdaptiveView view)
 {
     if (view != null)
     {
         DeleteWidgetStyle(view.Guid);
     }
 }
示例#5
0
        internal WidgetStyle AddWidgetStyle(AdaptiveView view)
        {
            WidgetStyle style = new WidgetStyle(this, view.Guid);

            _widgetStyles.Add(style.ViewGuid, style);
            return(style);
        }
示例#6
0
 internal AdaptiveViewSet(Document document)
     : base("AdaptiveViewSet")
 {
     _document       = document;
     _affectAllViews = false;
     _base           = new AdaptiveView(this, "Base");
     _views          = new AdaptiveViews(this);
 }
示例#7
0
 internal void OnChangeAdaptiveViewParent(AdaptiveView view, AdaptiveView oldParentView)
 {
     foreach (Page page in _allPages.Values)
     {
         if (page != null && page.IsOpened)
         {
             page.OnChangeAdaptiveViewParent(view, oldParentView);
         }
     }
 }
示例#8
0
 internal void OnDeleteAdaptiveView(AdaptiveView view)
 {
     foreach (Page page in _allPages.Values)
     {
         if (page != null && page.IsOpened)
         {
             page.OnDeleteAdaptiveView(view);
         }
     }
 }
示例#9
0
 internal void RemoveChildView(AdaptiveView view)
 {
     if (view != null)
     {
         _childViewGuidList.Remove(view.Guid);
         if (_childViews != null)
         {
             _childViews.Remove(view);
         }
     }
 }
示例#10
0
        internal override void OnAddAdaptiveView(AdaptiveView view)
        {
            base.OnAddAdaptiveView(view);

            foreach (EmbeddedPage page in EmbeddedPages)
            {
                if (page != null && page.IsOpened)
                {
                    page.OnAddAdaptiveView(view);
                }
            }
        }
示例#11
0
        public IAdaptiveView CreateAdaptiveView(string name, IAdaptiveView parent)
        {
            AdaptiveView parentView = parent as AdaptiveView;

            if (parentView == null)
            {
                throw new ArgumentNullException("parent");
            }

            AdaptiveView view = new AdaptiveView(this, name);

            parentView.AddChildView(view);
            _views.Add(view);

            _document.OnAddAdaptiveView(view);

            return(view);
        }
示例#12
0
        internal void AddChildView(AdaptiveView view)
        {
            if (view != null)
            {
                /*
                 * AdpativeView object only can be created via IApdativeViewSet and
                 * the new created object is already in AdaptiveViewSet, so we don't need
                 * keeping the input object, we just keep the guid and can get the object
                 * from set with this guid when we need the object.
                 * */
                _childViewGuidList.Add(view.Guid);
                view.ParentView = this;

                if (_childViews != null)
                {
                    _childViews.Add(view);
                }
            }
        }
示例#13
0
        public bool MoveAdaptiveViewTo(IAdaptiveView view, int index)
        {
            if (view == _base)
            {
                throw new ArgumentException("Cannot move base adaptive view!");
            }

            AdaptiveView viewToMove = view as AdaptiveView;
            AdaptiveView parentView = viewToMove.ParentView as AdaptiveView;

            if (parentView != null)
            {
                AdaptiveViews views = parentView.ChildViews as AdaptiveViews;
                if (views != null)
                {
                    return(views.MoveItemTo(viewToMove, index));
                }
            }

            return(false);
        }
示例#14
0
 internal override void OnAddAdaptiveView(AdaptiveView view)
 {
     base.OnAddAdaptiveView(view);
     _button.OnAddAdaptiveView(view);
 }
示例#15
0
 internal void OnAddAdaptiveView(AdaptiveView view)
 {
     AddMasterStyle(view);
 }
示例#16
0
 internal virtual void OnAddAdaptiveView(AdaptiveView view)
 {
     AddWidgetStyle(view);
 }