Classe FeatureConnectorAttribute
Indica o tipo de FeatureConnector<TFeatureProviderType> necessários para lidar com o FeatureProvider.
Namespace: Microsoft.Windows.Design.Features
Assembly: Microsoft.Windows.Design.Extensibility (em Microsoft.Windows.Design.Extensibility.dll)
Sintaxe
<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple := True)> _
Public NotInheritable Class FeatureConnectorAttribute _
Inherits Attribute
Dim instance As FeatureConnectorAttribute
[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = true)]
public sealed class FeatureConnectorAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class, AllowMultiple = true)]
public ref class FeatureConnectorAttribute sealed : public Attribute
public final class FeatureConnectorAttribute extends Attribute
Comentários
Aplicar o FeatureConnectorAttribute para sua personalizado FeatureProvider classe para especificar um FeatureConnector<TFeatureProviderType> os serviços necessários para que publica sua FeatureProvider.
Exemplos
O exemplo de código a seguir mostra como usar o FeatureConnectorAttribute para associar um FeatureConnector<TFeatureProviderType> classe com um provedor de recurso personalizado chamado DiagnosticsMenuProvider. Para obter uma lista completa de código, consulte Como: Criar um conector de recurso Personalizar.
' The DiagnosticsMenuProvider class adds a context menu item
' that displays a dialog box listing the currently running and
' pending feature connectors.
<FeatureConnector(GetType(DiagnosticsFeatureConnector))> _
Public Class DiagnosticsMenuProvider
Inherits PrimarySelectionContextMenuProvider
Public Sub New()
Dim action As New MenuAction("Feature Diagnostics...")
AddHandler action.Execute, AddressOf action_Execute
Items.Add(action)
End Sub
Sub action_Execute(ByVal sender As Object, ByVal e As MenuActionEventArgs)
Dim service As IDiagnosticsService = e.Context.Services.GetRequiredService(Of IDiagnosticsService)()
service.ShowWindow()
End Sub
End Class
// The DiagnosticsMenuProvider class adds a context menu item
// that displays a dialog box listing the currently running and
// pending feature connectors.
[FeatureConnector(typeof(DiagnosticsFeatureConnector))]
public class DiagnosticsMenuProvider : PrimarySelectionContextMenuProvider
{
public DiagnosticsMenuProvider()
{
MenuAction action = new MenuAction("Feature Diagnostics...");
action.Execute += new EventHandler<MenuActionEventArgs>(action_Execute);
Items.Add(action);
}
void action_Execute(object sender, MenuActionEventArgs e)
{
IDiagnosticsService service =
e.Context.Services.GetRequiredService<IDiagnosticsService>();
service.ShowWindow();
}
}
Hierarquia de herança
System.Object
System.Attribute
Microsoft.Windows.Design.Features.FeatureConnectorAttribute
Acesso thread-safe
Quaisquer membros static (Shared no Visual Basic) públicos deste tipo são thread-safe. Não há garantia de que qualquer membro de instância seja thread-safe.
Consulte também
Referência
Membros FeatureConnectorAttribute
Namespace Microsoft.Windows.Design.Features
FeatureConnector<TFeatureProviderType>