LanguagePreferences.OnUserPreferencesChanged2 Method

Called when a user preference has been changed.

Namespace:  Microsoft.VisualStudio.Package
Assembly:  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)

Syntax

'宣言
Public Overridable Function OnUserPreferencesChanged2 ( _
    viewPrefs As VIEWPREFERENCES2(), _
    framePrefs As FRAMEPREFERENCES2(), _
    langPrefs As LANGPREFERENCES2(), _
    fontColorPrefs As FONTCOLORPREFERENCES2() _
) As Integer
'使用
Dim instance As LanguagePreferences
Dim viewPrefs As VIEWPREFERENCES2()
Dim framePrefs As FRAMEPREFERENCES2()
Dim langPrefs As LANGPREFERENCES2()
Dim fontColorPrefs As FONTCOLORPREFERENCES2()
Dim returnValue As Integer

returnValue = instance.OnUserPreferencesChanged2(viewPrefs, _
    framePrefs, langPrefs, fontColorPrefs)
public virtual int OnUserPreferencesChanged2(
    VIEWPREFERENCES2[] viewPrefs,
    FRAMEPREFERENCES2[] framePrefs,
    LANGPREFERENCES2[] langPrefs,
    FONTCOLORPREFERENCES2[] fontColorPrefs
)
public:
virtual int OnUserPreferencesChanged2(
    array<VIEWPREFERENCES2>^ viewPrefs, 
    array<FRAMEPREFERENCES2>^ framePrefs, 
    array<LANGPREFERENCES2>^ langPrefs, 
    array<FONTCOLORPREFERENCES2>^ fontColorPrefs
)
public function OnUserPreferencesChanged2(
    viewPrefs : VIEWPREFERENCES2[], 
    framePrefs : FRAMEPREFERENCES2[], 
    langPrefs : LANGPREFERENCES2[], 
    fontColorPrefs : FONTCOLORPREFERENCES2[]
) : int

Parameters

  • viewPrefs
    Type: []

    [in] A VIEWPREFERENCES2 structure describing user view preferences.

  • framePrefs
    Type: []

    [in] A FRAMEPREFERENCES2 structure describing user frame-oriented preferences.

  • langPrefs
    Type: []

    [in] A LANGPREFERENCES2 structure describing user language service-specific preferences.

  • fontColorPrefs
    Type: []

    [in] A FONTCOLORPREFERENCES2 structure describing user font and color preferences.

Return Value

Type: System.Int32

Implements

IVsTextManagerEvents2.OnUserPreferencesChanged2([], [], [], [])

Remarks

This method is called whenever any user preferences are modified. A language service typically concerns itself with the langPrefs. It may deal with fontColorPrefs, but only if the language service owns the color provider specified in the FONTCOLORPREFERENCES2 structure.

This method is an implementation of IVsTextManagerEvents2.OnUserPreferencesChanged2.

The base method stores only the langPrefs but only if the language GUID of the preferences specified in langPrefs matches the GUID of the language service.

Examples

This example is the managed package framework's implementation of this method and shows how to test for ownership of the language preferences.

namespace Microsoft.VisualStudio.Package
{
    [CLSCompliant(false),ComVisible(true)]
    public class LanguagePreferences : IVsTextManagerEvents2, IDisposable
    {
        public virtual void OnUserPreferencesChanged2(
                                       VIEWPREFERENCES2[] viewPrefs,
                                       FRAMEPREFERENCES2[] framePrefs,
                                       LANGPREFERENCES2[] langPrefs,
                                       FONTCOLORPREFERENCES2[] fontColorPrefs)
        {
            if (langPrefs != null &&
                langPrefs.Length > 0 &&
                langPrefs[0].guidLang == this.langSvc)
            {
                this.prefs = langPrefs[0];
            }
        }
    }
}

Permissions

See Also

Reference

LanguagePreferences Class

LanguagePreferences Members

Microsoft.VisualStudio.Package Namespace