Udostępnij za pośrednictwem


Metoda LanguageService.GetIVsTextMacroHelperIfRecordingOn —

Zwraca IVsTextMacroHelper obiektu, jeśli jest włączona funkcja rejestrowania makr.

Przestrzeń nazw:  Microsoft.VisualStudio.Package
Zestawy:   Microsoft.VisualStudio.Package.LanguageService.9.0 (w Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (w Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (w Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (w Microsoft.VisualStudio.Package.LanguageService.dll)

Składnia

'Deklaracja
Public Function GetIVsTextMacroHelperIfRecordingOn As IVsTextMacroHelper
public IVsTextMacroHelper GetIVsTextMacroHelperIfRecordingOn()

Wartość zwracana

Typ: Microsoft.VisualStudio.TextManager.Interop.IVsTextMacroHelper
Jeśli się powiedzie, zwraca IVsTextMacroHelper obiektu; w przeciwnym razie zwraca wartość null.

Uwagi

IVsTextMacroHelper Obiektu jest uzyskane przez wywołanie LanguageService.GetService z identyfikatorem GUID SVsTextManager usługi i oddał zwracany obiekt do IVsTextMacroHelper obiektu.

Przykłady

Oto przykład, w jaki ta metoda jest zaimplementowana w bazie LanguageService klasy.

namespace Microsoft.VisualStudio.Package
{
    [CLSCompliant(false), ComVisible(true)]
    public abstract class LanguageService
        : IDisposable
        , IVsLanguageInfo
        , IVsLanguageDebugInfo
        , IVsProvideColorableItems
        , IVsLanguageContextProvider
        , IOleServiceProvider
        , IObjectWithSite
        , ISynchronizeInvoke
        , IVsDebuggerEvents
        , IVsFormatFilterProvider
    { 
        public IVsTextMacroHelper GetIVsTextMacroHelperIfRecordingOn()
        {
            if (IsMacroRecordingOn()) {
                IVsTextManager textmgr = (IVsTextManager)this.GetService(
                                             typeof(SVsTextManager));
                return (IVsTextMacroHelper)textmgr;
            }
            return null;
        }
    }
}

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

LanguageService Klasa

Przestrzeń nazw Microsoft.VisualStudio.Package