LanguagePreferences::OnUserPreferencesChanged2 Method (array<VIEWPREFERENCES2>^, array<FRAMEPREFERENCES2>^, array<LANGPREFERENCES2>^, array<FONTCOLORPREFERENCES2>^)

 

Called when a user preference has been changed.

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

public:
virtual int OnUserPreferencesChanged2(
	array<VIEWPREFERENCES2>^ viewPrefs,
	array<FRAMEPREFERENCES2>^ framePrefs,
	array<LANGPREFERENCES2>^ langPrefs,
	array<FONTCOLORPREFERENCES2>^ fontColorPrefs
)

Parameters

viewPrefs
Type: array<Microsoft.VisualStudio.TextManager.Interop::VIEWPREFERENCES2>^

[in] A VIEWPREFERENCES2 structure describing user view preferences.

framePrefs
Type: array<Microsoft.VisualStudio.TextManager.Interop::FRAMEPREFERENCES2>^

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

langPrefs
Type: array<Microsoft.VisualStudio.TextManager.Interop::LANGPREFERENCES2>^

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

fontColorPrefs
Type: array<Microsoft.VisualStudio.TextManager.Interop::FONTCOLORPREFERENCES2>^

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

Return Value

Type: System::Int32

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.

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];
            }
        }
    }
}
Return to top
Show: