public RemoteParam(RemoteConn conn, RemoteObj parent) { this.Conn = conn; this.Parent = parent; }
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); } }
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); } } }
// if user selects a project form the project list private void listProjects_SelectedIndexChanged(object sender, EventArgs e) { treeObjects.Nodes.Clear(); string prjID = (string)listProjects.SelectedValue; // open the project user selected RemoteObj project = Remote.OpenProject(prjID); // get the objects of the currently open project this.ActiveProject = Remote.GetObject(prjID); // populate the project tree with the objects (and their parameters) TreeNode t = new TreeNode(); treeObjects.Nodes.Add(t); PopulateProjectTree(this.ActiveProject, t); treeObjects.SelectedNode = t; }
private void PopulateProjectTree(RemoteObj o, TreeNode t) { string objID = ""; string objName = ""; string objType = ""; for (int i = 0; i < o.Params.Count(); i++ ) { RemoteParam p = o.Params.Get(i); if (p.Name == "ID") objID = p.Value.AsText(); if (p.Name == "N") objName = p.Value.AsText(); if (p.Name == "T") objType = p.Value.AsText(); TreeNode pt = new TreeNode(); pt.Name = p.Parent.GetID() + "_" + p.Name; t.Nodes.Add(pt); pt.Text = p.Name + " = " + p.Value.AsText(); pt.Tag = p.Name; } t.Text = objName + "(" + objType + ")"; t.Tag = objID; for (int i = 0; i < o.Objects.Count(); i++ ) { TreeNode st = new TreeNode(); t.Nodes.Add(st); t.Name = o.Objects.Get(i).GetID(); PopulateProjectTree(o.Objects.Get(i), st); } }
private void DisplayParamEditObj(RemoteObj o) { panelObj.Visible = true; panelParam.Visible = false; }
public RemoteObj RemoteSend(string method, string arg0 = null, string arg1 = null, string arg2 = null, string arg3 = null, string arg4 = null, string arg5 = null, string arg6 = null) { string s = (string)this.browser.Explorer.Document.InvokeScript("APIConn", new object[] { method, arg0, arg1, arg2, arg3, arg4, arg5, arg6 }); if (s == null) { return null; } System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); var o = (Dictionary<string, object>) serializer.DeserializeObject(s); RemoteObj ret = new RemoteObj(this, null); ret.Parse(o); return ret; }
public void Set(int index, RemoteObj item) { items[index] = item; }
public void Remove(RemoteObj item) { items.Remove(item); }
public void Add(RemoteObj item) { items.Add(item); }