Class Metered
Contents
[
Hide
]Metered class
Provides methods to set metered key.
public class Metered
Constructors
Name | Description |
---|---|
Metered() | The default constructor. |
Methods
Name | Description |
---|---|
IsLicensed() | Checks whether the product is successfully licensed using Metered license. |
ResetMeteredKey() | Removes previously setup license. |
SetMeteredKey(string, string) | Sets metered public and private keys. |
static GetConsumptionCredit() | Gets consumption credit. |
static GetConsumptionQuantity() | Gets consumption file size. |
Examples
In this example, an attempt will be made to set metered public and private key
[C#]
Metered metered = new Metered();
metered.SetMeteredKey("PublicKey", "PrivateKey");
[Visual Basic]
Dim metered As Metered = New Metered
metered.SetMeteredKey("PublicKey", "PrivateKey")
the component jar file:
Metered metered = new Metered();
metered.setMeteredKey("PublicKey", "PrivateKey");
Shows how to use <see cref=“Aspose.Tasks.Metered” /> license type with Aspose.Tasks.
// Let's use metered license (see https://purchase.aspose.com/faqs/licensing/metered)
// set metered licence
var metered = new Metered();
metered.SetMeteredKey("<public key>", "<private key>");
var project = new Project(DataDir + "Project2.mpp");
Console.WriteLine("Project Name: " + project.Get(Prj.Name));
// ...
// work with project...
// ...
// We can get current credits and bytes consumption.
try
{
Console.WriteLine("Credits spent: {0}", Metered.GetConsumptionCredit());
Console.WriteLine("Bytes consumed: {0}", Metered.GetConsumptionQuantity());
}
catch (WebException)
{
// log exception
}
// lately the user can reset a metered and stop counting of bytes
metered.ResetMeteredKey();
See Also
- namespace Aspose.Tasks
- assembly Aspose.Tasks