示例#1
0
        public static ConfigurationErrorList ValidateRequiredPulseUrlPropertyValue(string propertyValue, string propertyDisplayName)
        {
            var errors = new ConfigurationErrorList();

            if (string.IsNullOrEmpty(propertyValue))
            {
                errors.Add(new ConfigurationError(
                    string.Format("The required web part property '{0}' has not been set.", propertyDisplayName),
                    string.Format("Ensure the required web part property '{0}' is set on this web part.  You may access this property by editing the web part and expanding the 'Pulse' section.", propertyDisplayName)));
            }
            else if (string.IsNullOrEmpty(PulseUtility.GetPulseRelativeUrl(propertyValue)))
            {
                errors.Add(new ConfigurationError(
                    string.Format("The value of web part property '{0}' is not recognized as a valid Pulse URL.", propertyDisplayName),
                    string.Format("Ensure the web part property '{0}' is set to a valid Pulse URL.  You may access this property by editing the web part and expanding the 'Pulse' section.", propertyDisplayName)));
            }

            return errors;
        }
        protected virtual ConfigurationErrorList Validate()
        {
            var errors = new ConfigurationErrorList();

            try
            {
                if (Settings == null || !Settings.IsValid())
                {
                    errors.Add(new ConfigurationError(
                        "Your site is not configured for Pulse.",
                        "Ensure that Neudesic Pulse settings are correctly configured."));
                }
            }
            catch(Exception ex)
            {
                errors.Add(new ConfigurationError(
                    "An error occurred while validating your Pulse configuration",
                    string.Format("{0}. Ensure that Neudesic Pulse settings are correctly configured.", ex.Message)));
            }

            return errors;
        }