Inheritance: UiObject, IUiContainer
Exemple #1
0
        private object CreateCommandBarPopup(Menu menu)
        {
            INiCommandBarPopup popup;

            ErrorUtil.ThrowOnFailure(_commandManager.CreateCommandBarPopup(
                                         menu.Guid != Guid.Empty ? menu.Guid : Guid.NewGuid(),
                                         menu.Priority,
                                         out popup
                                         ));

            popup.Text         = _package.ResolveStringResource(menu.Text);
            popup.DisplayStyle = Enum <NiCommandDisplayStyle> .Parse(menu.Style.ToString());

            ((NiCommandBarPopup)popup).Bitmap = ResolveBitmapResource(menu.Image);

            foreach (INiCommandBarGroup group in Build(menu.Items))
            {
                ErrorUtil.ThrowOnFailure(popup.Controls.Add(@group));
            }

            return(popup);
        }
Exemple #2
0
        private object CreateCommandBar(Menu menu)
        {
            INiCommandBar commandBar;
            ErrorUtil.ThrowOnFailure(_commandManager.CreateCommandBar(
                menu.Guid != Guid.Empty ? menu.Guid : Guid.NewGuid(),
                Enum<NiCommandBarKind>.Parse(menu.Kind.ToString()),
                menu.Priority,
                out commandBar
            ));

            commandBar.Text = _package.ResolveStringResource(menu.Text);
            commandBar.DisplayStyle = Enum<NiCommandDisplayStyle>.Parse(menu.Style.ToString());
            ((NiCommandBar)commandBar).Bitmap = ResolveBitmapResource(menu.Image);

            foreach (INiCommandBarGroup group in Build(menu.Items))
            {
                ErrorUtil.ThrowOnFailure(commandBar.Controls.Add(@group));
            }

            return commandBar;
        }
Exemple #3
0
 private object OnMenu(Menu menu)
 {
     return menu.Kind == MenuKind.Popup
         ? CreateCommandBarPopup(menu)
         : CreateCommandBar(menu);
 }
Exemple #4
0
 private object OnMenu(Menu menu)
 {
     return(menu.Kind == MenuKind.Popup
         ? CreateCommandBarPopup(menu)
         : CreateCommandBar(menu));
 }