/// <summary>Rechecks if we're activated -- if so enable the app features.</summary> void CheckIfActivated() { bool isNowActivated = false; try { isNowActivated = ta.IsActivated(); } catch (TurboActivateException ex) { MessageBox.Show("Failed to check if activated: " + ex.Message); return; } // recheck if activated if (isNowActivated) { isGenuine = true; ReEnableAppFeatures(); ShowTrial(false); } else // maybe the user entered a trial extension { RecheckTrialLength(); } }
public Form1() { InitializeComponent(); try { //TODO: goto the version page at LimeLM and paste this GUID here ta = new TurboActivate("18324776654b3946fc44a5f3.49025204"); // set the trial changed event handler ta.TrialChange += trialChange; // Check if we're activated, and every 90 days verify it with the activation servers // In this example we won't show an error if the activation was done offline // (see the 3rd parameter of the IsGenuine() function) // https://wyday.com/limelm/help/offline-activation/ IsGenuineResult gr = ta.IsGenuine(DaysBetweenChecks, GracePeriodLength, true); isGenuine = gr == IsGenuineResult.Genuine || gr == IsGenuineResult.GenuineFeaturesChanged || // an internet error means the user is activated but // TurboActivate failed to contact the LimeLM servers gr == IsGenuineResult.InternetError; // If IsGenuineEx() is telling us we're not activated // but the IsActivated() function is telling us that the activation // data on the computer is valid (i.e. the crypto-signed-fingerprint matches the computer) // then that means that the customer has passed the grace period and they must re-verify // with the servers to continue to use your app. //Note: DO NOT allow the customer to just continue to use your app indefinitely with absolutely // no reverification with the servers. If you want to do that then don't use IsGenuine() or // IsGenuineEx() at all -- just use IsActivated(). if (!isGenuine && ta.IsActivated()) { // We're treating the customer as is if they aren't activated, so they can't use your app. // However, we show them a dialog where they can reverify with the servers immediately. ReVerifyNow frmReverify = new ReVerifyNow(ta, DaysBetweenChecks, GracePeriodLength); if (frmReverify.ShowDialog(this) == DialogResult.OK) { isGenuine = true; } else if (!frmReverify.noLongerActivated) // the user clicked cancel and the user is still activated { // Just bail out of your app Environment.Exit(1); return; } } } catch (TurboActivateException ex) { // failed to check if activated, meaning the customer screwed // something up so kill the app immediately MessageBox.Show("Failed to check if activated: " + ex.Message); Environment.Exit(1); return; } ShowTrial(!isGenuine); // If this app is activated then you can get custom license fields. // See: https://wyday.com/limelm/help/license-features/ /* * if (isGenuine) * { * string featureValue = ta.GetFeatureValue("your feature name"); * * //TODO: do something with the featureValue * } */ }
public ActivationGui() { InitializeComponent(); try { //TODO: goto the version page at LimeLM and paste this GUID here ta = new TurboActivate("4jb6ccnwvp47kmfhqe6cs3jv3p5aeaa"); // set the trial changed event handler ta.TrialChange += trialChange; // Check if we're activated, and every 90 days verify it with the activation servers // In this example we won't show an error if the activation was done offline // (see the 3rd parameter of the IsGenuine() function) // https://wyday.com/limelm/help/offline-activation/ var gr = ta.IsGenuine(DaysBetweenChecks, GracePeriodLength); isGenuine = gr == IsGenuineResult.Genuine || gr == IsGenuineResult.GenuineFeaturesChanged || // an internet error means the user is activated but // TurboActivate failed to contact the LimeLM servers gr == IsGenuineResult.InternetError; // If IsGenuineEx() is telling us we're not activated // but the IsActivated() function is telling us that the activation // data on the computer is valid (i.e. the crypto-signed-fingerprint matches the computer) // then that means that the customer has passed the grace period and they must re-verify // with the servers to continue to use your app. //Note: DO NOT allow the customer to just continue to use your app indefinitely with absolutely // no reverification with the servers. If you want to do that then don't use IsGenuine() or // IsGenuineEx() at all -- just use IsActivated(). if (!isGenuine && ta.IsActivated()) { // We're treating the customer as is if they aren't activated, so they can't use your app. // However, we show them a dialog where they can reverify with the servers immediately. var frmReverify = new ReVerifyNow(ta, DaysBetweenChecks, GracePeriodLength); if (frmReverify.ShowDialog(this) == DialogResult.OK) { isGenuine = true; } else if (!frmReverify.noLongerActivated) // the user clicked cancel and the user is still activated { InitPlugin.Activated = false; return; } } } catch (TurboActivateException ex) { // failed to check if activated, meaning the customer screwed // something up so kill the app immediately MessageBox.Show("Failed to check if activated: " + ex.Message); InitPlugin.Activated = false; return; } ShowTrial(!isGenuine); InitPlugin.Activated = ta.IsActivated() && isGenuine; }