Exemple #1
0
 protected void _AddOptions(IEnumerable opts)
 {
     if (opts is IEnumerable <LightboxSelectOption> )
     {
         this._AddOptions(opts as IEnumerable <LightboxSelectOption>);
     }
     else
     {
         object obj = (object)null;
         foreach (object opt in opts)
         {
             LightboxSelectOption option = opt as LightboxSelectOption;
             if (option != null)
             {
                 this.AddOption(option);
             }
             else
             {
                 obj = opt;
                 break;
             }
         }
         if (obj == null)
         {
             return;
         }
         PropertyInfo[] properties    = obj.GetType().GetProperties();
         PropertyInfo   propertyInfo1 = ((IEnumerable <PropertyInfo>)properties).FirstOrDefault <PropertyInfo>((Func <PropertyInfo, bool>)(a => a.Name.ToLower() == "key"));
         PropertyInfo   propertyInfo2 = ((IEnumerable <PropertyInfo>)properties).FirstOrDefault <PropertyInfo>((Func <PropertyInfo, bool>)(a => a.Name.ToLower() == "label"));
         if (propertyInfo1 == null && propertyInfo2 == null)
         {
             return;
         }
         foreach (object opt in opts)
         {
             this.AddOption(new LightboxSelectOption(propertyInfo1.GetValue(opt, (object[])null), propertyInfo2.GetValue(opt, (object[])null)));
         }
     }
 }
Exemple #2
0
 public void AddOption(LightboxSelectOption option)
 {
     this.m_serverList.AddOption(option);
 }