Metered class

Provides methods to set metered key.

public class Metered


Name Description
Metered() The default constructor.


Name Description
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.


In this example, an attempt will be made to set metered public and private key


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
// 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.

    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

See Also