Esempio n. 1
0
        public override void onClick(MapViewWindow view, Location loc, Point ab)
        {
            JunctionRailRoad jrr = JunctionRailRoad.get(loc);

            if (jrr != null)
            {
                Form dialog = new JunctionConfigDialog(controller.getOrCreateJunction(loc));
                dialog.ShowDialog(MainWindow.mainWindow);
                return;
            }

            Voxel v = World.world[loc];

            if (v == null)
            {
                return;
            }

            TrainHarbor harbor = (TrainHarbor)v.queryInterface(typeof(TrainHarbor));

            if (harbor != null)
            {
                StationHandler      handler = controller.getStationHandler(harbor);
                StationConfigDialog dialog  = new StationConfigDialog(handler);
                dialog.ShowDialog(MainWindow.mainWindow);
                controller.setStationHandler(harbor, dialog.currentHandler);
                return;
            }
        }
Esempio n. 2
0
        internal StationConfigDialog(StationHandler _currentHandler)
        {
            InitializeComponent();

            if (_currentHandler == null)
            {
                _currentHandler = StationHandler.defaultHandler;
            }

            if (_currentHandler is PassStationHandler)
            {
                radioPass.Checked = true;
            }
            if (_currentHandler is FixedDurationStationHandler)
            {
                FixedDurationStationHandler fdsh = (FixedDurationStationHandler)_currentHandler;
                durationBox.Value          = fdsh.duration.totalMinutes;
                checkTurn1.Checked         = fdsh.turnAround;
                radioFixedDuration.Checked = true;
            }
            if (_currentHandler is OnceADayStationHandler)
            {
                OnceADayStationHandler oash = (OnceADayStationHandler)_currentHandler;
                hourBox.Value       = oash.minutes / 60;
                minBox.Value        = oash.minutes % 60;
                checkTurn2.Checked  = oash.turnAround;
                radioSimple.Checked = true;
            }
            if (_currentHandler is AdvancedStationHandler)
            {
                radioAdvanced.Checked = true;
            }

            this.currentHandler = _currentHandler;
        }
Esempio n. 3
0
        private void buttonAdvanced_Click(object sender, System.EventArgs e)
        {
            if (!(currentHandler is AdvancedStationHandler))
            {
                currentHandler = new AdvancedStationHandler();
            }

            new StationAdvancedDialog((AdvancedStationHandler)currentHandler).ShowDialog(this);
        }
Esempio n. 4
0
        public override TimeLength getStopTimeSpan(Train train, TrainHarbor harbor, int callCount)
        {
            StationHandler handler = getStationHandler(harbor);

            if (handler != null)
            {
                return(handler.getStopTimeSpan(callCount));
            }
            else
            {
                return(StationHandler.defaultHandler.getStopTimeSpan(callCount));
            }
        }
Esempio n. 5
0
 private void onOK(object sender, System.EventArgs e)
 {
     if (radioFixedDuration.Checked)
     {
         currentHandler = new FixedDurationStationHandler(TimeLength.fromMinutes((long)durationBox.Value), checkTurn1.Checked);
     }
     if (radioPass.Checked)
     {
         currentHandler = new PassStationHandler();
     }
     if (radioSimple.Checked)
     {
         currentHandler = new OnceADayStationHandler(getMinutes(), checkTurn2.Checked);
     }
     if (radioAdvanced.Checked)
     {
         if (!(currentHandler is AdvancedStationHandler))
         {
             currentHandler = new AdvancedStationHandler();
         }
     }
 }
Esempio n. 6
0
 internal void setStationHandler(TrainHarbor harbor, StationHandler handler)
 {
     stations[harbor.location] = handler;
 }