Ejemplo n.º 1
0
		private static IContainerMenuItem CreateMenuItem(
			ContainerMenuItemType type,
			IList<IContainerMenuItem> items)
		{
			switch (type)
			{
				case ContainerMenuItemType.Menu:
					var firstMenu = (IMenu)items[0];
					return new Menu(
						firstMenu.Name,
						MergeMenuGroups(items.SelectMany(c => c.Groups)),
						firstMenu.Text,
						firstMenu.Image,
						firstMenu.Description,
						firstMenu.DisplayStyle,
						firstMenu.OrderIndex);
				case ContainerMenuItemType.SplitButton:
					var firstSplitButton = (IMenuSplitButton)items[0];
					return new MenuSplitButton(
						firstSplitButton.Name,
						MergeMenuGroups(items.SelectMany(c => c.Groups)),
						firstSplitButton.CommandName,
						firstSplitButton.Parameters,
						firstSplitButton.Text,
						firstSplitButton.Image,
						firstSplitButton.Description,
						firstSplitButton.DisplayStyle,
						firstSplitButton.OrderIndex);
			}
			throw new NotSupportedException();
		}
Ejemplo n.º 2
0
        private static IContainerMenuItem CreateMenuItem(
            ContainerMenuItemType type,
            IList <IContainerMenuItem> items)
        {
            switch (type)
            {
            case ContainerMenuItemType.Menu:
                var firstMenu = (IMenu)items[0];
                return(new Menu(
                           firstMenu.Name,
                           MergeMenuGroups(items.SelectMany(c => c.Groups)),
                           firstMenu.Text,
                           firstMenu.Image,
                           firstMenu.Description,
                           firstMenu.DisplayStyle,
                           firstMenu.OrderIndex));

            case ContainerMenuItemType.SplitButton:
                var firstSplitButton = (IMenuSplitButton)items[0];
                return(new MenuSplitButton(
                           firstSplitButton.Name,
                           MergeMenuGroups(items.SelectMany(c => c.Groups)),
                           firstSplitButton.CommandName,
                           firstSplitButton.Parameters,
                           firstSplitButton.Text,
                           firstSplitButton.Image,
                           firstSplitButton.Description,
                           firstSplitButton.DisplayStyle,
                           firstSplitButton.OrderIndex));
            }
            throw new NotSupportedException();
        }
Ejemplo n.º 3
0
 public ContainerMergingInfo(
     ContainerMenuItemType containerType,
     IContainerMenuItem initialElement)
 {
     ContainerType     = containerType;
     ContainersToMerge = new List <IContainerMenuItem> {
         initialElement
     };
 }
Ejemplo n.º 4
0
			public ContainerMergingInfo(
				ContainerMenuItemType containerType,
				IContainerMenuItem initialElement)
			{
				ContainerType = containerType;
				ContainersToMerge = new List<IContainerMenuItem> { initialElement };
			}