internal void Parse(Dictionary<string, object> data) { if (data.ContainsKey("status")) this.Success = ((string)data["status"]) == "success"; if (data.ContainsKey("error")) this.Error = (string) data["error"]; if (data.ContainsKey("id")) this.ID = (string) data["id"]; if (data.ContainsKey("name")) this.Name = (string)data["name"]; if (data.ContainsKey("firstname")) this.FirstName = (string)data["firstname"]; if (data.ContainsKey("lastname")) this.LastName = (string)data["lastname"]; if (data.ContainsKey("email")) this.Email = (string)data["email"]; if (data.ContainsKey("params")) { object[] parameters = (object[])data["params"]; for (int i = 0; i < parameters.Length; i++) { RemoteParam p = new RemoteParam(this.Conn, this); p.Parse((Dictionary<string, object>)parameters[i]); this.Params.Add(p); } } if (data.ContainsKey("objects")) { object[] objects = (object[]) data["objects"]; for(int i=0; i < objects.Length; i++) { RemoteObj o = new RemoteObj(this.Conn, this); o.Parse((Dictionary<string, object>)objects[i]); this.Objects.Add(o); } } }
private void treeObjects_AfterSelect(object sender, TreeViewEventArgs e) { if (e.Node.Nodes.Count == 0) { // parameter node string objectID = (string)e.Node.Parent.Tag; string paramName = (string)e.Node.Tag; RemoteObj o = this.ActiveProject.GetObject(objectID); RemoteParam p = o.GetParam(paramName); this.ActiveParameter = p; this.ActiveObject = null; this.DisplayParamEditPanel(p); } else { // object node string objectID = (string)e.Node.Tag; RemoteObj o = this.ActiveProject.GetObject(objectID); this.ActiveParameter = null; this.ActiveObject = o; this.DisplayParamEditObj(o); } }
private void DisplayParamEditPanel(RemoteParam p) { panelObj.Visible = false; panelParam.Visible = true; txtParamName.Text = p.Name; txtParamDesc.Text = p.Desc; txtExpression.Text = p.Expr; txtValue.Text = p.Value.AsText(); if (p.Type.ToLower() == "number") listParamType.SelectedIndex = 0; // numeric type else listParamType.SelectedIndex = 1; // text type listParamUnitType.SelectedIndex = RemoteParam.StringToUnitType(p.UType); txtUnitCategory.Text = p.UCat; listRole.SelectedIndex = (p.DisplayRole == "userinput" ? 1 : 0); txtUnitCategory.Text = p.DisplayCategory; if (p.DisplayWidth == null) listDisplayWidth.SelectedIndex = 1; else listDisplayWidth.SelectedIndex = int.Parse(p.DisplayWidth); }
public void Set(int index, RemoteParam item) { items[index] = item; }
public void Remove(RemoteParam item) { items.Remove(item); }
public void Add(RemoteParam item) { items.Add(item); }