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); }
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; }
private object OnMenu(Menu menu) { return menu.Kind == MenuKind.Popup ? CreateCommandBarPopup(menu) : CreateCommandBar(menu); }
private object OnMenu(Menu menu) { return(menu.Kind == MenuKind.Popup ? CreateCommandBarPopup(menu) : CreateCommandBar(menu)); }