Best Answer Mark Wördenweber , 23 December 2022 - 14:24
I want to make a store selection in the modules I write.
Add the following line to your configuration view:
@await Component.InvokeAsync("StoreScope")
This will render the store chooser for individual settings.
Don't forget to use this in combination with the setting-editor taghelper!
How can I prevent it from working without a license code?
Your Module class needs the attribute LicensableModule and a CheckLicenseAsync method.
[LicensableModule] public class Module : ModuleBase, IConfigurable { // Install and Uninstall methods... public static Task<bool> CheckLicenseAsync() { return Throttle.CheckAsync( "YourPersonalUniqueKey", // This needs to change with every module you write. TimeSpan.FromHours(1), true, async () => await LicenseChecker.CheckStateAsync("YourModulesSystemName") > LicensingState.Unlicensed); // e.g. MyOrg.HelloWorld } }
Then you can call CheckLicenseAsync anywhere in your code to confirm it is used with a valid license.
Add the using directive using static YouModuleSystemName.Module;
public IActionResult ControllerMethod(Settings settings) { if (!CheckLicense()) { // Invalid License. return new EmptyResult(); } // Valid License. }
We are currently working on new documentation. It should be released soon.
Go to the full post