## Register a license

You have 30 days free trial. For a long term use, you need to buy a license ([See pricing](/order)). Then, we will send you a license key and you will just have to specify it with your company name with the static method `RegisterLicense()` of class `YaskawaRobot`.

A `InvalidLicenseException` exception will be thrown when connecting to the robot with the reason.

You can get full information about current license with the static property `LicenseInfo` of class `YaskawaRobot`.

**C# : License**
```csharp
using UnderAutomation.Yaskawa;
using UnderAutomation.Yaskawa.License;

class License
{
  static void Main(string[] args)
  {
    /**/
    YaskawaRobot.RegisterLicense("YourCompanyName", "YOUR_LICENSE_KEY");

    LicenseInfo myLicenseInfo = YaskawaRobot.LicenseInfo;

    // Number of trial days remaining
    var evaluationDaysLeft = myLicenseInfo.EvaluationDaysLeft;

    bool licenseValid = myLicenseInfo.State == LicenseState.Licensed;
    /**/
  }
}
```

## API Reference

**Members of License.LicenseInfo**
```csharp
public sealed class LicenseInfo {
    public LicenseInfo(string licenseIdentifier, string licenseKey)

    // Remaining days of the trial period. Null if the product is licensed. It could be negative if the trial period is ended since several days.
    public int? EvaluationDaysLeft { get; set; }

    // The date the trial period starts. If the product is licensed, the date of the library first use.
    public DateTime EvaluationStartDate { get; set; }

    // The date you get the license
    public DateTime? LicenseIssuedDate { get; set; }

    // The license key supplied by UnderAutomation (null for trial period)
    public string LicenseKey { get; set; }

    // Name of your organisation
    public string Licensee { get; set; }

    // The date your maintenance contract ends, and you no longer can use this license with newer versions.
    public DateTime? MaintenanceExpirationDate { get; set; }

    // Number of maintenance years included in your license
    public int MaintenanceYears { get; set; }

    // Commercial name of this .NET Software library
    public string Product { get; set; }

    // The date this version of the product was released.
    public DateTime ProductReleaseDate { get; set; }

    public LicenseState State { get; }

    public override string ToString()

    // The date the product will expire. Null if the product is licensed.
    public DateTime? TrialPeriodExpirationDate { get; set; }
}
```

**Members of License.LicenseState**
```csharp
public enum LicenseState {
    // The trial period has expired, you can no longer use the library
    Expired = 3

    // The library is in an extra trial period, you can use the library
    ExtraTrial = 2

    // The pair License Identifier and License Key are incompatible, you cannot use the library
    Invalid = 0

    // Congratulations, the library is licensed.
    Licensed = 5

    // Your license does not allow you to use such a recent release. Please buy maintenance to use this version
    MaintenanceNeeded = 4

    // No license has been provided
    None = -1

    // The library is in a trial period, you can use the library
    Trial = 1
}
```

**Members of License.InvalidLicenseException**
```csharp
public class InvalidLicenseException : Exception, ISerializable {
    // The license that causes this exception
    public LicenseInfo LicenseInfo { get; set; }
}
```