public RemoteLoconetServiceUserControl(RemoteLoconetService loconet, RemoteLoconetSlot [] slots) : this() { if (slots == null) { return; } for (int i = 0; i < slots.Length; ++i) { m_bsDataSource.Add(slots[i]); } //m_bsDataSource = slots; /* * m_gridMain.Rows.Add(slots.Length); * * for (int i = 0; i < slots.Length; ++i) * { * var row = m_gridMain.Rows[i]; * var slot = slots[i]; * * row.Cells[0].Value = i; * row.Cells[1].Value = slot.State; * row.Cells[2].Value = slot.LocomotiveAddress; * row.Cells[3].Value = slot.Forward ? "FWD" : "BWD"; * row.Cells[4].Value = slot.Speed.ToString(); * } */ }
private static RemoteObject RegisterObject(JsonValue objectDef) { ulong id = objectDef["internalId"]; string className = objectDef["className"]; string name = objectDef["name"]; string path = objectDef["path"]; ulong parentInternalId = objectDef.ContainsKey("parentInternalId") ? (ulong)objectDef["parentInternalId"] : 0; RemoteObject obj; switch (className) { case "dcclite::Shortcut": obj = new RemoteShortcut(name, className, path, id, parentInternalId, objectDef["target"]); break; case "Decoder": case "OutputDecoder": case "SimpleOutputDecoder": case "SensorDecoder": case "ServoTurnoutDecoder": case "TurnoutDecoder": obj = new RemoteDecoder(name, className, path, id, parentInternalId, objectDef); break; case "SignalDecoder": obj = new RemoteSignalDecoder(name, className, path, id, parentInternalId, objectDef); break; case "NetworkDevice": obj = new RemoteDevice(name, className, path, id, parentInternalId, objectDef); break; case "Location": obj = new RemoteLocation(name, className, path, id, parentInternalId, objectDef); break; case "LocationManager": obj = new RemoteLocationManager(name, className, path, id, parentInternalId, objectDef); break; case "LoconetService": obj = new RemoteLoconetService(name, className, path, id, parentInternalId, objectDef); break; default: obj = objectDef["isFolder"] ? new RemoteFolder(name, className, path, id, parentInternalId) : new RemoteObject(name, className, path, id, parentInternalId); break; } gObjects.Add(id, obj); gObjectsByPath.Add(obj.Path, obj); return(obj); }