Dil

LicenseProvider Sınıf

Tanım

abstract Lisans sağlayıcısı uygulamak için temel sınıfı sağlar.

public ref class LicenseProvider abstract
public abstract class LicenseProvider
type LicenseProvider = class
Public MustInherit Class LicenseProvider
Devralma
LicenseProvider
Türetilmiş

Örnekler

Aşağıdaki kod örneği, yöntemini kullanarak Validate lisanslı bir denetim oluşturur. sınıfı tarafından LicenseProvider uygulanan bir LicFileLicenseProvider kullanır.

// Adds the LicenseProviderAttribute to the control.

[LicenseProvider(LicFileLicenseProvider::typeid)]
public ref class MyControl: public Control
{
   // Creates a new, null license.
private:
   License^ license;

public:
   MyControl()
   {
      
      // Adds Validate to the control's constructor.
      license = LicenseManager::Validate( MyControl::typeid, this );

      // Insert code to perform other instance creation tasks here.
   }

public:
   ~MyControl()
   {
      if ( license != nullptr )
      {
         delete license;
         license = nullptr;
      }
   }
};
using System.ComponentModel;
using System.Windows.Forms;

// Adds the LicenseProviderAttribute to the control.
[LicenseProvider(typeof(LicFileLicenseProvider))]
public class MyControl : Control
{
    // Creates a new, null license.
    License license;

    public MyControl()
    {
        // Adds Validate to the control's constructor.
        license = LicenseManager.Validate(typeof(MyControl), this);

        // Insert code to perform other instance creation tasks here.
    }

    protected override void Dispose(bool disposing)
    {
        if (disposing)
        {
            if (license != null)
            {
                license.Dispose();
                license = null;
            }
        }
    }
}
Imports System.ComponentModel
Imports System.Windows.Forms

' Adds the LicenseProviderAttribute to the control.
<LicenseProvider(GetType(LicFileLicenseProvider))> _
Public Class MyControl
    Inherits Control
    
    ' Creates a new, null license.
    Private license As License = Nothing    
    
    Public Sub New()        
    
        ' Adds Validate to the control's constructor.
        license = LicenseManager.Validate(GetType(MyControl), Me)

        ' Insert code to perform other instance creation tasks here.
        
    End Sub
    
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)

        If disposing Then
            If (license IsNot Nothing) Then
                license.Dispose()
                license = Nothing
            End If
        End If

    End Sub    
    
End Class

Uygulayanlara Notlar

öğesinden LicenseProviderdevraldığınızda yöntemini geçersiz kılmanız GetLicense(LicenseContext, Type, Object, Boolean) gerekir.

Bu sınıfın bir uygulaması için bkz LicFileLicenseProvider . Lisanslama hakkında daha fazla bilgi için bkz . Nasıl yapılır: Lisans Bileşenleri ve Denetimleri.

Oluşturucular

Veri Akışı Adı Description
LicenseProvider()

LicenseProvider sınıfının yeni bir örneğini başlatır.

Yöntemler

Veri Akışı Adı Description
Equals(Object)

Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler.

(Devralındığı yer: Object)
GetHashCode()

Varsayılan karma işlevi işlevi görür.

(Devralındığı yer: Object)
GetLicense(LicenseContext, Type, Object, Boolean)

Türetilmiş bir sınıfta geçersiz kılındığında, bağlam verildiğinde ve lisans reddinin özel durum oluşturup oluşturmadığı konusunda bir örnek veya bileşen türü için lisans alır.

GetType()

Geçerli örneğin Type alır.

(Devralındığı yer: Object)
MemberwiseClone()

Geçerli Objectbasit bir kopyasını oluşturur.

(Devralındığı yer: Object)
ToString()

Geçerli nesneyi temsil eden bir dize döndürür.

(Devralındığı yer: Object)

Şunlara uygulanır

Ayrıca bkz.