Esempio n. 1
0
        private static IEnumerable <CommandKeyBinding> GetCommandKeyBindingsHelper(DteCommand command)
        {
            CommandId commandId;

            if (!command.TryGetCommandId(out commandId))
            {
                yield break;
            }

            foreach (var cur in command.GetBindings())
            {
                KeyBinding binding;
                if (KeyBinding.TryParse(cur, out binding))
                {
                    yield return(new CommandKeyBinding(commandId, command.Name, binding));
                }
            }
        }
Esempio n. 2
0
        private static IEnumerable <CommandKeyBinding> GetCommandKeyBindingsHelper(DteCommand command)
        {
            if (!command.TryGetCommandId(out CommandId commandId))
            {
                yield break;
            }

            foreach (var cur in command.GetBindings())
            {
                if (KeyBinding.TryParse(cur, out KeyBinding binding))
                {
                    var name = command.Name;
                    if (string.IsNullOrEmpty(name))
                    {
                        name = $"<Unnamed> {commandId.Id}";
                    }

                    yield return(new CommandKeyBinding(commandId, name, binding));
                }
            }
        }