Exemplo n.º 1
0
        public void ChangeLocation(object selectedObject)
        {
            LocationNode node = selectedObject as LocationNode;

            if (!Locations.ContainsKey(node.Id))
            {
                return;
            }
            CurrentLocation = Locations[node.Id];
            UpdateLocationData();
            LocationSelected = true;
        }
Exemplo n.º 2
0
        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;
        }