MonoTouch.Dialog.JsonElement.LoadSectionElements C# (CSharp) Method

LoadSectionElements() private method

private LoadSectionElements ( Section section, JsonArray array, object data ) : void
section Section
array JsonArray
data object
return void
		void LoadSectionElements (Section section, JsonArray array, object data)
		{
			if (array == null)
				return;

			for (int i = 0; i < array.Count; i++){
				Element element = null;

				try {
					var json = array [i] as JsonObject;
					if (json == null)
						continue;

					var type = GetString (json, "type");
					switch (type){
					case "bool": case "boolean":
						element = LoadBoolean (json);
						break;

					case "entry": case "password":
						element = LoadEntry (json, type == "password");
						break;

					case "string":
						element = LoadString (json, data);
						break;

					case "root":
						element = FromJson (this, json, data);
						break;

					case "radio":
						element = LoadRadio (json, data);
						break;

					case "checkbox":
						element = LoadCheckbox (json, data);
						break;

					case "datetime":
					case "date":
					case "time":
						element = LoadDateTime (json, type);
						break;

					case "html":
						element = LoadHtmlElement (json);
						break;

					default:
						Error ("json element at {0} contain an unknown type `{1}', json {2}", i, type, json);
						break;
					}

					if (element != null){
						var id = GetString (json, "id");
						if (id != null)
							AddMapping (id, element);
					}
				} catch (Exception e) {
					Console.WriteLine ("Error processing Json {0}, exception {1}", array, e);
				}
				if (element != null)
					section.Add (element);
			}
		}
	}