コード例 #1
0
        public static async Task <List <string> > GetStaionNames(string type)
        {
            stations = await Stations.GetAllStationsAsync();

            var mot            = MeansOfTransportWrapper.GetMeansOfTransportFromString(type);
            var listOfStations = (from v in stations
                                  from p in v.Platforms
                                  where p.MeansOfTransport == mot
                                  select v.Name).Distinct().ToList();

            return(listOfStations);
        }
コード例 #2
0
        /// <summary>
        /// Downloads the 3 static CSV files and parses them to their corresponding models
        /// </summary>
        private void DownloadFiles()
        {
            var stationsA  = DownloadAsync(StationsLink).Result;
            var linesA     = DownloadAsync(LinesLink).Result;
            var platformsA = DownloadAsync(PlatformsLink).Result;

            var listStations = stationsA.Remove(stationsA.LastIndexOf((Environment.NewLine), StringComparison.Ordinal))
                               .Split(new[] { Environment.NewLine }, StringSplitOptions.None)
                               .Skip(1)
                               .Select(columns => columns.Split(';'))
                               .Select(columns => new HaltestellenModel
            {
                StationId      = columns[0].Replace("\"", ""),
                Typ            = columns[1].Replace("\"", ""),
                Diva           = columns[2].Replace("\"", ""),
                Name           = (columns[3]).Replace("\"", ""),
                Municipality   = columns[4].Replace("\"", ""),
                MunicipalityId = columns[5].Replace("\"", ""),
                Wgs84Lat       = columns[6].Replace("\"", ""),
                Wgs84Lon       = columns[7].Replace("\"", ""),
            }
                                       )
            ;

            Haltetellen = listStations.ToList();
            var listLines = linesA.Remove(linesA.LastIndexOf((Environment.NewLine), StringComparison.Ordinal))
                            .Split(new[] { Environment.NewLine }, StringSplitOptions.None)

                            .Skip(1)
                            .Select(columns => columns.Split(';'))
                            .Select(columns => new LinienModel
            {
                LineId           = columns[0].Replace("\"", ""),
                Description      = columns[1].Replace("\"", ""),
                Order            = columns[2].Replace("\"", ""),
                Realtime         = columns[3].Replace("\"", ""),
                MeansOfTransport = MeansOfTransportWrapper.GetMeansOfTransportFromString(columns[4].Replace("\"", "")),
                Stand            = columns[5].Replace("\"", "")
            })
            ;

            Lines = listLines.ToList();
            var listPlatforms = platformsA.Remove(platformsA.LastIndexOf((Environment.NewLine), StringComparison.Ordinal))

                                .Split(new[] { Environment.NewLine }, StringSplitOptions.None)

                                .Skip(1)
                                .Select(columns => columns.Split(';'))
                                .Select(columns => new SteigModel
            {
                PlatformId       = columns[0].Replace("\"", ""),
                FkLineId         = columns[1].Replace("\"", ""),
                FkStationId      = columns[2].Replace("\"", ""),
                Direction        = columns[3].Replace("\"", ""),
                Order            = columns[4].Replace("\"", ""),
                RblNumber        = columns[5].Replace("\"", ""),
                Area             = columns[6].Replace("\"", ""),
                Platform         = columns[7].Replace("\"", ""),
                PlatformWgs84Lat = columns[8].Replace("\"", ""),
                PlatformWgs84Lon = columns[9].Replace("\"", ""),
                Stand            = columns[10].Replace("\"", "")
            })
            ;

            Platforms = listPlatforms.ToList();
            //  System.Diagnostics.Debug.WriteLine(Platforms[0].RblNumber);
        }