private void UpdateStatus(ProjectLicenseGroup licenseGroup) { LicenseState licenseState = LicensingHelper.ProjectTypeLicense(licenseGroup, this.services); this.currentState = this.targetState; this.targetState = licenseState; this.licensingAllowsNewProject = !licenseState.IsExpired; if (this.currentState != null || this.targetState != null) { this.LicenseStatusText.Text = this.GenerateLicenseBarText(licenseState, licenseGroup); } bool flag = (this.currentState == null ? false : !this.currentState.FullyLicensed); if (flag != (this.targetState == null ? false : !this.targetState.FullyLicensed)) { if (!flag) { this.LicenseStatusBarBorder.Visibility = Visibility.Visible; } else { this.LicenseStatusBarBorder.Visibility = Visibility.Collapsed; } } this.OnPropertyChanged("CanCreateNewProject"); this.OnPropertyChanged("DialogPadding"); this.OnPropertyChanged("LicenseButtonText"); this.OnPropertyChanged("LicenseButtonCommand"); }
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()); }
private string GenerateLicenseBarText(LicenseState state, ProjectLicenseGroup licenseGroup) { string licenseWpfSilverlightAuthoringNeedsActivation; string licenseSilverlightMobileAuthoringNeedsActivation; string licenseSketchFlowAuthoringNeedsActivation; string empty = string.Empty; if (!state.FullyLicensed) { switch (licenseGroup) { case ProjectLicenseGroup.WpfSilverlight: { if (state.IsLicensed) { licenseWpfSilverlightAuthoringNeedsActivation = StringTable.LicenseWpfSilverlightAuthoringNeedsActivation; } else if (state.IsExpired) { licenseWpfSilverlightAuthoringNeedsActivation = StringTable.LicenseWpfSilverlightAuthoringTrialExpired; } else if (state.DaysLeft == 1) { licenseWpfSilverlightAuthoringNeedsActivation = StringTable.LicenseWpfSilverlightAuthoringTrialDaysLeftSingular; } else { CultureInfo currentCulture = CultureInfo.CurrentCulture; string licenseWpfSilverlightAuthoringTrialDaysLeftPlural = StringTable.LicenseWpfSilverlightAuthoringTrialDaysLeftPlural; object[] daysLeft = new object[] { state.DaysLeft }; licenseWpfSilverlightAuthoringNeedsActivation = string.Format(currentCulture, licenseWpfSilverlightAuthoringTrialDaysLeftPlural, daysLeft); } empty = licenseWpfSilverlightAuthoringNeedsActivation; break; } case ProjectLicenseGroup.SilverlightMobile: { if (state.IsLicensed) { licenseSilverlightMobileAuthoringNeedsActivation = StringTable.LicenseSilverlightMobileAuthoringNeedsActivation; } else if (state.IsExpired) { licenseSilverlightMobileAuthoringNeedsActivation = StringTable.LicenseSilverlightMobileAuthoringTrialExpired; } else if (state.DaysLeft == 1) { licenseSilverlightMobileAuthoringNeedsActivation = StringTable.LicenseSilverlightMobileAuthoringTrialDaysLeftSingular; } else { CultureInfo cultureInfo = CultureInfo.CurrentCulture; string licenseSilverlightMobileAuthoringTrialDaysLeftPlural = StringTable.LicenseSilverlightMobileAuthoringTrialDaysLeftPlural; object[] objArray = new object[] { state.DaysLeft }; licenseSilverlightMobileAuthoringNeedsActivation = string.Format(cultureInfo, licenseSilverlightMobileAuthoringTrialDaysLeftPlural, objArray); } empty = licenseSilverlightMobileAuthoringNeedsActivation; break; } case ProjectLicenseGroup.SketchFlow: { if (state.IsLicensed) { licenseSketchFlowAuthoringNeedsActivation = StringTable.LicenseSketchFlowAuthoringNeedsActivation; } else if (state.IsExpired) { licenseSketchFlowAuthoringNeedsActivation = StringTable.LicenseSketchFlowAuthoringTrialExpired; } else if (state.DaysLeft == 1) { licenseSketchFlowAuthoringNeedsActivation = StringTable.LicenseSketchFlowAuthoringTrialDaysLeftSingular; } else { CultureInfo currentCulture1 = CultureInfo.CurrentCulture; string licenseSketchFlowAuthoringTrialDaysLeftPlural = StringTable.LicenseSketchFlowAuthoringTrialDaysLeftPlural; object[] daysLeft1 = new object[] { state.DaysLeft }; licenseSketchFlowAuthoringNeedsActivation = string.Format(currentCulture1, licenseSketchFlowAuthoringTrialDaysLeftPlural, daysLeft1); } empty = licenseSketchFlowAuthoringNeedsActivation; break; } } } return(empty); }
public ItemizedLicensingComponent(ProjectLicenseGroup licenseGroup, IServiceProvider services) { this.services = services; this.licenseGroup = licenseGroup; this.RefreshLicenseValuesInternal(); }