public async Task HandleProtocolAsync(string path) { if (!string.IsNullOrEmpty(path)) { try { if (path == "playUserLikes" || path == "shufflePlayUserLikes") { if (SoundByteService.Instance.IsSoundCloudAccountConnected) { // Navigate to the now playing screen RootFrame.Navigate(typeof(NowPlayingView)); // Get and load the user liked items var userLikes = new LikeModel(SoundByteService.Instance.SoundCloudUser); while (userLikes.HasMoreItems) { await userLikes.LoadMoreItemsAsync(500); } // Play the list of items await PlaybackService.Instance.StartMediaPlayback(userLikes.ToList(), path, path == "shufflePlayUserLikes"); return; } } if (path == "playUserStream") { if (SoundByteService.Instance.IsSoundCloudAccountConnected) { // Navigate to the now playing screen RootFrame.Navigate(typeof(NowPlayingView)); // Get and load the user stream items var userStream = new StreamModel(); // Counter so we don't get an insane amount of items var i = 0; // Grab all the users stream / 5 items while (userStream.HasMoreItems && i <= 5) { i++; await userStream.LoadMoreItemsAsync(500); } // Play the list of items await PlaybackService.Instance.StartMediaPlayback( userStream.Where(x => x.Track != null).Select(x => x.Track).ToList(), path); return; } } var parser = DeepLinkParser.Create(path); var section = parser.Root.Split('/')[0].ToLower(); var page = parser.Root.Split('/')[1].ToLower(); App.IsLoading = true; if (section == "core") { switch (page) { case "track": var track = await SoundByteService.Instance.GetAsync <Track>($"/tracks/{parser["id"]}"); var startPlayback = await PlaybackService.Instance.StartMediaPlayback(new List <Track> { track }, $"Protocol-{track.Id}"); if (!startPlayback.success) { await new MessageDialog(startPlayback.message, "Error playing track.").ShowAsync(); } break; case "playlist": var playlist = await SoundByteService.Instance.GetAsync <Playlist>($"/playlists/{parser["id"]}"); App.NavigateTo(typeof(PlaylistView), playlist); return; case "user": var user = await SoundByteService.Instance.GetAsync <User>($"/users/{parser["id"]}"); App.NavigateTo(typeof(UserView), user); return; case "changelog": App.NavigateTo(typeof(WhatsNewView)); return; } } } catch (Exception) { await new MessageDialog("The specified protocol is not correct. App will now launch as normal.") .ShowAsync(); } App.IsLoading = false; } RootFrame.Navigate(typeof(HomeView)); }