Bloom.Edit.EditingModel.ChangePageLayout C# (CSharp) Method

ChangePageLayout() private method

private ChangePageLayout ( IPage page ) : void
page IPage
return void
        internal void ChangePageLayout(IPage page)
        {
            PageChangingLayout = page;
            SaveNow();// need to preserve any typing they've done but not yet saved
            _view.ShowChangeLayoutDialog(page);
        }

Usage Example

示例#1
0
        public PageListView(PageSelection pageSelection,  RelocatePageEvent relocatePageEvent, EditingModel model,
			HtmlThumbNailer thumbnailProvider, NavigationIsolator isolator, ControlKeyEvent controlKeyEvent)
        {
            _pageSelection = pageSelection;
            _model = model;
            this.Font= SystemFonts.MessageBoxFont;
            InitializeComponent();

            _thumbNailList.Thumbnailer = thumbnailProvider;
            _thumbNailList.CanSelect = true;
            _thumbNailList.PreferPageNumbers = true;
            _thumbNailList.KeepShowingSelection = true;
            _thumbNailList.RelocatePageEvent = relocatePageEvent;
            _thumbNailList.PageSelectedChanged+=new EventHandler(OnPageSelectedChanged);
            _thumbNailList.Isolator = isolator;
            _thumbNailList.ControlKeyEvent = controlKeyEvent;
            // First action determines whether the menu item is enabled, second performs it.
            var menuItems = new List<WebThumbNailList.MenuItemSpec>();
            menuItems.Add(
                new WebThumbNailList.MenuItemSpec() {
                    Label = LocalizationManager.GetString("EditTab.DuplicatePageButton", "Duplicate Page"), // same ID as button in toolbar));
                    EnableFunction = (page) => page != null && !page.Required && !_model.CurrentBook.LockedDown,
                    ExecuteCommand = (page) => _model.DuplicatePage(page)});
            menuItems.Add(
                new WebThumbNailList.MenuItemSpec() {
                    Label = LocalizationManager.GetString("EditTab.DeletePageButton", "Remove Page"),  // same ID as button in toolbar));
                    EnableFunction = (page) => page != null && !page.Required && !_model.CurrentBook.LockedDown,
                    ExecuteCommand = (page) =>
                    {
                        if (ConfirmRemovePageDialog.Confirm())
                            _model.DeletePage(page);
                    }});
            menuItems.Add(
                new WebThumbNailList.MenuItemSpec() {
                    Label = LocalizationManager.GetString("EditTab.ChooseLayoutButton", "Choose Different Layout"),
                    EnableFunction = (page) => page != null && !page.Required && !_model.CurrentBook.LockedDown,
                    ExecuteCommand = (page) => _model.ChangePageLayout(page)});
            // This adds the desired menu items to the Gecko context menu that happens when we right-click
            _thumbNailList.ContextMenuProvider = args =>
            {
                var page = _thumbNailList.GetPageContaining(args.TargetNode);
                if (page == null)
                    return true; // no page-related commands if we didn't click on one.
                if(page != _pageSelection.CurrentSelection)
                {
                    return true; //it's too dangerous to let users do thing to a page they aren't seeing
                }
                foreach (var item in menuItems)
                {
                    var menuItem = new MenuItem(item.Label, (sender, eventArgs) => item.ExecuteCommand(page));
                    args.ContextMenu.MenuItems.Add(menuItem);
                    menuItem.Enabled = item.EnableFunction(page);
                }
                return true;
            };
            // This sets up the context menu items that will be shown when the user clicks the
            // arrow in the thumbnail list.
            _thumbNailList.ContextMenuItems = menuItems;
        }
All Usage Examples Of Bloom.Edit.EditingModel::ChangePageLayout