Class Metered

Class Metered

Nazwa przestrzeń: Aspose.Note Zgromadzenie: Aspose.Note.dll (25.4.0)

Zapewnia metody ustawienia mierzonego klucza.

public class Metered
    {
        private double _meteredValue;
        public double MeteredValue
        {
            get => _meteredValue;
            set => _meteredValue = value;
        }
        public void Print()
        {
            Console.WriteLine(_meteredValue);
        }
    }

Inheritance

object Metered

Dziedziczeni członkowie

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

W tym przykładzie, próba zostanie dokonywana, aby umieścić mierzony publiczny i prywatny klucz

Metered metered = new Metered();
   metered.SetMeteredKey("PublicKey", "PrivateKey");
Dim metered As Metered = New Metered
metered.SetMeteredKey("PublicKey", "PrivateKey")

Pokaż, jak zainstalować licencję.

Metered meterered = new Metered();
   meterered.SetMeteredKey("MyPublicKey", "MyPrivateKey");
   Console.WriteLine($"Credit before operation: {Metered.GetConsumptionCredit():F2}");
   Console.WriteLine($"Consumption quantity before operation: {Metered.GetConsumptionQuantity():F2}");
   string dataDir = RunExamples.GetDataDir_Pages();
   Document document = new Document(Path.Combine(dataDir, "Aspose.one"));
   document.Save(Path.Combine(dataDir, "MeteredLicense.pdf"));
   Console.WriteLine($"Credit before operation: {Metered.GetConsumptionCredit():F2}");
   Console.WriteLine($"Consumption quantity before operation: {Metered.GetConsumptionQuantity():F2}");

Constructors

wskaźnik ()

public Metered()
   {
   }

Methods

Kredyt konsumpcyjny ()

otrzymuje kredyt konsumpcyjny.

public static decimal GetConsumptionCredit()
{
    var consumption = GetTotalConsumption();
    var credit = 0m;
    if (consumption > MaxConsumption)
        credit = MaxAllowableCredit;
    else
        credit = CalculateCredit(consumption);
    return credit;
}

Returns

decimal

Zwraca ilość spożywanych punktów kredytowych.

Wskaźnik konsumpcji()

Dostęp do rozmiaru pliku konsumpcji.

public static decimal GetConsumptionQuantity()
   {
   }

Returns

decimal

Przywróci liczbę spożywanych bajtów.

RozpoczęcieKey()

Usunąć licencję wcześniejszej instalacji.

public void ResetMeteredKey()
   {
   }

SetMeteredKey (string, string)

Zestaw kluczy publicznych i prywatnych.

public void SetMeteredKey(
      string publicKey,
      string privateKey)
   {
   }

Parameters

publicKey string

Klucz publiczny .

privateKey string

To prywatny klucz.

Examples

Pokaż, jak zainstalować licencję.

Metered metered = new Metered();
   metered.SetMeteredKey("MyPublicKey", "MyPrivateKey");
   Console.WriteLine($"Credit before operation: {Metered.GetConsumptionCredit():F2}");
   Console.WriteLine($"Consumption quantity before operation: {Metered.GetConsumptionQuantity():F2}");
   string dataDir = RunExamples.GetDataDir_Pages();
   Document document = new Document(Path.Combine(dataDir, "Aspose.one"));
   document.Save(Path.Combine(dataDir, "MeteredLicense.pdf"));
   Console.WriteLine($"Credit before operation: {Metered.GetConsumptionCredit():F2}");
   Console.WriteLine($"Consumption quantity before operation: {Metered.GetConsumptionQuantity():F2}");

Remarks

Jeśli kupujesz licencję mierzoną, ta API powinna zostać wezwana na startup aplikacji, zwykle to wystarczy.Jednakże, jeśli mierzony nie przesyła danych konsumpcyjnych w ciągu 24 godzin, licencja zostanie ustawiona na status oceny. Aby uniknąć takiego przypadku, należy regularnie sprawdzić status licencji Jeśli jest to status oceny, zadzwoń do tego API ponownie.

 Polski