Chronos Plugins 5.9.0
This documentation covers the plugin interfaces definitions and an example implementation.
Loading...
Searching...
No Matches
LicenseCheckViewModel.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Runtime.CompilerServices;
5using System.Windows.Input;
6
7// ReSharper disable VirtualMemberNeverOverridden.Global
8
10{
11
20 public class LicenseCheckViewModel : INotifyPropertyChanged
21 {
25 public virtual string SerialNumber { get; set; }
29 public virtual string ActivationKey { get; set; }
30
34 public virtual bool IsActivationRequired { get; set; } = true;
38 public virtual DateTime ProductReferenceDate { get; set; }
42 public virtual TimeSpan ValidityAfterReferenceDate { get; set; }
43
49 public virtual int GetProductId(string serialNumber) => 0;
54 public virtual IReadOnlyList<int> AcceptedProductIDs { get; set; }
58 public virtual bool IsLicenseKeyCorrect { get; set; }
63 public virtual bool IsActivationKeyOk { get; set; }
64
68 // ReSharper disable once UnassignedGetOnlyAutoProperty
69 public virtual string ComputerId { get; }
73 public virtual string Complaints { get; set; }
77 public virtual string LicenseHint { get; set; }
84 public virtual object Explanation { get; set; }
89 public Func<Uri> ActivationUriBuilder { get; set; }
94 public virtual Uri ActivationUri { get; set; }
95
99 public virtual ICommand OpenUri => null;
103 public event PropertyChangedEventHandler PropertyChanged;
104
109 protected void NotifyPropertyChanged([CallerMemberName] string propertyName = null)
110 {
111 PropertyChanged?.Invoke (this, new PropertyChangedEventArgs(propertyName));
112 }
113 }
114}
virtual string ActivationKey
The activation key, as the user entered it (and got from some activation site or from you).
virtual Uri ActivationUri
Some internet address that should be visited to finish the activation. This will be displayed to the ...
virtual DateTime ProductReferenceDate
For time dependent licensing: The reference date for your product (build date, commit....
virtual ICommand OpenUri
Open the ActivationUri in a browser.
virtual string LicenseHint
Additional information for the user about the data entered so far that does not constitute an error.
PropertyChangedEventHandler PropertyChanged
Standard property changed handling logic.
Func< Uri > ActivationUriBuilder
If you need a custom Uri, you can build it here (including parameters for computer id / serial)
void NotifyPropertyChanged([CallerMemberName] string propertyName=null)
Allow notification trigger by derived classes.
virtual bool IsActivationKeyOk
Verify the activation key against the other entered data.
virtual bool IsActivationRequired
Do you need an activation code? Could depend on the serial, maybe.
virtual string Complaints
Tell the reason why the currently entered data are not acceptable. If they are, this should be null.
virtual bool IsLicenseKeyCorrect
Basic verification - length, kind of digits, checksum - whatever.
virtual object Explanation
Explanaition to the user what this license is about, and what they should enter.
virtual IReadOnlyList< int > AcceptedProductIDs
Specify which product IDs you accept for this module. Comparison with the GetProductId result allows ...
virtual int GetProductId(string serialNumber)
If you want to use the same system for different licenses: Use this to extract the product code from ...
virtual string SerialNumber
The license code you got from Axel Semrau - or the one you sold your customers.
virtual TimeSpan ValidityAfterReferenceDate
For how long after the reference date is your license OK?
virtual string ComputerId
Some ID that should be displayed to the user that identifies this computer, if you use that in your a...