本文整理汇总了C#中IVsCodeWindow.GetBuffer方法的典型用法代码示例。如果您正苦于以下问题:C# IVsCodeWindow.GetBuffer方法的具体用法?C# IVsCodeWindow.GetBuffer怎么用?C# IVsCodeWindow.GetBuffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVsCodeWindow
的用法示例。
在下文中一共展示了IVsCodeWindow.GetBuffer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCodeWindowManager
public int GetCodeWindowManager(IVsCodeWindow pCodeWin, out IVsCodeWindowManager ppCodeWinMgr)
{
var adaptersFactory = _serviceProvider.GetComponentModel().GetService<IVsEditorAdaptersFactoryService>();
IVsTextLines textLines;
ErrorHandler.ThrowOnFailure(pCodeWin.GetBuffer(out textLines));
var textBuffer = adaptersFactory.GetDataBuffer(textLines);
if (textBuffer == null)
{
ppCodeWinMgr = null;
return VSConstants.E_FAIL;
}
ppCodeWinMgr = _serviceProvider.GetHlslToolsService().GetOrCreateCodeWindowManager(pCodeWin);
return VSConstants.S_OK;
}
示例2:
int IVsLanguageInfo.GetCodeWindowManager(IVsCodeWindow pCodeWin, out IVsCodeWindowManager ppCodeWinMgr)
{
IVsTextLines lines;
IVsEditorAdaptersFactoryService service = this.ComponentModel.GetService<IVsEditorAdaptersFactoryService>();
ErrorHandler.ThrowOnFailure(pCodeWin.GetBuffer(out lines));
IVsTextBuffer bufferAdapter = lines;
ITextBuffer dataBuffer = service.GetDataBuffer(bufferAdapter);
if (dataBuffer == null)
{
ppCodeWinMgr = null;
return -2147467259;
}
ppCodeWinMgr = this.GetCodeWindowManager(pCodeWin, dataBuffer);
return 0;
}
示例3: GetCodeWindowManager
int IVsLanguageInfo.GetCodeWindowManager(IVsCodeWindow pCodeWin, out IVsCodeWindowManager ppCodeWinMgr)
{
IVsEditorAdaptersFactoryService adaptersFactory = ComponentModel.GetService<IVsEditorAdaptersFactoryService>();
IVsTextLines textLines;
ErrorHandler.ThrowOnFailure(pCodeWin.GetBuffer(out textLines));
ITextBuffer textBuffer = adaptersFactory.GetDataBuffer(textLines);
if (textBuffer == null)
{
ppCodeWinMgr = null;
return VSConstants.E_FAIL;
}
ppCodeWinMgr = GetCodeWindowManager(pCodeWin, textBuffer);
return VSConstants.S_OK;
}
示例4: GetCodeWindowManager
// GetCodeWindowManager -- this gives us the VsCodeWindow which is what we need to
// add adornments and so forth.
/// <include file='doc\LanguageService.uex' path='docs/doc[@for="LanguageService.GetCodeWindowManager"]/*' />
public int GetCodeWindowManager(IVsCodeWindow codeWindow, out IVsCodeWindowManager mgr) {
Initialize();
IVsTextLines buffer = null;
NativeMethods.ThrowOnFailure(codeWindow.GetBuffer(out buffer));
mgr = CreateCodeWindowManager(codeWindow, GetOrCreateSource(buffer));
return NativeMethods.S_OK;
}
示例5: GetCodeWindowManager
// GetCodeWindowManager -- this gives us the VsCodeWindow which is what we need to
// add adornments and so forth.
/// <include file='doc\LanguageService.uex' path='docs/doc[@for="LanguageService.GetCodeWindowManager"]/*' />
public int GetCodeWindowManager(IVsCodeWindow codeWindow, out IVsCodeWindowManager mgr)
{
//set the inheritKeyBinding guid so that navigation keys work. Do this before deriving class's
//CreateCodeWindowManager method gets called, so they may override if required
IOleServiceProvider sp = codeWindow as IOleServiceProvider;
if (sp != null) {
ServiceProvider site = new ServiceProvider(sp);
object window = site.GetService(typeof(IVsWindowFrame).GUID);
if (window is IVsWindowFrame) {
IVsWindowFrame frame = (IVsWindowFrame)window;
Guid CMDUIGUID_TextEditor = new Guid(0x8B382828, 0x6202, 0x11d1, 0x88, 0x70, 0x00, 0x00, 0xF8, 0x75, 0x79, 0xD2);
NativeMethods.ThrowOnFailure(frame.SetGuidProperty((int)__VSFPROPID.VSFPROPID_InheritKeyBindings, ref CMDUIGUID_TextEditor));
}
}
Initialize();
IVsTextLines buffer = null;
NativeMethods.ThrowOnFailure(codeWindow.GetBuffer(out buffer));
mgr = CreateCodeWindowManager(codeWindow, GetOrCreateSource(buffer));
return NativeMethods.S_OK;
}