Exemplo n.º 1
0
        /// <summary>
        /// Gets the preferred command station (state) for the given address type.
        /// </summary>
        private ICommandStationState GetPreferredCommandStationState(AddressType addressType)
        {
            ICommandStation entity = null;

            switch (addressType)
            {
            case AddressType.Dcc:
                entity = Entity.PreferredDccCommandStation;
                break;

            case AddressType.LocoNet:
                entity = Entity.PreferredLocoNetCommandStation;
                break;

            case AddressType.Motorola:
                entity = Entity.PreferredMotorolaCommandStation;
                break;

            case AddressType.Mfx:
                entity = Entity.PreferredMfxCommandStation;
                break;

            case AddressType.BinkyNet:
                entity = Entity.PreferredBinkyNetCommandStation;
                break;

            default:
                throw new ArgumentException("Unknown address type: " + addressType);
            }
            if ((entity == null) || (!commandStationStates.Contains(entity)))
            {
                return(null);
            }
            return(CommandStationStates[entity]);
        }
Exemplo n.º 2
0
 public override object Visit(ICommandStation entity, IRailway data)
 {
     data.CommandStations.Add(entity);
     return(null);
 }
Exemplo n.º 3
0
 public virtual TReturn Visit(ICommandStation entity, TData data)
 {
     return(default(TReturn));
 }
Exemplo n.º 4
0
 public override object Visit(ICommandStation entity, IPackage data)
 {
     data.Remove(entity);
     return(null);
 }
Exemplo n.º 5
0
 public override IEntityState Visit(ICommandStation entity, IRailwayState data)
 {
     return(data.CommandStationStates[entity]);
 }