LanguagePreferences.OnUserPreferencesChanged2 Method
Called when a user preference has been changed.
Namespace: Microsoft.VisualStudio.Package
Assemblies: Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.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)
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
)
abstract OnUserPreferencesChanged2 :
viewPrefs:VIEWPREFERENCES2[] *
framePrefs:FRAMEPREFERENCES2[] *
langPrefs:LANGPREFERENCES2[] *
fontColorPrefs:FONTCOLORPREFERENCES2[] -> int
override OnUserPreferencesChanged2 :
viewPrefs:VIEWPREFERENCES2[] *
framePrefs:FRAMEPREFERENCES2[] *
langPrefs:LANGPREFERENCES2[] *
fontColorPrefs:FONTCOLORPREFERENCES2[] -> int
public function OnUserPreferencesChanged2(
viewPrefs : VIEWPREFERENCES2[],
framePrefs : FRAMEPREFERENCES2[],
langPrefs : LANGPREFERENCES2[],
fontColorPrefs : FONTCOLORPREFERENCES2[]
) : int
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
Implements
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];
}
}
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.