internal async void OpenGpxFile(BikeTouringGISMapViewModel mapViewModel, string path) { if (_loadedFiles.Exists(x => x.Equals(path))) { return; } var gpxFileInformation = new GpxFileReader().LoadFile(path); foreach (var track in gpxFileInformation.Tracks) { bool convertTrack = ConvertTracksToRoutesAutomatically; var convertTrackDialogResult = convertTrack ? MessageDialogResult.Affirmative : MessageDialogResult.FirstAuxiliary; if (!convertTrack) { StringBuilder textBuilder = new StringBuilder(); textBuilder.AppendLine($"Track {track.Name} is defined as track and not as route"); textBuilder.AppendLine(); textBuilder.AppendLine("routes are used by navigation-devices"); textBuilder.AppendLine("tracks are to register where you have been"); textBuilder.AppendLine(); textBuilder.AppendLine("Do you want to convert it to a route?"); convertTrackDialogResult = await ConvertTrackToRoute(textBuilder.ToString()); } switch (convertTrackDialogResult) { case MessageDialogResult.Affirmative: track.IsConvertedToRoute = true; break; case MessageDialogResult.Negative: break; case MessageDialogResult.FirstAuxiliary: return; } } _loadedFiles.Add(path); var geometryFactory = new GeometryFactory(gpxFileInformation); geometryFactory.CreateGeometries(); var layerFactory = new LayerFactory(gpxFileInformation.WayPointsExtent); var routes = layerFactory.CreateRoutes(path, gpxFileInformation.Routes); mapViewModel.AddRoutes(routes); var tracks = layerFactory.CreateTracks(path, gpxFileInformation.Tracks); mapViewModel.AddTracks(tracks); mapViewModel.AddPoIs(gpxFileInformation.WayPoints); }