public void ChangeLocation(object selectedObject) { LocationNode node = selectedObject as LocationNode; if (!Locations.ContainsKey(node.Id)) { return; } CurrentLocation = Locations[node.Id]; UpdateLocationData(); LocationSelected = true; }
private void AddNode(RhitLocation location) { if (location.Id < 0) { return; } if (TempDict.ContainsKey(location.Id)) { return; } LocationNode node = new LocationNode() { Name = location.Label, Id = location.Id, }; if (location.ParentId <= 0) { LocationTree.Add(node); TempDict[location.Id] = node; return; } if (TempDict.ContainsKey(location.ParentId)) { TempDict[location.ParentId].ChildLocations.Add(node); TempDict[location.Id] = node; return; } if (Locations.ContainsKey(location.ParentId)) { AddNode(Locations[location.ParentId]); TempDict[location.ParentId].ChildLocations.Add(node); TempDict[location.Id] = node; return; } LocationTree.Add(node); TempDict[location.Id] = node; }