Chronos Plugins 5.9.0
This documentation covers the plugin interfaces definitions and an example implementation.
Loading...
Searching...
No Matches
MockPlugin.Misc.MockLicenseCheckAttribute Class Reference
+ 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

Definition at line 14 of file LicenseCheck.cs.

Member Function Documentation

◆ CheckLicense()

override string MockPlugin.Misc.MockLicenseCheckAttribute.CheckLicense ( )

Definition at line 16 of file LicenseCheck.cs.

17 {
18 if (!LicenseAlreadyOk())
19 {
20 var vm = Helpers.UtilityFactories.CreateViewModel<LicenseCheckViewModel>();
21 vm.AcceptedProductIDs = new []{4711};
22 // Our extremely secure reference date for the license check.
23 vm.ProductReferenceDate = new FileInfo(Assembly.GetExecutingAssembly().Location).CreationTime;
24 vm.ValidityAfterReferenceDate = TimeSpan.FromDays(123);
25
26 vm.Explanation = new NoLicenseNeededExplanation();
27 vm.ActivationUriBuilder = () => new Uri($"https://github.com/AxelSemrau/ChronosMockPlugin?ID={vm.ComputerId}&Serial={vm.SerialNumber}");
28 var view = Helpers.UtilityFactories.CreateView<LicenseCheckDialog>();
29 view.DataContext = vm;
30 view.ShowDialog();
31 if (!vm.IsActivationKeyOk)
32 {
33 Helpers.Debug.TraceWrite("No valid license");
34 }
35 // ReSharper disable once RedundantIfElseBlock
36 else
37 {
38 // save the license information
39 }
40 }
41 // 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.
42 return null;
43 }
void TraceWrite(string text, params object[] arguments)
Write something to the Chronos trace log.
Static instance for access to utility functions and resources.
Definition Helpers.cs:78
static IUtilityFactories UtilityFactories
Helper class factories, see the members for details.
Definition Helpers.cs:112
static IDebugHelper Debug
Utility functions for debugging.
Definition Helpers.cs:97
Just a placeholder for an internally generated dialog window that uses a LicenseCheckViewModel.
bool LicenseAlreadyOk()
Check if we have some persistantly saved license state, and this state is ok.
Interaction logic for NoLicenseNeededExplanation.xaml.

References AxelSemrau.Chronos.Plugin.Helpers.Debug, MockPlugin.Misc.MockLicenseCheckAttribute.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 MockPlugin.Misc.MockLicenseCheckAttribute.CheckLicense().


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