Exemple #1
0
        public StationGroup AddStation(Station station)
        {
            StationGroup new_group = FindGroupForStation(station);
            StationGroup old_group = station.Parent as StationGroup;

            if (new_group == old_group && old_group != null)
            {
                return(new_group);
            }

            if (old_group != null)
            {
                old_group.RemoveChild(station);

                if (old_group.ChildCount == 0)
                {
                    RemoveNode(old_group);
                }
            }

            if (new_group == null || old_group == null)
            {
                new_group = CreateGroup(station.Group);
                AddNode(new_group);
            }

            new_group.AddChild(station);
            return(new_group);
        }
Exemple #2
0
        public void RemoveStation(Station station)
        {
            StationGroup group = station.Parent as StationGroup;

            if (group == null)
            {
                return;
            }

            group.RemoveChild(station);
            if (group.ChildCount == 0)
            {
                RemoveNode(group);
            }

            stations.Remove(station);
            stations.Save();
        }