コード例 #1
0
ファイル: Scenario7.xaml.cs プロジェクト: ice0/test
        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);
            }
        }
コード例 #2
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);
            }
        }