Exemplo n.º 1
0
        private PageEditorViewModel OpenSwipePage(IWidget widget, Guid childPageGID, Guid SelWdgGID, bool bIsSelect, bool bIsGroup)
        {
            PageEditorViewModel newPage           = null;
            ISelectionService   _selectionService = ServiceLocator.Current.GetInstance <SelectionServiceProvider>();
            IPagePropertyData   activePage        = _selectionService.GetCurrentPage();

            Guid parentGID = widget.ParentPage.Guid;

            if (widget.WidgetType != WidgetType.DynamicPanel)
            {
                return(null);
            }


            //Active an exist page editor,20140220
            DynamicPageEditorViewModel CurrentDynmicPanel = null;

            foreach (var pageItem in EditPages.OfType <DynamicPageEditorViewModel>())
            {
                if (pageItem.ContentId == widget.Guid.ToString())
                {
                    CurrentDynmicPanel = pageItem;
                    if (pageItem.ActivePage.Guid == childPageGID)
                    {
                        pageItem.IsActive = true;
                        return(pageItem);
                    }
                    break;
                }
            }

            //Only Update the target panel
            if (CurrentDynmicPanel != null)
            {
                //TODO:???????
                CurrentDynmicPanel.IsActive = true;
                foreach (DynamicChildNodViewModel item in CurrentDynmicPanel.DynamicChildren)
                {
                    if (item.GID == childPageGID)
                    {
                        CurrentDynmicPanel.WdgMgrSetTargeComponent(SelWdgGID, bIsSelect, bIsGroup);
                        item.IsChecked = true;
                        break;
                    }
                }
                return(null);
            }

            DeselectAllPages();

            //Create a new page with target panel
            newPage = new DynamicPageEditorViewModel(widget, childPageGID);
            newPage.WdgMgrSetTargeComponent(SelWdgGID, bIsSelect, bIsGroup);

            //if child page is not set(value is 100%)
            //Set scale the same as parent page(only create child page, not active child page)
            if (newPage.EditorScale == 1)
            {
                newPage.EditorScale = activePage.EditorScale;
            }
            newPage.Open();
            EditPages.Add(newPage);
            newPage.IsActive = true;
            newPage.Update();
            return(null);
        }
Exemplo n.º 2
0
        private PageEditorViewModel OpenWidgetPage(IWidget widget, Guid SelWdgGID, bool bIsSelect, bool bIsgroup)
        {
            PageEditorViewModel newPage           = null;
            ISelectionService   _selectionService = ServiceLocator.Current.GetInstance <SelectionServiceProvider>();
            IPagePropertyData   activePage        = _selectionService.GetCurrentPage();

            Guid parentGID = widget.ParentPage.Guid;

            switch (widget.WidgetType)
            {
            case WidgetType.DynamicPanel:
            {
                //Active an exist page editor,20140220
                foreach (var pageItem in EditPages.OfType <DynamicPageEditorViewModel>())
                {
                    if (pageItem.ContentId == widget.Guid.ToString())
                    {
                        pageItem.IsActive = true;
                        return(pageItem);
                    }
                }

                ////Create a new page editor,20140220
                newPage = new DynamicPageEditorViewModel(widget);
                newPage.WdgMgrSetTargeComponent(SelWdgGID, bIsSelect, bIsgroup);
                break;
            }

            case WidgetType.Toast:
            {
                foreach (var pageItem in EditPages.OfType <ToastPageEditorViewModel>())
                {
                    if (pageItem.ContentId == widget.Guid.ToString())
                    {
                        pageItem.IsActive = true;
                        return(pageItem);
                    }
                }

                newPage = new ToastPageEditorViewModel(widget);
                newPage.WdgMgrSetTargeComponent(SelWdgGID, bIsSelect, bIsgroup);
                break;
            }

            case WidgetType.HamburgerMenu:
            {
                //Active an exist page editor,20140220
                foreach (var pageItem in EditPages.OfType <HamburgerPageEditorViewModel>())
                {
                    if (pageItem.ContentId == widget.Guid.ToString())
                    {
                        pageItem.IsActive = true;
                        return(pageItem);
                    }
                }
                //Create a new page editor,20140220
                newPage = new HamburgerPageEditorViewModel(widget);
                newPage.WdgMgrSetTargeComponent(SelWdgGID, bIsSelect, bIsgroup);
                break;
            }
            }

            DeselectAllPages();

            //if child page is not set(value is 100%)
            //Set scale the same as parent page(only create child page, not active child page)
            if (newPage.EditorScale == 1)
            {
                newPage.EditorScale = activePage.EditorScale;
            }
            newPage.Open();
            EditPages.Add(newPage);
            newPage.IsActive = true;
            newPage.Update();
            return(null);
        }