Example #1
0
        protected void AddTemplateLayoutMenuItems(IContextMenuView contextMenuView, IContainerBase containerBase)
        {
            string containerType = "Diagram";

            if (containerBase.IsAnImplementationOf <IContainerNode>())
            {
                containerType = "Container";
            }

            IHasLayoutInfo selectedNode = Presenter.GetFirstSelected <IContainerNode>();

            if (selectedNode != null)
            {
                SubMenuLayout.AddItem(CreateMenuButton.WithCaption("Apply Named Template to Selection...")
                                      .WithActionCommand(() => Presenter.ApplyLayoutTemplateToSelection()).AsGroupStarter());
            }
            else
            {
                SubMenuLayout.AddItem(CreateMenuButton.WithCaption("Apply Named Template to " + containerType + "...")
                                      .WithActionCommand(() => Presenter.ApplyLayoutTemplate(containerBase, "", false)));
            }

            SubMenuLayout.AddItem(CreateMenuButton.WithCaption("Apply Named Template to " + containerType + " Recursive...")
                                  .WithActionCommand(() => Presenter.ApplyLayoutTemplate(containerBase, "", true)));

            SubMenuLayout.AddItem(CreateMenuButton.WithCaption("Save " + containerType + " as Named Template...")
                                  .WithActionCommand(() => Presenter.SaveContainerToXml(containerBase, "")));
        }
Example #2
0
        protected void AddAutoLayoutMenuItems(IContextMenuView contextMenuView, IContainerBase containerBase)
        {
            if (containerBase == null)
            {
                return;
            }

            SubMenuLayout.AddItem(CreateMenuButton.WithCaption("AutoLayout Children").AsGroupStarter().WithActionCommand(() => Presenter.Layout(containerBase, AppConstants.Diagram.Base.LayoutDepthChildren, null)));
        }