示例#1
0
        /// <summary>Initializes application features</summary>
        /// <param name="features">Features - object</param>
        /// <param name="license">ReadOnlyLicense - license object</param>
        /// <param name="successful">Whether license is reloaded successfully or not</param>
        public static void InitializeFeatures(Features features, SampleReadOnlyLicense license, bool successful)
        {
            XmlNode optionsNode = null;

            features.ListFeatures.Clear();
            Enum e = LicenseFeatures.Copy;

            //Get the SimpleTextEditorOptions node from License custom data string
            if (!string.IsNullOrEmpty(license.LicenseCustomData))
            {
                optionsNode = GetCustomDataXml(license.LicenseCustomData);
            }

            //If LicenseCustomData does not contains settings for SimpleTextEditor Options then fall back to Product Option CustomData
            if (optionsNode == null && !string.IsNullOrEmpty(license.ProductOption.CustomData))
            {
                //Get the SimpleTextEditorOptions node from Product option custom data string
                optionsNode = GetCustomDataXml(license.ProductOption.CustomData);
            }

            foreach (object name in Enum.GetValues(e.GetType()))
            {
                features.AddFeature(new Feature(name.ToString(), !successful ? false : Features.GetFeatureEnabled(optionsNode, (LicenseFeatures)name), Features.GetDisplayName((LicenseFeatures)name)));
            }
        }