Partager via


Package.IVsUserSettings.ImportSettings Method

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Retrieves a VSPackage's configuration using the Visual Studio settings mechanism when a user selects the import option of the Import/Export Settings feature on the IDE’s Tools menu. This method is part of the implementation of the IVsUserSettings interface used to manage profiles and import/export settings to XML files.

Namespace:  Microsoft.VisualStudio.Shell
Assemblies:   Microsoft.VisualStudio.Shell.9.0 (in Microsoft.VisualStudio.Shell.9.0.dll)
  Microsoft.VisualStudio.Shell (in Microsoft.VisualStudio.Shell.dll)
  Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)

Syntax

'Déclaration
Private Function ImportSettings ( _
    strPageGuid As String, _
    reader As IVsSettingsReader, _
    flags As UInteger, _
    ByRef restartRequired As Integer _
) As Integer Implements IVsUserSettings.ImportSettings
'Utilisation
Dim instance As Package
Dim strPageGuid As String
Dim reader As IVsSettingsReader
Dim flags As UInteger
Dim restartRequired As Integer
Dim returnValue As Integer

returnValue = CType(instance, IVsUserSettings).ImportSettings(strPageGuid, _
    reader, flags, restartRequired)
int IVsUserSettings.ImportSettings(
    string strPageGuid,
    IVsSettingsReader reader,
    uint flags,
    ref int restartRequired
)
private:
virtual int ImportSettings(
    String^ strPageGuid, 
    IVsSettingsReader^ reader, 
    unsigned int flags, 
    int% restartRequired
) sealed = IVsUserSettings::ImportSettings
private abstract ImportSettings : 
        strPageGuid:string * 
        reader:IVsSettingsReader * 
        flags:uint32 * 
        restartRequired:int byref -> int 
private override ImportSettings : 
        strPageGuid:string * 
        reader:IVsSettingsReader * 
        flags:uint32 * 
        restartRequired:int byref -> int 
JScript does not support explicit interface implementations.

Parameters

  • restartRequired
    Type: System.Int32%
    true if the Visual Studio IDE must be restarted.

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Implements

IVsUserSettings.ImportSettings(String, IVsSettingsReader, UInt32, Int32%)

Remarks

ImportSettings searches the package object looking for ProvideProfileAttribute classes. If the object specified in ProvideProfileAttribute corresponds to the GUID passed into ImportSettings, then the IProfileManager interface of that object is retrieved. If necessary the object implementing IProfileManager is created. If the IProfileManager interface cannot be retrieved, then ImportSettings returns immediately.

If the IProfileManager interface is retrieved, then the object’s LoadSettingsFromXml method is called to import the settings from the IVsSettingsReader passed to it by Visual Studio.

The SaveSettingsToStorage method is then called to immediately store the settings imported.

.NET Framework Security

See Also

Reference

Package Class

Package Members

Microsoft.VisualStudio.Shell Namespace