Пример #1
0
 /// <summary>
 /// A method that does nothing
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="z"></param>
 public void NewRoute(Station x, Station y, decimal z)
 {
     if (_routes == null)
     {
         _routes = new RouteList();
     }
     _routes.AddRoute(new Route(x, y, z));
 }
Пример #2
0
        /// <summary>
        /// Adds a route to the RouteList using the currently selected station, the selected end station and the
        /// price that has been entered. It then repopulates the list box to include the new route and notifies
        /// all the observers of the new route so that they can be used in the single journey ticket option on
        /// the TokenMachineGUI.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCreateRoute_Click(object sender, EventArgs e)
        {
            routes.AddRoute(new Route((Station)cbSelectStation.SelectedItem, (Station)cbEndStationEntry.SelectedItem, decimal.Parse(tbPriceEntry.Text)));

            lbRoutes.Items.Clear();
            foreach (var route in routes.GetAllRoutes())
            {
                if (route.GetStartPoint().ToString() == cbSelectStation.SelectedItem.ToString())
                {
                    lbRoutes.Items.Add(route.GetEndPoint());
                }
            }
            routes.NotifyObservers();
        }
Пример #3
0
 private void RouteSetup() {
     StationList _stations = new StationList();
     _stations = LoadStations(_stations);
     routes.AddRoute(new Route(_stations.GetStationByLocation("Sheffield"), _stations.GetStationByLocation("Meadowhall"), 25.00m));
     routes.AddRoute(new Route(_stations.GetStationByLocation("Sheffield"), _stations.GetStationByLocation("Leeds"), 15.00m));
     routes.AddRoute(new Route(_stations.GetStationByLocation("Nottingham"), _stations.GetStationByLocation("Sheffield"), 12.50m));
     routes.AddRoute(new Route(_stations.GetStationByLocation("London"), _stations.GetStationByLocation("Brighton"), 23.00m));
     routes.AddRoute(new Route(_stations.GetStationByLocation("Manchester"), _stations.GetStationByLocation("Liverpool"), 27.60m));
     routes.AddRoute(new Route(_stations.GetStationByLocation("Liverpool"), _stations.GetStationByLocation("Sheffield"), 32.00m));
     routes.AddRoute(new Route(_stations.GetStationByLocation("London"), _stations.GetStationByLocation("Birmingham"), 39.50m));
     routes.AddRoute(new Route(_stations.GetStationByLocation("Birmingham"), _stations.GetStationByLocation("London"), 39.50m));
     routes.AddRoute(new Route(_stations.GetStationByLocation("Edinburgh"), _stations.GetStationByLocation("Glasgow"), 10.00m));
     routes.AddRoute(new Route(_stations.GetStationByLocation("Edinburgh"), _stations.GetStationByLocation("London"), 70.00m));
     routes.AddRoute(new Route(_stations.GetStationByLocation("Plymouth"), _stations.GetStationByLocation("Ipswich"), 26.00m));
 }