private Dictionary <string, string> ProcessDataValueDictionary(Dictionary <string, DataValue> dict) { Dictionary <string, string> returnDictionary = new Dictionary <string, string>(); foreach (KeyValuePair <string, DataValue> kvp in dict) { switch (kvp.Value.dataType) { case "IntegerType": case "DoubleType": case "StringType": case "BooleanType": returnDictionary.Add(kvp.Key, DataValueFactory.ToString(kvp.Value)); break; default: //handle case by case. Location.X, Location.Y probably best way to add multiple entry DVs break; } } return(returnDictionary); }
private void UpdateAttributeDict() { if (objectProxies == null) { return; } foreach (string id in objectProxies.Keys) { if (!listBoxObjects.Items.Contains(id)) { listBoxObjects.Items.Add(id); } } if (listBoxObjects == null) { return; } foreach (string id2 in listBoxObjects.Items) { if (!objectProxies.ContainsKey(id2)) { listBoxObjects.Items.Remove(id2); } } if (treeViewObjectInfo == null) { return; } foreach (TreeNode tn in treeViewObjectInfo.Nodes) { if (tn.Name != (string)listBoxObjects.SelectedItem) { treeViewObjectInfo.Nodes.Remove(tn); } } if (listBoxObjects.SelectedItem != null) { string id3 = (string)listBoxObjects.SelectedItem; if (treeViewObjectInfo.Nodes.ContainsKey(id3)) { foreach (string key in objectProxies[id3].GetKeys()) { treeViewObjectInfo.Nodes[id3].Nodes[key].Text = String.Format("{0} = {1}", key, DataValueFactory.ToString(objectProxies[id3][key].GetDataValue())); } } else { treeViewObjectInfo.Nodes.Add(id3, String.Format("{0} : {1}", objectProxies[id3].GetObjectType().ToString(), id3)); foreach (string key in objectProxies[id3].GetKeys()) { treeViewObjectInfo.Nodes[id3].Nodes.Add(key, String.Format("{0} = {1}", key, DataValueFactory.ToString(objectProxies[id3][key].GetDataValue()))); } treeViewObjectInfo.Nodes[id3].Expand(); } } //string output; //if (selectedObjectID != null) //{ // objectAttributes = ((Form1)Owner).GetObjectAttributes(selectedObjectID); // treeViewObjectInfo.Nodes.Clear(); // foreach (string s in objectAttributes.Keys) // { // output = String.Format("{0} = {1}", s, objectAttributes[s]); // treeViewObjectInfo.Nodes.Add(String.Format("{0} = {1}", s, objectAttributes[s])); // } //} }
private void UpdateObjectsList() { if (!objectStatus.Checked) { return; } if (bbClient == null) { objectListBox.Items.Clear(); return; } Dictionary <string, SimulationObjectProxy> objectPoxies = bbClient.GetObjectProxies(); //objectListBox.Items.Clear(); foreach (string id in objectPoxies.Keys) { if (!objectListBox.Items.Contains(id)) { objectListBox.Items.Add(id); } } List <string> idsToRemove = new List <string>(); foreach (string id2 in objectListBox.Items) { if (!objectPoxies.ContainsKey(id2)) { idsToRemove.Add(id2); //objectListBox.Items.Remove(id2); } } foreach (string id4 in idsToRemove) { objectListBox.Items.Remove(id4); } //objectAttributeList.Items.Clear(); //treeView1.Nodes.Clear(); foreach (TreeNode tn in treeView1.Nodes) { if (tn.Name != (string)objectListBox.SelectedItem) { treeView1.Nodes.Remove(tn); } } SimulationObjectProxy prox = null; if (objectListBox.SelectedItem != null) { string id3 = (string)objectListBox.SelectedItem; if (objectPoxies.ContainsKey(id3)) { prox = objectPoxies[id3]; string objectType = prox.GetObjectType(); Dictionary <string, string> treeData = new Dictionary <string, string>(); string s; DataValue dv; foreach (string key in prox.GetKeys()) { dv = prox[key].GetDataValue(); s = DataValueFactory.ToString(dv); treeData[key] = key + " = " + s; } if (treeView1.Nodes.ContainsKey(id3)) { foreach (string key in treeData.Keys) { treeView1.Nodes[id3].Nodes[key].Text = treeData[key]; } } else { treeView1.Nodes.Add(id3.ToString(), objectType + ": " + id3); foreach (string key in treeData.Keys) { treeView1.Nodes[id3.ToString()].Nodes.Add(key, treeData[key]); } treeView1.Nodes[id3.ToString()].Expand(); } } } //treeView1.Update(); //treeView1.Refresh(); }