/// <summary> /// Applies the json dictionary. /// </summary> /// <param name="dict">The dictionary.</param> public void ApplyJsonDictionary(Dictionary <string, object> dict) { #if PORTING foreach (string key in dict.Keys) { //SEL sel = NSSelectorFromString(key); if (key.StartsWith("field") || key.StartsWith("selectedfield")) { this.SetValueForKey(dict[key], key); } const char type = this.TypeOfPropertyNamed(key); if (type) { string typeInfo = NSString.StringWithCStringEncoding(type, NSUTF8StringEncoding); object value; if (typeInfo.HasPrefix("T@\"UPColor\"")) { // UPColor conversion AureaColor upcolor = AureaColor.ColorWithString((string)dict[key]); value = upcolor; } else if (typeInfo.HasPrefix("T{CGSize=ff}")) { ArrayList array = (ArrayList)dict[key]; NSNumber width = array[0]; NSNumber height = array[1]; value = NSValue.ValueWithCGSize(CGSizeMake(width.FloatValue(), height.FloatValue())); } else if (typeInfo.HasPrefix("T@\"UIFont\"")) { ArrayList array = (ArrayList)dict.ObjectForKey(key); string familyName = array[0]; NSNumber size = array[1]; value = UIFont.FontWithNameSize(familyName, size.FloatValue()); } else if (typeInfo.HasPrefix("T@\"UPMCoIEdgeViewConfig\"") || typeInfo.HasPrefix("T@\"UPMCoINodeViewConfig\"")) { UPMCoIConfigBase base = this.ValueForKey(key); value = dict.ObjectForKey(key); if (value.IsKindOfClass(NSDictionary.TheClass)) { base.ApplyJsonDictionary(value); } continue; } else { value = dict[key]; } this.SetValueForKey(value, key); } } #endif }