Пример #1
0
        private static void ReadCarriage(XElement carriageSetElement)
        {
            EntityData.CarriageList = new Dictionary <string, PassengerPlot.Carriage>();

            foreach (XElement element in carriageSetElement.Elements("Carriage"))
            {
                Carriage ca = new Carriage()
                {
                    LineID             = element.Attribute("LineID").Value,
                    RouteID            = element.Attribute("RouteID").Value,
                    DepartureID        = element.Attribute("DepartureID").Value,
                    ReferenceVehicleID = element.Attribute("ReferenceVehicleID").Value
                };
                EntityData.CarriageList.Add(ca.ReferenceVehicleID, ca);

                foreach (XElement eventElement in element.Element("EventList").Elements("Event"))
                {
                    CarriageEvent e = new CarriageEvent()
                    {
                        AttachedCarriage     = ca,
                        AttachedStopFacility = EntityData.StopFacilityList[eventElement.Attribute("AttachedStopFacilityID").Value],
                        Time = Convert.ToInt32(eventElement.Attribute("Time").Value),
                        Type = (CarriageEventTypes)Enum.Parse(typeof(CarriageEventTypes), eventElement.Attribute("Type").Value)
                    };
                    ca.EventList.Add(e);
                }
            }
        }
Пример #2
0
        private PassengerEvent SearchCarriage(Passenger passenger, string eventType, string vehID, int time)
        {
            if (!EntityData.CarriageList.ContainsKey(vehID))
            {
                throw new ApplicationException("Can't find carriage!");
            }

            Carriage            carriage = EntityData.CarriageList[vehID];
            PassengerEventTypes eType    = PassengerEventTypes.TripStart;

            if (eventType == "arriveAt")
            {
                eType = PassengerEventTypes.TripEnd;
            }
            TripTypes tripType = TripTypes.Public;

            PassengerTripEvent e = new PassengerPlot.PassengerTripEvent()
            {
                AttachedPassenger = passenger,
                AttachedCarriage  = carriage,
                Type     = eType,
                TripType = tripType,
                Time     = time,
            };

            return(e);
        }
Пример #3
0
 public Form_CarriageInfo(Carriage carriage)
 {
     InitializeComponent();
     this.DataContext     = carriage;
     dg_event.ItemsSource = carriage.EventList;
 }