다음을 통해 공유


ProvideProfileAttribute(Type, String, String, Int16, Int16, Boolean) Constructor

Definition

Initializes a new instance of ProvideProfileAttribute.

public:
 ProvideProfileAttribute(Type ^ objectType, System::String ^ categoryName, System::String ^ objectName, short categoryResourceID, short objectNameResourceID, bool isToolsOptionPage);
public:
 ProvideProfileAttribute(Platform::Type ^ objectType, Platform::String ^ categoryName, Platform::String ^ objectName, short categoryResourceID, short objectNameResourceID, bool isToolsOptionPage);
public ProvideProfileAttribute (Type objectType, string categoryName, string objectName, short categoryResourceID, short objectNameResourceID, bool isToolsOptionPage);
new Microsoft.VisualStudio.Shell.ProvideProfileAttribute : Type * string * string * int16 * int16 * bool -> Microsoft.VisualStudio.Shell.ProvideProfileAttribute
Public Sub New (objectType As Type, categoryName As String, objectName As String, categoryResourceID As Short, objectNameResourceID As Short, isToolsOptionPage As Boolean)

Parameters

objectType
Type

The Type of the class implementing Visual Studio settings support.

categoryName
String

The canonical, nonlocalized name of a Visual Studio settings category.

objectName
String

The canonical, nonlocalized name used to identify the object implementing a Visual Studio settings category.

categoryResourceID
Int16

The localized resource ID of a Visual Studio settings category's name.

objectNameResourceID
Int16

The localized resource ID of the name used to identify the object implementing a Visual Studio settings category.

isToolsOptionPage
Boolean

This argument is not implemented.

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

Note

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"}>

Note

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  

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 >

Note

The last entry above (<CategoryName>_<ObjectName>\AlternateParent) is created only if isToolsOptionPage is true.

Applies to