FeatureManager Class
Manages feature providers and feature connectors.
Namespace: Microsoft.Windows.Design.Features
Assembly: Microsoft.Windows.Design.Extensibility (in Microsoft.Windows.Design.Extensibility.dll)
Syntax
'Declaration
Public Class FeatureManager _
Implements IDisposable
'Usage
Dim instance As FeatureManager
public class FeatureManager : IDisposable
public ref class FeatureManager : IDisposable
public class FeatureManager implements IDisposable
Remarks
Use the FeatureManager class to create feature providers and to query for running and pending feature connectors.
If a feature connector needs to be instantiated, but it subscribes either to services or to context items that do not yet exist, the connector type is put on a pending list and subscriptions are added to the editing context. When the correct services and items become available, the feature connector is instantiated.
When an object is added to an editing model, the editing model should call the InitializeFeatures method on the feature manager, which inspects the object for feature attributes. It follows these attributes to FeatureConnector<TFeatureProviderType> attributes and makes sure that all unique connectors have been instantiated.
Examples
The following sample code shows how to use the FeatureManager class to access the running and pending connectors. For a complete code listing, see How to: Create a Custom Feature Connector.
Public Sub Initialize(ByVal manager As FeatureManager)
featManager = manager
Bind()
End Sub
...
' Binds the activatedFeatures and pendingFeatures controls
' the FeatureManager's RunningConnectors and PendingConnectors\
' properties.
Private Sub Bind()
activatedFeatures.Items.Clear()
pendingFeatures.Items.Clear()
Dim info As FeatureConnectorInformation
For Each info In featManager.RunningConnectors
activatedFeatures.Items.Add(info)
Next info
For Each info In featManager.PendingConnectors
pendingFeatures.Items.Add(info)
Next info
End Sub
public void Initialize(FeatureManager manager)
{
featManager = manager;
Bind();
}
...
// Binds the activatedFeatures and pendingFeatures controls
// the FeatureManager's RunningConnectors and PendingConnectors\
// properties.
private void Bind()
{
activatedFeatures.Items.Clear();
pendingFeatures.Items.Clear();
foreach (FeatureConnectorInformation info in
featManager.RunningConnectors)
{
activatedFeatures.Items.Add(info);
}
foreach (FeatureConnectorInformation info in
featManager.PendingConnectors)
{
pendingFeatures.Items.Add(info);
}
}
Inheritance Hierarchy
System.Object
Microsoft.Windows.Design.Features.FeatureManager
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also
Reference
Microsoft.Windows.Design.Features Namespace
FeatureConnector<TFeatureProviderType>
Other Resources
How to: Create a Custom Feature Connector