示例#1
0
        /// <summary>
        ///   Initializes a new instance.
        /// </summary>
        public Model(PreControl preControl, MainControl mainControl, EndControl endControl, Vehicle[] vehicles = null)
        {
            vehicles = vehicles ?? new[]
            {
                new Vehicle {
                    Kind = VehicleKind.OverheightVehicle
                },
                new Vehicle {
                    Kind = VehicleKind.OverheightVehicle
                },
                new Vehicle {
                    Kind = VehicleKind.HighVehicle
                }
            };

            VehicleSet = new VehicleSet(vehicles);
            VehicleSet.FinishedObserver = new FinishedObserverDisabled();

            SetupController(preControl);
            SetupController(mainControl);
            SetupController(endControl);

            HeightControl = new HeightControl(preControl, mainControl, endControl);
            Bind(nameof(VehicleSet.IsTunnelClosed), nameof(HeightControl.TrafficLights.IsRed));
        }
示例#2
0
文件: Model.cs 项目: cubeme/ssharp
        /// <summary>
        ///   Initializes a new variant with the given control types.
        /// </summary>
        public static Model CreateVariant(PreControl preControl, MainControl mainControl, EndControl endControl, Vehicle[] vehicles = null)
        {
            var model = new Model(vehicles);

            model.SetupController(preControl);
            model.SetupController(mainControl);
            model.SetupController(endControl);

            model.HeightControl = new HeightControl
            {
                PreControl    = preControl,
                MainControl   = mainControl,
                EndControl    = endControl,
                TrafficLights = new TrafficLights()
            };

            return(model);
        }