示例#1
0
        public void setComplete(GlobalItem segment)
        {
            complete = true;

            if (segment.GetType() == typeof(TrackSegment) && ((TrackSegment)segment).HasConnector != null)
            {
                outLabel = ((TrackSegment)segment).HasConnector.label;
            }
            else if (segment.GetType() == typeof(AEBufferItem))
            {
                outLabel = ((AEBufferItem)segment).NameBuffer;
            }
        }
 /// <summary>
 /// Use this function to add a new item into the 'AllItems' list.
 /// </summary>
 /// <param name="item"></param>
 public void AddItem(GlobalItem item)
 {
     if (item == null)
     {
         return;
     }
     //if (!(sideItem is PathEventItem) && !(sideItem is SideStartItem))
     if (item.asMetadata)
     {
         if (routeItems.IndexOf(item) < 0)
         {
             routeItems.Add(item);
         }
     }
     if (AllItems.IndexOf(item) < 0)
     {
         AllItems.Add(item);
     }
     toSave = true;
     if (item.GetType() == typeof(StationItem))
     {
         foreach (StationAreaItem SAItem in ((StationItem)item).stationArea)
         {
             AllItems.Add(SAItem);
         }
     }
 }
 /// <summary>
 /// Used to remove a connector item from the 'AllItem' list.
 /// </summary>
 /// <param name="item"></param>
 public void RemoveConnectorItem(GlobalItem item)
 {
     if (item.GetType() == typeof(StationAreaItem))
     {
         AllItems.Remove(item);
         routeItems.Remove(item);
     }
 }
 /// <summary>
 /// Used to remove an item from all list of items: AllItems, RouteItems
 /// </summary>
 /// <param name="item">the item to remove</param>
 public void RemoveItem(GlobalItem item)
 {
     if (item.GetType() == typeof(StationItem))
     {
         foreach (var point in ((StationItem)item).stationArea)
         {
             RemoveConnectorItem(point);
         }
         ((StationItem)item).stationArea.Clear();
     }
     AllItems.Remove(item);
     routeItems.Remove(item);
     toSave = true;
 }