コード例 #1
0
        public void ApplyLicense(bool nagUser = true)
        {
            try {
                SimultaneousLicenseEnforcements++;
                CountAppliedLicense++;
                string message;
                bool   systemShouldNagUser;
                var    compliant         = DetermineLicenseCompliance(out systemShouldNagUser, out message);
                bool   alreadyNaggedUser = false;
                if (systemShouldNagUser && nagUser)
                {
                    UserInterfaceServices.ShowNagScreen(true, message);
                    CountNagged++;
                    alreadyNaggedUser = true;
                    // Determine compliance again (as user may have activated software in the nag screen)
                    compliant = DetermineLicenseCompliance(out systemShouldNagUser, out message);
                }

                if (!compliant && SimultaneousLicenseEnforcements == 1)
                {
                    switch (Rights.FeatureRights)
                    {
                    case ProductFeatureRights.None:
                        UserInterfaceServices.Exit(true);
                        return;

                    case ProductFeatureRights.Partial:
                        if (!alreadyNaggedUser)
                        {
                            // If nagUser param is false, we still want to tell user feature set has been disabled.
                            // We don't tell them if they've already been nagged with the actual nag screen.
                            UserNotificationServices.ReportInfo("Feature set", "Feature set has been disabled");
                        }
                        break;
                    }
                }
            } finally {
                SimultaneousLicenseEnforcements--;
            }
        }
コード例 #2
0
 public void ShowNagScreen(bool modal = false, string nagMessage = null)
 {
     UserInterfaceServices.ShowNagScreen(modal, nagMessage);
 }
コード例 #3
0
 public void ExecuteInUIFriendlyContext(Action function, bool executeAsync = false)
 {
     UserInterfaceServices.ExecuteInUIFriendlyContext(function, executeAsync);
 }
コード例 #4
0
 public void Exit(bool force = false)
 {
     UserInterfaceServices.Exit(force);
 }