Condividi tramite


Metodo LanguagePreferences.OnRegisterMarkerType

Chiamato quando un nuovo tipo del marcatore viene registrato con Visual Studio.

Spazio dei nomi:  Microsoft.VisualStudio.Package
Assembly:   Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)

Sintassi

'Dichiarazione
Public Overridable Function OnRegisterMarkerType ( _
    iMarkerType As Integer _
) As Integer
public virtual int OnRegisterMarkerType(
    int iMarkerType
)

Parametri

  • iMarkerType
    Tipo: System.Int32
    [in] ID del tipo del marcatore.

Valore restituito

Tipo: System.Int32

Implementa

IVsTextManagerEvents2.OnRegisterMarkerType(Int32)

Note

Questo metodo viene chiamato ogni volta che un nuovo tipo del marcatore viene registrato.chiamare GetMarkerTypeInterface metodo con il marcatore specificato ID per ottenere IVsTextMarkerType l'oggetto che è possibile eseguire una query per informazioni dettagliate sul nuovo tipo del marcatore.un servizio di linguaggio in genere non deve implementare questo metodo.

questo metodo è un'implementazione di IVsTextManagerEvents2.OnRegisterMarkerType.

Il metodo di base non esegue alcuna operazione.

Esempi

Di seguito è riportato un esempio di come ottenere IVsTextManager2 collegare e ottenere il tipo del marcatore.

using Microsoft.VisualStudio.Package;

namespace MyLanguagePackage
{
    class MyLanguagePreferences : LanguagePreferences
    {
        override public void OnRegisterMarkerType(int iMarkerType)
        {
            IVsTextManager2 pTextManager;
            pTextManager = Site.GetService(typeof(SVsTextManager)) as IVsTextManager2;
            if (pTextManager != null)
            {
                IVsTextMarkerType pMarkerType;
                pTextManager.GetMarkerTypeInterface(iMarkerType,out pMarkerType);
                if (pMarkerType != null)
                {
                    // Examine marker type here.
                }
            }
        }
    }
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

LanguagePreferences Classe

Spazio dei nomi Microsoft.VisualStudio.Package