Example #1
0
        /// <summary>
        /// Collects the zone parameter values from an element.
        /// </summary>
        /// <param name="element">The element potentially containing the shared parameter information.</param>
        /// <returns>True if the zone name parameter was found, even if empty; false otherwise.</returns>
        /// <remarks>CurrentPropZoneLabels will be null if zone name parameter wasn't found,
        /// and empty if it was found but had no value.</remarks>
        public bool SetPropZoneValues(Element element)
        {
            CurrentPropZoneValues = null;

            SetPropZoneLabels();
            if (CurrentPropZoneLabels == null)
            {
                return(false);
            }

            string zoneNameLabel = GetPropZoneLabel(ZoneInfoLabel.Name);
            string zoneName;

            if (ParameterUtil.GetOptionalStringValueFromElementOrSymbol(element, zoneNameLabel, out zoneName) == null)
            {
                return(false);
            }

            CurrentPropZoneValues = new Dictionary <ZoneInfoLabel, string>();

            if (!string.IsNullOrWhiteSpace(zoneName))
            {
                CurrentPropZoneValues.Add(ZoneInfoLabel.Name, zoneName);
                foreach (KeyValuePair <ZoneInfoLabel, string> propZoneLabel in CurrentPropZoneLabels)
                {
                    if (propZoneLabel.Key == ZoneInfoLabel.Name)
                    {
                        continue;
                    }

                    string zoneValue;
                    ParameterUtil.GetStringValueFromElementOrSymbol(element, propZoneLabel.Value, out zoneValue);
                    CurrentPropZoneValues.Add(propZoneLabel.Key, zoneValue);
                }
            }

            return(true);
        }