Exemplo n.º 1
0
        private async Task LoadPlaceInfoAsync()
        {
            Uri dataUri = new Uri("ms-appx:///places.txt");

            StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(dataUri);

            IList <string> lines = await FileIO.ReadLinesAsync(file);

            // In the places.txt file, each place is represented by three lines:
            // Place name, latitude, and longitude.
            for (int i = 0; i < lines.Count; i += 3)
            {
                PlaceInfo place = new PlaceInfo
                {
                    Name     = lines[i],
                    Location = new PlaceLocation(double.Parse(lines[i + 1]), double.Parse(lines[i + 2]))
                };

                places.Add(place);
            }
        }
        private async Task LoadPlaceInfoAsync()
        {
            Uri dataUri = new Uri("ms-appx:///places.txt");

            StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(dataUri);
            IList<string> lines = await FileIO.ReadLinesAsync(file);

            // In the places.txt file, each place is represented by three lines:
            // Place name, latitude, and longitude.
            for (int i = 0; i < lines.Count; i += 3)
            {
                PlaceInfo place = new PlaceInfo
                {
                    Name = lines[i],
                    Location = new PlaceLocation(double.Parse(lines[i + 1]), double.Parse(lines[i + 2]))
                };

                places.Add(place);
            }
        }