private object OnButton(Button button) { var keys = ShortcutKeysUtil.Parse(button.Key); if (keys.Length > 0 && !ShortcutKeysUtil.IsValid(keys[0])) { throw new NetIdeException(String.Format(Labels.IllegalButtonShortcutKeys, button.Id, keys)); } INiCommandBarButton command; ErrorUtil.ThrowOnFailure(_commandManager.CreateCommandBarButton( button.Guid != Guid.Empty ? button.Guid : Guid.NewGuid(), button.Priority, button.Id, out command )); command.Text = _package.ResolveStringResource(button.Text); command.ToolTip = _package.ResolveStringResource(button.ToolTip); command.DisplayStyle = Enum <NiCommandDisplayStyle> .Parse(button.Style.ToString()); command.ShortcutKeys = keys.Length > 0 ? keys[0] : 0; ((NiCommandBarButton)command).Bitmap = ResolveBitmapResource(button.Image); return(command); }
private object OnButton(Button button) { var keys = ShortcutKeysUtil.Parse(button.Key); if (keys.Length > 0 && !ShortcutKeysUtil.IsValid(keys[0])) throw new NetIdeException(String.Format(Labels.IllegalButtonShortcutKeys, button.Id, keys)); INiCommandBarButton command; ErrorUtil.ThrowOnFailure(_commandManager.CreateCommandBarButton( button.Guid != Guid.Empty ? button.Guid : Guid.NewGuid(), button.Priority, button.Id, out command )); command.Text = _package.ResolveStringResource(button.Text); command.ToolTip = _package.ResolveStringResource(button.ToolTip); command.DisplayStyle = Enum<NiCommandDisplayStyle>.Parse(button.Style.ToString()); command.ShortcutKeys = keys.Length > 0 ? keys[0] : 0; ((NiCommandBarButton)command).Bitmap = ResolveBitmapResource(button.Image); return command; }