ProvideProfileAttribute Constructor
Initializes a new instance of ProvideProfileAttribute.
Namespace: Microsoft.VisualStudio.Shell
Assemblies: Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)
Microsoft.VisualStudio.Shell (in Microsoft.VisualStudio.Shell.dll)
Microsoft.VisualStudio.Shell.9.0 (in Microsoft.VisualStudio.Shell.9.0.dll)
Syntax
'Déclaration
Public Sub New ( _
objectType As Type, _
categoryName As String, _
objectName As String, _
categoryResourceID As Short, _
objectNameResourceID As Short, _
isToolsOptionPage As Boolean _
)
'Utilisation
Dim objectType As Type
Dim categoryName As String
Dim objectName As String
Dim categoryResourceID As Short
Dim objectNameResourceID As Short
Dim isToolsOptionPage As Boolean
Dim instance As New ProvideProfileAttribute(objectType, _
categoryName, objectName, categoryResourceID, _
objectNameResourceID, isToolsOptionPage)
public ProvideProfileAttribute(
Type objectType,
string categoryName,
string objectName,
short categoryResourceID,
short objectNameResourceID,
bool isToolsOptionPage
)
public:
ProvideProfileAttribute(
Type^ objectType,
String^ categoryName,
String^ objectName,
short categoryResourceID,
short objectNameResourceID,
bool isToolsOptionPage
)
new :
objectType:Type *
categoryName:string *
objectName:string *
categoryResourceID:int16 *
objectNameResourceID:int16 *
isToolsOptionPage:bool -> ProvideProfileAttribute
public function ProvideProfileAttribute(
objectType : Type,
categoryName : String,
objectName : String,
categoryResourceID : short,
objectNameResourceID : short,
isToolsOptionPage : boolean
)
Parameters
- objectType
Type: System.Type
The Type of the class implementing Visual Studio settings support.
- categoryName
Type: System.String
The canonical, nonlocalized name of a Visual Studio settings category.
- objectName
Type: System.String
The canonical, nonlocalized name used to identify the object implementing a Visual Studio settings category.
- categoryResourceID
Type: System.Int16
The localized resource ID of a Visual Studio settings category's name.
- objectNameResourceID
Type: System.Int16
The localized resource ID of the name used to identify the object implementing a Visual Studio settings category.
- isToolsOptionPage
Type: System.Boolean
This argument is not implemented.
Remarks
The ProvideProfileAttribute constructor uses the GUID obtained from objectType to uniquely identify a Custom Settings Point's Visual Studio settings category.
If isToolsOptionPage is true,the ProvideOptionPageAttribute must also be applied to the VSPackage.
Custom Settings Points are created within a registry entry containing the canonical name of the form <CategoryName>_<ObjectName>.
The registry key is found under HKLM\Software\Microsoft\VisualStudio\<Version>\UserSettings where <Version> is the version of Visual Studio, for example 8.0.
The registry entry under <CategoryName>_<ObjectName> is of the form:
<CategoryName>_<ObjectName>
<CategoryName>_<ObjectName>\@=#<ObjectNameResourceID>
<CategoryName>_<ObjectName>\Package=<Package>
<CategoryName>_<ObjectName>\Category=<ObjectTypeGuid>
<CategoryName>_<ObjectName>\AlternateParent =<CategoryName>
Notes
The last entry above (<CategoryName>_<ObjectName>\AlternateParent) is created only if isToolsOptionPage is true.
Examples
The example below shows the registration of two classes providing Visual Studio settings, one of which (DesignerOptionsPage) provides Tools Options page support. The Package and category GUIDs are obtained by the attribute by reflection.
The Custom Settings Point for the page named "DesignerOptionsPage" are:
MyDesigner_OptionPage
MyDesigner_OptionPage\@=#1003
MyDesigner_OptionPage\Package={"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"}
MyDesigner_OptionPage\Category={"YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY"}
MyDesigner_OptionPage\AlternateParent =MyDesigner
Notes
The last entry above, (UserSettings\MyDesigner_OptionPage\AlternateParent), is present because isToolsOptionPage is true.
The Custom Settings Point for the page named "PersistCurrentDesign" are:
MyDesigner_CurrentDesign
MyDesigner_CurrentDesign\@=#1005>
MyDesigner_CurrentDesign\Package={"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"}
MyDesigner_CurrentDesign\Category={"ZZZZZZZZ-ZZZZ-ZZZZ-ZZZZ-ZZZZZZZZZZZZ"}>
Notes
There is no (MyDesigner_ObjectName>\AlternateParent) because isToolsOptionPage is false.
The sample code below illustrates how DesignerOptionsPage is registered using the ProvideProfileAttribute.
using Microsoft.VisualStudio.Shell;
namespace Example
{
[DefaultRegistryRoot("Software\\Microsoft\\VisualStudio\\8.0")]
[ProvideOptionPage(typeof(DesignerOptionsPage), "MyDesigner", "OptionPage", 1000, 1001, true)]
[ProvideProfileAttribute(typeof(DesignerOptionsPage), "MyDesigner", "OptionPage", 1002, 1003, true)]
[ProvideProfileAttribute(typeof(PersistCurrentDesign), "MyDesigner","CurrentDesign", 1004, 1005, false)]
[Guid("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")]
public class MyPackage : Package
{
//Implementation here
}
[Guid("YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY")]
internal class DesignerOptionsPage: DialogPage {
//Implementation here
}
[Guid("ZZZZZZZZ-ZZZZ-ZZZZ-ZZZZ-ZZZZZZZZZZZZ")]
internal class PersisteDesignerState: IProfileManager {
//Implementation here
.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.
See Also
Reference
ProvideProfileAttribute Members
Microsoft.VisualStudio.Shell Namespace