Class Metered
ชื่อพื้นที่: Aspose.Pdf การประกอบ: Aspose.PDF.dll (25.4.0)
ให้วิธีการในการตั้งค่ากุญแจวัด
public class Metered
Inheritance
อนุญาโตตุลาการ
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
ในตัวอย่างนี้จะพยายามที่จะตั้งค่ากุญแจสาธารณะและส่วนตัว
var metered = new Metered();
metered.SetMeteredKey("PublicKey", "PrivateKey");</code></pre>
```csharp
Dim metered As Metered = New Metered
metered.SetMeteredKey("PublicKey", "PrivateKey")
แสดงวิธีการเปิดใช้งานใบอนุญาตวัดและติดตามเครดิต / การบริโภค
// Set metered public and private keys
var metered = new Aspose.Pdf.Metered();
metered.SetMeteredKey("PublicKey", "PrivateKey");
//Get current Consumption Credit and Quantity
var wasCredit = Metered.GetConsumptionCredit();
var wasQuantity = Metered.GetConsumptionQuantity();
//Operate using Aspose.Pdf
var doc = new Document();
doc.Pages.Add();
doc.Save(dataDir + "example.pdf");
//Little wait to be sure the transaction completed
System.Threading.Thread.Sleep(10000);
//Get current Consumption Credit and Quantity
var nowCredit = Metered.GetConsumptionCredit();
var nowQuantity = Metered.GetConsumptionQuantity();
//Show Info
Console.WriteLine("Credit: was={0} now={1} difference={2}", wasCredit, nowCredit, nowCredit - wasCredit);
Console.WriteLine("Quantity: was={0} now={1} difference={2}", wasQuantity, nowQuantity, nowQuantity - wasQuantity);
```<pre><code class="lang-csharp">
' Set metered public And private keys
Dim metered = New Aspose.Pdf.Metered()
metered.SetMeteredKey("PublicKey", "PrivateKey")
'Get current Consumption Credit And Quantity
Dim wasCredit = Metered.GetConsumptionCredit()
Dim wasQuantity = Metered.GetConsumptionQuantity()
'Operate using Aspose.Pdf
Dim doc = New Document()
doc.Pages.Add()
doc.Save(dataDir + "example.pdf")
'Little wait to be sure the transaction completed
System.Threading.Thread.Sleep(10000)
'Get current Consumption Credit And Quantity
Dim nowCredit = Metered.GetConsumptionCredit()
Dim nowQuantity = Metered.GetConsumptionQuantity()
'Show Info
Console.WriteLine("Credit: was={0} now={1} difference={2}", wasCredit, nowCredit, nowCredit - wasCredit)
Console.WriteLine("Quantity: was={0} now={1} difference={2}", wasQuantity, nowQuantity, nowQuantity - wasQuantity)
Constructors
Metered()
public Metered()
Methods
GetConsumptionCredit()
รับเครดิตการบริโภค
public static decimal GetConsumptionCredit()
Returns
จํานวนการบริโภค
GetConsumptionQuantity()
รับขนาดไฟล์การบริโภค
public static decimal GetConsumptionQuantity()
Returns
จํานวนการบริโภค
GetProductName()
รับชื่อผลิตภัณฑ์
public string GetProductName()
Returns
ชื่อผลิตภัณฑ์
IsMeteredLicensed()
ตรวจสอบว่าเมตเตอร์ได้รับอนุญาตหรือไม่
public static bool IsMeteredLicensed()
Returns
จริงหรือผิด
SetMeteredKey(รั้ว, รั้ว)
เก็บคีย์สาธารณะและส่วนตัวหากคุณซื้อใบอนุญาตที่วัดเมื่อเริ่มต้นการใช้งาน API นี้ควรเรียกว่าปกตินี้เพียงพออย่างไรก็ตามหากไม่สามารถอัปโหลดข้อมูลการบริโภคได้ตลอดเวลาและเกิน 24 ชั่วโมงใบอนุญาตจะถูกกําหนดไว้ในสถานะการประเมินเพื่อหลีกเลี่ยงกรณีดังกล่าวคุณควรตรวจสอบสถานะใบอนุญาตอย่างเป็นประจําถ้ามันเป็นสถานะการประเมินเรียก API นี้อีกครั้ง
public void SetMeteredKey(string publicKey, string privateKey)
Parameters
publicKey
string
คีย์สาธารณะ
privateKey
string
คีย์ส่วนตัว