示例#1
0
        private bool TryCreateDropdownBarClient(out int comboBoxCount, out IVsDropdownBarClient client)
        {
            var componentModel            = ServiceProvider.GetComponentModel();
            var editorAdaptersFactory     = componentModel.DefaultExportProvider.GetExportedValueOrDefault <IVsEditorAdaptersFactoryService>();
            var bufferGraphFactoryService = componentModel.DefaultExportProvider.GetExportedValue <IBufferGraphFactoryService>();

            var textView = editorAdaptersFactory.GetWpfTextView(CodeWindow.GetPrimaryView());

            var editorNavigationSourceProvider = componentModel.DefaultExportProvider.GetExportedValueOrDefault <EditorNavigationSourceProvider>();
            var editorNavigationSource         = editorNavigationSourceProvider.TryCreateEditorNavigationSource(textView.TextBuffer);

            comboBoxCount = 2;
            client        = new EditorNavigationDropdownBarClient(CodeWindow, editorAdaptersFactory, editorNavigationSource, bufferGraphFactoryService);

            return(true);
        }
        private bool TryCreateDropdownBarClient(out int comboBoxCount, out IVsDropdownBarClient client)
        {
            var componentModel = ServiceProvider.GetComponentModel();
            var editorAdaptersFactory = componentModel.DefaultExportProvider.GetExportedValueOrDefault<IVsEditorAdaptersFactoryService>();
            var bufferGraphFactoryService = componentModel.DefaultExportProvider.GetExportedValue<IBufferGraphFactoryService>();

            var textView = editorAdaptersFactory.GetWpfTextView(CodeWindow.GetPrimaryView());

            var editorNavigationSourceProvider = componentModel.DefaultExportProvider.GetExportedValueOrDefault<EditorNavigationSourceProvider>();
            var editorNavigationSource = editorNavigationSourceProvider.TryCreateEditorNavigationSource(textView.TextBuffer);

            comboBoxCount = 2;
            client = new EditorNavigationDropdownBarClient(CodeWindow, editorAdaptersFactory, editorNavigationSource, bufferGraphFactoryService);

            return true;
        }