Ejemplo n.º 1
0
        private void _parseElement(JsonObject json, Section section, JsonValue data)
        {
            string type = "Unknown";

            try {
                type = json["type"];
                if (type == "HiddenElement")
                {
                    var name = json.s("id");

                    _controller.SetValue(name, data == null? json.s("value") : data.CleanString());
                }
                else
                {
                    string id         = (json.ContainsKey("id") ? json["id"] : null);
                    var    newElement = _parseFunctions[type](json, _controller, data);
                    if (newElement != null)
                    {
                        newElement.ID = id;
                        _elements.Add(newElement);
                        section.Add(newElement);
                    }
                }
            } catch (Exception e) {
                Console.WriteLine("Problem parsing element. Element was skipped. Type: " + type + " = " + e.ToString());
            }
        }