Example #1
0
 public BusStopViewController(StopInfo stopInfo)
 {
     _stopInfo = stopInfo;
     _busStopRepository.AddMostRecent(_stopInfo);
     this.Title = _stopInfo.StopName;
 }
Example #2
0
 public void AddFavorite(StopInfo stopInfo)
 {
     _favorites.Add(stopInfo);
 }
Example #3
0
 public void AddMostRecent(StopInfo stopInfo)
 {
     _mostRecent.Add(stopInfo);
 }
Example #4
0
        private void ReadStopInfo()
        {
            Stops = new List<StopInfo>();

            Debug.WriteLine("Exists? " + File.Exists(Path.Combine(Environment.CurrentDirectory, "Data/R1615.HPL")));

            try
            {
                using (var fileStream = File.Open(Path.Combine(Environment.CurrentDirectory, "Data/R1615.HPL"), FileMode.Open, FileAccess.Read))
                using (var reader = new StreamReader(fileStream))
                {
                    while (!reader.EndOfStream)
                    {
                        var line = reader.ReadLine();
                        var stopInfo = new StopInfo(line);
                        Stops.Add(stopInfo);
                    }
                }
            }
            catch(Exception ex)
            {
                Debug.WriteLine(ex.ToString());
                throw;
            }

            Stops = Stops.OrderBy(si => si.StopName).ToList();
        }