private void InitializeShortcutEngine(IServiceProvider serviceProvider) { if (ShortcutQueryEngine == null) { ShortcutQueryEngine = VSShortcutQueryEngine.GetInstance(serviceProvider); } }
public AddKeyboardShortcut(IServiceProvider serviceProvider) { InitializeComponent(); _serviceProvider = serviceProvider; _queryEngine = new VSShortcutQueryEngine(_serviceProvider); cmbCommandList.ItemsSource = new CommandListViewModel(_serviceProvider).DataSource; cmbScopeList.ItemsSource = new ScopeListViewModel(_serviceProvider).DataSource; }
private string GetLocalizedShortcutText(ObservableCollection <BindingSequence> bindingSequences) { // Localize the binding sequence (ie. "Control+D8" => "Ctrl+8") VSShortcutQueryEngine queryEngine = VSShortcutsManager.VSShortcutsManager.Instance.queryEngine; if (queryEngine == null) { // Abort! System.Diagnostics.Debug.WriteLine("VSShortcutQueryEngine not initialized."); return(string.Join(", ", bindingSequences)); } return(queryEngine.GetLocalizedShortcutText(bindingSequences)); }
//Done for Sample. to be replaced with acutal code with list of all commands public ScopeListViewModel(IServiceProvider serviceProvider) { data = new List <ScopeList>(); VSShortcutQueryEngine queryEngine = new VSShortcutQueryEngine(serviceProvider); var allCommands = queryEngine.GetAllBindingScopesAsync().Result; foreach (var eachCommand in allCommands) { data.Add(new ScopeList() { Name = eachCommand.Name, Guid = eachCommand.Guid.ToString() }); } }
public IEnumerable <CommandList> DataSource(IServiceProvider serviceProvider) { data = new List <CommandList>(); VSShortcutQueryEngine queryEngine = new VSShortcutQueryEngine(serviceProvider); var allCommands = queryEngine.GetAllCommandsAsync().Result; foreach (var eachCommand in allCommands) { data.Add(new CommandList() { Name = eachCommand.DisplayName }); } return(data); }
//Done for Sample. to be replaced with acutal code with list of all commands public CommandListViewModel(IServiceProvider serviceProvider) { ThreadHelper.JoinableTaskFactory.Run(async() => { data = new List <CommandList>(); VSShortcutQueryEngine queryEngine = new VSShortcutQueryEngine(serviceProvider); var allCommands = await queryEngine.GetAllCommandsAsync(); foreach (var eachCommand in allCommands) { if (!string.IsNullOrEmpty(eachCommand.CanonicalName)) { CommandList item = new CommandList() { DisplayName = eachCommand.DisplayName, CommandName = eachCommand.CanonicalName }; data.Add(item); } } }); }