Esempio n. 1
0
        }//btnGo_Click

        /// <summary>
        ///  This method handles adding a new stop into the journey
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddStop_Click(object sender, EventArgs e)
        {
            Add_Stop newStop = new Add_Stop();                //Create temp new stop

            newStop.ShowDialog();
            //If the journey is null instantiate it, otherwise add node
            if (journey == null)
            {
                journey = new Journey(newStop.NewStop, 50);
                updateRemoveList();
            }
            else
            {
                journey.AddStop(newStop.NewStop);
                updateRemoveList();
            }//else

            //Loop through the stops and display them
            Stop tracker = journey.FirstStop;

            lblStops.Text = "Stops:";
            do
            {
                lblStops.Text += tracker.getStopDetails();
                tracker        = tracker.NextStop;
            } while (tracker != null);
        }//btnAddStop_Click
Esempio n. 2
0
        }//btnGo_Click

        /// <summary>
        ///  This method handles adding a new stop into the journey
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddStop_Click(object sender, EventArgs e)
        {
            if (detectCurrTrain() != null)
            {
                Journey  journey = detectCurrTrain().TrainJourney;
                Add_Stop newStop = new Add_Stop(journey);           //Create temp new stop
                newStop.ShowDialog();
                //If the journey is null instantiate it, otherwise add node
                if (journey == null)
                {
                    detectCurrTrain().TrainJourney = new Journey(newStop.NewStop, newStop.Speed);
                    lblSpeed.Text += newStop.Speed;
                }
                else
                {
                    journey.AddStop(newStop.NewStop);
                }//else

                displayJourney();
            } //if
        }     //btnAddStop_Click