FeatureSupport Classe
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Fornece static métodos para recuperar informação de características do sistema atual.
public ref class FeatureSupport abstract : System::Windows::Forms::IFeatureSupport
public abstract class FeatureSupport : System.Windows.Forms.IFeatureSupport
type FeatureSupport = class
interface IFeatureSupport
Public MustInherit Class FeatureSupport
Implements IFeatureSupport
- Herança
-
FeatureSupport
- Derivado
- Implementações
Exemplos
O exemplo seguinte utiliza a OSFeature implementação de FeatureSupport e consultas para a LayeredWindows funcionalidade. A versão é verificada para verificar se é null, para determinar se a funcionalidade está presente. O resultado é apresentado numa caixa de texto. Este código assume textBox1 que foi criado e colocado num formulário.
private:
void LayeredWindows()
{
// Gets the version of the layered windows feature.
Version^ myVersion = OSFeature::Feature->GetVersionPresent(
OSFeature::LayeredWindows );
// Prints whether the feature is available.
if ( myVersion != nullptr )
{
textBox1->Text = "Layered windows feature is installed.\n";
}
else
{
textBox1->Text = "Layered windows feature is not installed.\n";
}
// This is an alternate way to check whether a feature is present.
if ( OSFeature::Feature->IsPresent( OSFeature::LayeredWindows ) )
{
textBox1->Text = String::Concat( textBox1->Text,
"Again, layered windows feature is installed." );
}
else
{
textBox1->Text = String::Concat( textBox1->Text,
"Again, layered windows feature is not installed." );
}
}
private void LayeredWindows() {
// Gets the version of the layered windows feature.
Version myVersion = OSFeature.Feature.GetVersionPresent(OSFeature.LayeredWindows);
// Prints whether the feature is available.
if (myVersion != null)
textBox1.Text = "Layered windows feature is installed." + '\n';
else
textBox1.Text = "Layered windows feature is not installed." + '\n';
// This is an alternate way to check whether a feature is present.
if (OSFeature.Feature.IsPresent(OSFeature.LayeredWindows))
textBox1.Text += "Again, layered windows feature is installed.";
else
textBox1.Text += "Again, layered windows feature is not installed.";
}
Private Sub LayeredWindows()
' Gets the version of the layered windows feature.
Dim myVersion As Version = _
OSFeature.Feature.GetVersionPresent(OSFeature.LayeredWindows)
' Prints whether the feature is available.
If (myVersion IsNot Nothing) Then
textBox1.Text = "Layered windows feature is installed." & _
ControlChars.CrLf
Else
textBox1.Text = "Layered windows feature is not installed." & _
ControlChars.CrLf
End If
'This is an alternate way to check whether a feature is present.
If OSFeature.Feature.IsPresent(OSFeature.LayeredWindows) Then
textBox1.Text &= "Again, layered windows feature is installed."
Else
textBox1.Text &= "Again, layered windows feature is not installed."
End If
End Sub
Observações
Use os static métodos desta classe quando as classes que consultar para a informação das funcionalidades implementarem a IFeatureSupport interface. Caso contrário, herde e FeatureSupport forneça a sua própria implementação. Para uma implementação desta classe, veja OSFeature.
Para obter o número de versão de uma funcionalidade, ligue GetVersionPresentpara . Ligue IsPresent para determinar se uma funcionalidade ou versão específica de uma funcionalidade está instalada.
Notas para Implementadores
Quando herdas de FeatureSupport, tens de sobrescrever o GetVersionPresent(String, String) método. Ao sobrescrever este método, verifique se a classe que usa para o feature parâmetro é a mesma que a classe usada para esse parâmetro no IsPresent(String, String) método. Se os dois feature parâmetros diferirem, também deve sobrescrever IsPresent(String, String).
Construtores
| Name | Description |
|---|---|
| FeatureSupport() |
Inicializa uma nova instância da FeatureSupport classe. |
Métodos
| Name | Description |
|---|---|
| Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual. (Herdado de Object) |
| GetHashCode() |
Serve como função de hash predefinida. (Herdado de Object) |
| GetType() |
Obtém o Type da instância atual. (Herdado de Object) |
| GetVersionPresent(Object) |
Quando é sobreposto numa classe derivada, obtém a versão da funcionalidade especificada que está disponível no sistema. |
| GetVersionPresent(String, String) |
Obtém a versão da funcionalidade especificada que está disponível no sistema. |
| IsPresent(Object, Version) |
Determina se a versão especificada ou mais recente da funcionalidade especificada está instalada no sistema. |
| IsPresent(Object) |
Determina se alguma versão da funcionalidade especificada está instalada no sistema. |
| IsPresent(String, String, Version) |
Determina se a versão especificada ou mais recente da funcionalidade especificada está instalada no sistema. Este método é |
| IsPresent(String, String) |
Determina se alguma versão da funcionalidade especificada está instalada no sistema. Este método é |
| MemberwiseClone() |
Cria uma cópia superficial do atual Object. (Herdado de Object) |
| ToString() |
Devolve uma cadeia que representa o objeto atual. (Herdado de Object) |