LanguagePreferences.OnUserPreferencesChanged2 Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Called when a user preference has been changed.
public:
virtual int OnUserPreferencesChanged2(cli::array <Microsoft::VisualStudio::TextManager::Interop::VIEWPREFERENCES2> ^ viewPrefs, cli::array <Microsoft::VisualStudio::TextManager::Interop::FRAMEPREFERENCES2> ^ framePrefs, cli::array <Microsoft::VisualStudio::TextManager::Interop::LANGPREFERENCES2> ^ langPrefs, cli::array <Microsoft::VisualStudio::TextManager::Interop::FONTCOLORPREFERENCES2> ^ fontColorPrefs);
virtual int OnUserPreferencesChanged2(std::Array <Microsoft::VisualStudio::TextManager::Interop::VIEWPREFERENCES2> const & viewPrefs, std::Array <Microsoft::VisualStudio::TextManager::Interop::FRAMEPREFERENCES2> const & framePrefs, std::Array <Microsoft::VisualStudio::TextManager::Interop::LANGPREFERENCES2> const & langPrefs, std::Array <Microsoft::VisualStudio::TextManager::Interop::FONTCOLORPREFERENCES2> const & fontColorPrefs);
public virtual int OnUserPreferencesChanged2 (Microsoft.VisualStudio.TextManager.Interop.VIEWPREFERENCES2[] viewPrefs, Microsoft.VisualStudio.TextManager.Interop.FRAMEPREFERENCES2[] framePrefs, Microsoft.VisualStudio.TextManager.Interop.LANGPREFERENCES2[] langPrefs, Microsoft.VisualStudio.TextManager.Interop.FONTCOLORPREFERENCES2[] fontColorPrefs);
abstract member OnUserPreferencesChanged2 : Microsoft.VisualStudio.TextManager.Interop.VIEWPREFERENCES2[] * Microsoft.VisualStudio.TextManager.Interop.FRAMEPREFERENCES2[] * Microsoft.VisualStudio.TextManager.Interop.LANGPREFERENCES2[] * Microsoft.VisualStudio.TextManager.Interop.FONTCOLORPREFERENCES2[] -> int
override this.OnUserPreferencesChanged2 : Microsoft.VisualStudio.TextManager.Interop.VIEWPREFERENCES2[] * Microsoft.VisualStudio.TextManager.Interop.FRAMEPREFERENCES2[] * Microsoft.VisualStudio.TextManager.Interop.LANGPREFERENCES2[] * Microsoft.VisualStudio.TextManager.Interop.FONTCOLORPREFERENCES2[] -> int
Public Overridable Function OnUserPreferencesChanged2 (viewPrefs As VIEWPREFERENCES2(), framePrefs As FRAMEPREFERENCES2(), langPrefs As LANGPREFERENCES2(), fontColorPrefs As FONTCOLORPREFERENCES2()) As Integer
Parameters
- viewPrefs
- VIEWPREFERENCES2[]
[in] A VIEWPREFERENCES2 structure describing user view preferences.
- framePrefs
- FRAMEPREFERENCES2[]
[in] A FRAMEPREFERENCES2 structure describing user frame-oriented preferences.
- langPrefs
- LANGPREFERENCES2[]
[in] A LANGPREFERENCES2 structure describing user language service-specific preferences.
- fontColorPrefs
- FONTCOLORPREFERENCES2[]
[in] A FONTCOLORPREFERENCES2 structure describing user font and color preferences.
Returns
Implements
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];
}
}
}
}
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 Microsoft.VisualStudio.TextManager.Interop.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.