Class Metered

Class Metered

ชื่อพื้นที่: Aspose.Note การประกอบ: Aspose.Note.dll (25.4.0)

ให้วิธีการในการตั้งค่ากุญแจวัด

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

Inheritance

object Metered

อนุญาโตตุลาการ

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

Examples

ในตัวอย่างนี้จะมีการพยายามที่จะตั้งค่ากุญแจสาธารณะและส่วนตัว

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

แสดงให้เห็นวิธีการตั้งค่าใบอนุญาตวัด

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

อะไหล่ ( )

public Metered()
   {
   }

Methods

GetConsumptionCredit()

รับเครดิตการบริโภค

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

Returns

decimal

รับคืนจํานวนจุดเครดิตที่ใช้

GetConsumptionQuantity()

รับขนาดไฟล์การบริโภค

public static decimal GetConsumptionQuantity()
   {
   }

Returns

decimal

กลับจํานวนไบต์ที่ใช้

รีเซ็ตMeteredKey()

ลบใบอนุญาตการตั้งค่าก่อนหน้านี้

public void ResetMeteredKey()
   {
   }

SetMeteredKey( string, string)

เก็บคีย์สาธารณะและส่วนตัว

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

Parameters

publicKey string

คีย์สาธารณะ

privateKey string

คีย์ส่วนตัว

Examples

แสดงให้เห็นวิธีการตั้งค่าใบอนุญาตวัด

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

หากคุณซื้อใบอนุญาตวัด API นี้ควรจะถูกเรียกใช้ในโปรแกรมเริ่มต้น โดยปกติแล้วนี่เป็นเพียงพออย่างไรก็ตามหากผู้วัดไม่สามารถอัปโหลดข้อมูลการบริโภคได้ภายใน 24 ชั่วโมงใบอนุญาตจะถูกตั้งค่าไว้ในสถานะการประเมิน เพื่อหลีกเลี่ยงกรณีดังกล่าวคุณควรตรวจสอบสถานะการประเมินอย่างเป็นประจํา หากเป็นสถานะการประเมินโทรหา API นี้อีกครั้ง

 แบบไทย