예제 #1
0
 /// <summary>
 /// Converts row/column data into a list of sizes.
 /// </summary>
 /// <param name="properties">Contains the info.</param>
 /// <param name="dataName">The name of the property containing the info.</param>
 /// <param name="defaultValue">The default size.</param>
 /// <param name="size">The actual size if a number of items is given rather than a list of sizes.</param>
 /// <returns>List of sizes.</returns>
 private static List<string> GetGridData(IPropertyList properties, string dataName, string defaultValue, string size)
 {
     IList<IProperty> property = properties.Find(dataName);
     List<string> columnList = null;
     if (property != null && property.Count > 0)
     {
         columnList = new List<string>();
         if (property.Count > 1)
         {
             columnList.AddRange(property.Select(item => string.IsNullOrWhiteSpace(item.StringValue) ? defaultValue : item.StringValue));
         }
         else if (property[0].IsInt)
         {
             int fieldCount = property[0].IntValue;
             for (int i = 0; i < fieldCount; i++)
                 columnList.Add(size);
         }
         else
         {
             string[] fieldData = property[0].StringValue.Split('|');
             columnList.AddRange(fieldData.Select(item => string.IsNullOrWhiteSpace(item) ? defaultValue : item));
         }
     }
     return columnList;
 }