Ejemplo n.º 1
0
        internal static LicenseState ProjectTypeLicense(ProjectLicenseGroup group, IServiceProvider services)
        {
            ILicenseService service = services.GetService <ILicenseService>();

            switch (group)
            {
            case ProjectLicenseGroup.WpfSilverlight:
            {
                IList <Guid> guids  = service.SkusFromFeature(ExpressionFeatureMapper.WpfFeature);
                IList <Guid> guids1 = service.SkusFromFeature(ExpressionFeatureMapper.SilverlightFeature);
                return(LicensingHelper.DetermineLicenseState(service, LicensingHelper.CombineLists(guids, guids1)));
            }

            case ProjectLicenseGroup.SilverlightMobile:
            {
                return(LicensingHelper.DetermineLicenseState(service, service.SkusFromFeature(ExpressionFeatureMapper.MobileFeature)));
            }

            case ProjectLicenseGroup.SketchFlow:
            {
                IList <Guid> list = service.SkusFromFeature(ExpressionFeatureMapper.HobbledSketchFlowFeature);
                list = list.Union <Guid>(service.SkusFromFeature(ExpressionFeatureMapper.SketchFlowFeature)).ToList <Guid>();
                return(LicensingHelper.DetermineLicenseState(service, list));
            }
            }
            return(LicenseState.FullLicense());
        }
Ejemplo n.º 2
0
        public static LicenseState Expired(bool isActivatable)
        {
            LicenseState licenseState = new LicenseState()
            {
                IsLicensed    = false,
                IsTrial       = false,
                IsExpired     = true,
                IsActivatable = isActivatable
            };

            return(licenseState);
        }
Ejemplo n.º 3
0
        public static LicenseState TemporaryLicense(bool activatable, int daysLeft)
        {
            LicenseState licenseState = new LicenseState()
            {
                IsLicensed     = true,
                DaysLeft       = daysLeft,
                LicenseExpires = true,
                IsActivatable  = activatable
            };

            return(licenseState);
        }
Ejemplo n.º 4
0
        public static LicenseState Trial(bool isActivatable, int daysLeft)
        {
            LicenseState licenseState = new LicenseState()
            {
                IsLicensed    = false,
                IsTrial       = true,
                IsExpired     = false,
                DaysLeft      = daysLeft,
                IsActivatable = isActivatable
            };

            return(licenseState);
        }
Ejemplo n.º 5
0
        public static LicenseState FullLicense()
        {
            LicenseState licenseState = new LicenseState()
            {
                IsLicensed     = true,
                IsTrial        = false,
                IsExpired      = false,
                LicenseExpires = false,
                IsActivated    = true,
                IsActivatable  = false
            };

            return(licenseState);
        }
Ejemplo n.º 6
0
        private static LicenseState DetermineLicenseState(ILicenseService licenseService, IList <Guid> skus)
        {
            LicenseState licenseState;
            Guid         guid = licenseService.MostPermissiveLicenseSku(skus);
            bool         flag = licenseService.FeaturesFromSku(guid).Contains(ExpressionFeatureMapper.ActivationLicense);

            if (licenseService.IsLicensed(guid))
            {
                licenseState = LicenseState.FullLicense();
            }
            else if (!licenseService.IsInGrace(guid))
            {
                bool unlicensedReason = licenseService.GetUnlicensedReason(guid) == UnlicensedReason.GraceTimeExpired;
                bool flag1            = licenseService.HasKey(guid);
                licenseState = LicenseState.Expired((!flag || !unlicensedReason ? false : flag1));
            }
            else
            {
                licenseState = LicenseState.Trial(flag, licenseService.GetRemainingGraceMinutes(guid) / 1440);
            }
            return(licenseState);
        }
 private void RefreshLicenseValuesInternal()
 {
     this.license            = LicensingHelper.ProjectTypeLicense(this.licenseGroup, this.services);
     base.IsExpired          = this.license.IsExpired;
     base.RequiresActivation = !this.license.FullyLicensed;
     base.IsActivatable      = this.license.IsActivatable;
     if (!base.IsExpired)
     {
         base.IsTrial = this.license.IsTrial;
         if (!base.IsTrial)
         {
             base.IsLicensed = true;
         }
         else
         {
             base.DaysRemaining = this.license.DaysLeft;
         }
     }
     base.OnPropertyChanged("TrialStatus");
     base.OnPropertyChanged("LicenseButtonCommand");
     base.OnPropertyChanged("ButtonText");
     base.OnPropertyChanged("ActionAvailable");
     base.OnPropertyChanged("IsVisible");
 }