Example #1
0
 private DataItemsTuple(
     IAcDomain acDomain,
     DataItem[] dataIdItems, string idString,
     DataItem[] dataValueItems, string valueString,
     string[] getElement, string getElementString,
     string infoFormat)
 {
     this._acDomain = acDomain;
     if (dataIdItems == null && idString == null)
     {
         dataIdItems = new DataItem[0];
     }
     if (dataValueItems == null && valueString == null)
     {
         dataValueItems = new DataItem[0];
     }
     if (string.IsNullOrEmpty(infoFormat))
     {
         throw new AnycmdException("infoFormat不能为空");
     }
     if (!acDomain.NodeHost.InfoStringConverters.TryGetInfoStringConverter(infoFormat, out _converter))
     {
         throw new AnycmdException("意外的信息格式" + infoFormat);
     }
     this.InfoFormat = infoFormat;
     this.QueryList = getElement;
     this.QueryList = getElement;
     this.QueryListString = getElementString;
     this.IdItems = new DataItems(dataIdItems, idString, _converter);
     this.ValueItems = new DataItems(dataValueItems, valueString, _converter);
 }
Example #2
0
 /// <summary>
 /// 命令信息项集合构造。两个参数不能同时为null
 /// </summary>
 /// <param name="dataItems">信息字符串所对应的数据项数组</param>
 /// <param name="infoString">数据项数组所对应的信息字符串</param>
 /// <param name="converter">信息格式:如json、xml</param>
 public DataItems(DataItem[] dataItems, string infoString, IInfoStringConverter converter)
 {
     if (dataItems == null && infoString == null)
     {
         throw new AnycmdException("dataItems和infoString不能同时为null");
     }
     if ((dataItems == null || infoString == null) && converter == null)
     {
         throw new ArgumentNullException("converter");
     }
     this._converter = converter;
     this.Items = dataItems;
     this.InfoString = infoString;
 }
Example #3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="acDomain"></param>
 /// <param name="dataIdItems"></param>
 /// <param name="dataValueItems"></param>
 /// <param name = "getElement"></param>
 /// <param name="infoFormat"></param>
 /// <returns></returns>
 public static DataItemsTuple Create(
     IAcDomain acDomain,
     DataItem[] dataIdItems,
     DataItem[] dataValueItems,
     string[] getElement,
     string infoFormat)
 {
     return new DataItemsTuple(acDomain, dataIdItems, null, dataValueItems, null, getElement, null, infoFormat);
 }