/// <summary> /// Decode the JSON event. /// </summary> /// <param name="json">JSON representation.</param> public override void fromJson(EventJsonData json) { base.fromJson(json); this.element = json.element.ToString(); this.name = json.name.ToString(); this.newValue = json.newValue.ToString(); }
/// <summary> /// Decode the JSON into an event. /// </summary> /// <param name="json">JSON representation.</param> /// <param name="workspace">Target workspace for event.</param> /// <returns>The event represented by the JSON.</returns> public static Events.Abstract fromJson(EventJsonData json, Workspace workspace) { Events.Abstract ev; switch (json.type.ToString()) { case Events.CREATE: ev = new Events.Create(null); break; case Events.DELETE: ev = new Events.Delete(null); break; case Events.CHANGE: ev = new Events.Change(null, null, null, null, null); break; case Events.MOVE: ev = new Events.Move(null); break; case Events.UI: ev = new Events.Ui(null, null, null, null); break; default: throw new Exception("Unknown ev type."); } ev.fromJson(json); ev.workspaceId = workspace.id; return(ev); }
/// <summary> /// Decode the JSON event. /// </summary> /// <param name="json">JSON representation.</param> public override void fromJson(EventJsonData json) { base.fromJson(json); this.newParentId = json.newParentId.ToString(); this.newInputName = json.newInputName.ToString(); if (json.newCoordinate != null) { var xy = (json.newCoordinate.ToString()).Split(","); this.newCoordinate = new goog.math.Coordinate(Script.ParseFloat(xy[0]), Script.ParseFloat(xy[1])); } }
/// <summary> /// Encode the event as JSON. /// </summary> /// <returns>JSON representation.</returns> public virtual EventJsonData toJson() { var json = new EventJsonData(); json.type = this.type; if (this.blockId != null) { json.blockId = this.blockId; } if (this.group != null) { json.group = this.group; } return(json); }
/// <summary> /// Decode the JSON event. /// </summary> /// <param name="json">JSON representation.</param> public override void fromJson(EventJsonData json) { base.fromJson(json); this.ids = json.ids; }
/// <summary> /// Decode the JSON event. /// </summary> /// <param name="json">JSON representation.</param> public override void fromJson(EventJsonData json) { base.fromJson(json); this.xml = (Element)Xml.textToDom("<xml>" + json.xml + "</xml>").FirstChild; this.ids = json.ids; }
/// <summary> /// Decode the JSON event. /// </summary> /// <param name="json">JSON representation.</param> public virtual void fromJson(EventJsonData json) { this.blockId = json.blockId.ToString(); this.group = json.group.ToString(); }