Chronos Plugins 5.11.0
This documentation covers the plugin interfaces definitions and an example implementation.
Loading...
Searching...
No Matches
MockPlugin.Misc.MockLicenseCheckAttribute Class Reference

Mock plugin specific license checker. More...

Inheritance diagram for MockPlugin.Misc.MockLicenseCheckAttribute:
Collaboration diagram for MockPlugin.Misc.MockLicenseCheckAttribute:

Public Member Functions

override string CheckLicense ()
Public Member Functions inherited from AxelSemrau.Chronos.Plugin.LicenseCheckerAttribute
string CheckLicense ()
 Do the license check.

Private Member Functions

bool LicenseAlreadyOk ()
 Check if we have some persistantly saved license state, and this state is ok.

Detailed Description

Mock plugin specific license checker.

Shows a license check dialog, but continues no matter the input.

Definition at line 18 of file LicenseCheck.cs.

Member Function Documentation

◆ CheckLicense()

override string MockPlugin.Misc.MockLicenseCheckAttribute.CheckLicense ( )

Definition at line 20 of file LicenseCheck.cs.

21 {
22 if (!LicenseAlreadyOk())
23 {
24 var vm = Helpers.UtilityFactories.CreateViewModel<LicenseCheckViewModel>();
25 vm.AcceptedProductIDs = new []{4711};
26 // Our extremely secure reference date for the license check.
27 vm.ProductReferenceDate = new FileInfo(Assembly.GetExecutingAssembly().Location).CreationTime;
28 vm.ValidityAfterReferenceDate = TimeSpan.FromDays(123);
29
30 vm.Explanation = new NoLicenseNeededExplanation();
31 vm.ActivationUriBuilder = () => new Uri($"https://github.com/AxelSemrau/ChronosMockPlugin?ID={vm.ComputerId}&Serial={vm.SerialNumber}");
32 var view = Helpers.UtilityFactories.CreateView<LicenseCheckDialog>();
33 view.DataContext = vm;
34 view.ShowDialog();
35 if (!vm.IsActivationKeyOk)
36 {
37 Helpers.Debug.TraceWrite("No valid license");
38 }
39 // ReSharper disable once RedundantIfElseBlock
40 else
41 {
42 // save the license information
43 }
44 }
45 // For our demo plugin, the license is always ok. Otherwise, we would tell the reason here and get a log entry stating why the plugin can't be loaded.
46 return null;
47 }

References AxelSemrau.Chronos.Plugin.Helpers.Debug, LicenseAlreadyOk(), AxelSemrau.Chronos.Plugin.IDebugHelper.TraceWrite(), and AxelSemrau.Chronos.Plugin.Helpers.UtilityFactories.

◆ LicenseAlreadyOk()

bool MockPlugin.Misc.MockLicenseCheckAttribute.LicenseAlreadyOk ( )
private

Check if we have some persistantly saved license state, and this state is ok.

Returns
For our mock plugin: Always not ok.

Referenced by CheckLicense().


The documentation for this class was generated from the following file: