Click here to Skip to main content
15,868,164 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi, im currently working on the license control for my c# plugin. I already created a class called GenerateKey(Wins Form) and planning to load this class before the user gets to install the plugin (Main Program).
I found a syntax below.
My questions are im not sure which event supposed to be used to load such event and how to "attach" the GenerateKey class to it.

The syntax below is from my main program when the plugin can be installed freely.
But im trying to control the installation using licensing.

What I have tried:

public override void AfterLoad(BaseArgs e)
     { 
      BCE.Application.AppMessage.ShowMessage(string.Format("Account book {0}\nhas loaded My First Plugin", e.CompanyName));
            base.AfterLoad(e);
        }
Posted
Updated 7-Oct-19 21:35pm

1 solution

One way to do it is to give the GenerateKey class a static constructor: Static Constructors - C# Programming Guide | Microsoft Docs[^]
The static constructor will be automatically called before any instance of the class is created, so if your plugin creates a GenerateKey instance as part of it's constructor / load code, the licence could be checked without the need to invoke events.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900