예제 #1
0
파일: Utils.cs 프로젝트: ikvm/webmatrix
 internal static void SetDeviceSpecificChoice(MobileControl mobileControl, DeviceSpecificChoice choice)
 {
     typeof(DeviceSpecific).InvokeMember("SetDesignerChoice", BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, mobileControl.get_DeviceSpecific(), new object[] { choice });
 }
예제 #2
0
파일: Utils.cs 프로젝트: ikvm/webmatrix
 internal static void InitializeOverridenProperties(MobileControl mobileControl, Hashtable overridenValues)
 {
     overridenValues.Clear();
     if (mobileControl.get_DeviceSpecific() != null)
     {
         foreach (DeviceSpecificChoice choice in mobileControl.get_DeviceSpecific().get_Choices())
         {
             Hashtable hashtable = new Hashtable();
             overridenValues[CreateUniqueChoiceName(choice)] = hashtable;
             IDictionaryEnumerator enumerator = choice.get_Contents().GetEnumerator();
             while (enumerator.MoveNext())
             {
                 int num;
                 object component = mobileControl;
                 string key = (string) enumerator.Key;
                 while ((num = key.IndexOf("-")) != -1)
                 {
                     string name = key.Substring(0, num);
                     component = TypeDescriptor.GetProperties(component).Find(name, true).GetValue(component);
                     key = key.Substring(num + 1);
                 }
                 PropertyDescriptor descriptor = TypeDescriptor.GetProperties(component).Find(key, true);
                 try
                 {
                     hashtable[enumerator.Key] = descriptor.Converter.ConvertFromInvariantString((string) enumerator.Value);
                     continue;
                 }
                 catch (Exception)
                 {
                     continue;
                 }
             }
         }
     }
 }