示例#1
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            NavigationFrame.Navigating += NavigationFrame_Navigating;
            NavigationFrame.Navigated  += NavigationFrameOnNavigated;
            SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;

            // Get list of samples
            var sampleCategories = (await Samples.GetCategoriesAsync()).ToList();

            HamburgerMenu.ItemsSource = sampleCategories;

            // Options
            HamburgerMenu.OptionsItemsSource = new[]
            {
                new Option {
                    Glyph = "\xE10F", Name = "About", PageType = typeof(About)
                }
            };

            HideInfoArea();
            NavigationFrame.Navigate(typeof(About));

            if (!string.IsNullOrWhiteSpace(e?.Parameter?.ToString()))
            {
                var parser       = DeepLinkParser.Create(e.Parameter.ToString());
                var targetSample = await Sample.FindAsync(parser.Root, parser["sample"]);

                if (targetSample != null)
                {
                    NavigateToSample(targetSample);
                }
            }
        }
示例#2
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            NavigationFrame.Navigated += NavigationFrameOnNavigated;
            NavView.BackRequested     += NavView_BackRequested;

            // Get list of samples
            var sampleCategories = await Samples.GetCategoriesAsync();

            NavView.MenuItemsSource = sampleCategories;

            SetAppTitle(string.Empty);
            NavigateToSample(null);

            if (!string.IsNullOrWhiteSpace(e?.Parameter?.ToString()))
            {
                var parser       = DeepLinkParser.Create(e.Parameter.ToString());
                var targetSample = await Sample.FindAsync(parser.Root, parser["sample"]);

                if (targetSample != null)
                {
                    NavigateToSample(targetSample);
                }
            }

            // NavView goes into a weird size on load unless the window size changes
            // Needs a gentle push to update layout
            NavView.Loaded += (s, args) => NavView.InvalidateMeasure();
        }
示例#3
0
        protected override void OnActivated(IActivatedEventArgs args)
        {
            if (args is ToastNotificationActivatedEventArgs)
            {
                Analytics.TrackEvent("User Clicked Notification");

                var toastActivationArgs = args as ToastNotificationActivatedEventArgs;

                StoreServicesEngagementManager engagementManager = StoreServicesEngagementManager.GetDefault();
                string originalArgs = engagementManager.ParseArgumentsAndTrackAppLaunch(
                    toastActivationArgs.Argument);

                // Use the originalArgs variable to access the original arguments
                // that were passed to the app.
            }

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            var navigationDestination = typeof(MainPage);

            if (rootFrame.Content == null)
            {
                rootFrame.Navigate(navigationDestination);
            }
            if (args.Kind == ActivationKind.Protocol)
            {
                ProtocolActivatedEventArgs eventArgs = args as ProtocolActivatedEventArgs;
                var parser = DeepLinkParser.Create(args);
                if (parser.ContainsKey("promo"))
                {
                    if (parser["promo"] == "winterwonderland")
                    {
                        navigationDestination = typeof(PromoPage);
                        rootFrame.Navigate(navigationDestination);
                    }
                }
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
示例#4
0
        /// <summary>
        /// Navigates to a Sample via a deep link.
        /// </summary>
        /// <param name="deepLink">The deep link. Specified as protocol://[collectionName]?sample=[sampleName]</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        public async Task NavigateToSampleAsync(string deepLink)
        {
            var parser       = DeepLinkParser.Create(deepLink);
            var targetSample = await Samples.GetSampleByName(parser["sample"]);

            if (targetSample != null)
            {
                NavigateToSample(targetSample);
            }
        }
示例#5
0
        /// <summary>
        /// Navigates to a Pattern via a deep link.
        /// </summary>
        /// <param name="deepLink">The deep link. Specified as protocol://[collectionName]?pattern=[patternName]</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        public async Task NavigateToPatternAsync(string deepLink)
        {
            var parser        = DeepLinkParser.Create(deepLink);
            var targetPattern = await Patterns.GetPatternByName(parser["pattern"]);

            if (targetPattern != null)
            {
                NavigateToPattern(targetPattern);
            }
        }
示例#6
0
        public async Task HandleProtocolAsync(string path)
        {
            if (!string.IsNullOrEmpty(path))
            {
                try
                {
                    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.Current.GetAsync <Core.API.Endpoints.Track>($"/tracks/{parser["id"]}");

                            var startPlayback = await PlaybackService.Current.StartMediaPlayback(new List <Core.API.Endpoints.Track> {
                                track
                            }, $"Protocol-{track.Id}");

                            if (!startPlayback.success)
                            {
                                await new MessageDialog(startPlayback.message, "Error playing track.").ShowAsync();
                            }
                            break;

                        case "playlist":
                            var playlist = await SoundByteService.Current.GetAsync <Core.API.Endpoints.Playlist>($"/playlists/{parser["id"]}");

                            App.NavigateTo(typeof(Playlist), playlist);
                            return;

                        case "user":
                            var user = await SoundByteService.Current.GetAsync <Core.API.Endpoints.User>($"/users/{parser["id"]}");

                            App.NavigateTo(typeof(UserView), user);
                            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));
        }
示例#7
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            NavigationFrame.Navigate(typeof(About));

            // Get list of samples
            var sampleCategories = (await Samples.GetCategoriesAsync()).ToList();

            HamburgerMenu.ItemsSource = sampleCategories;

            // Options
            HamburgerMenu.OptionsItemsSource = new[]
            {
                new Option {
                    Glyph = "\xE10F", Name = "About", PageType = typeof(About)
                }
            };

            HideInfoArea();

            NavigationFrame.Navigating += NavigationFrame_Navigating;
            NavigationFrame.Navigated  += NavigationFrameOnNavigated;
            SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;

            if (!string.IsNullOrWhiteSpace(e?.Parameter?.ToString()))
            {
                var parser       = DeepLinkParser.Create(e.Parameter.ToString());
                var targetSample = await Sample.FindAsync(parser.Root, parser["sample"]);

                if (targetSample != null)
                {
                    NavigateToSample(targetSample);
                }
            }

            _compositor = ElementCompositionPreview.GetElementVisual(this).Compositor;

            if (AnimationHelper.IsImplicitHideShowSupported)
            {
                AnimationHelper.SetTopLevelShowHideAnimation(SamplePickerGrid);

                AnimationHelper.SetTopLevelShowHideAnimation(SamplePickerDetailsGrid);
                AnimationHelper.SetSecondLevelShowHideAnimation(SamplePickerDetailsGridContent);
                AnimationHelper.SetSecondLevelShowHideAnimation(InfoAreaGrid);
                AnimationHelper.SetSecondLevelShowHideAnimation(Splitter);

                ////ElementCompositionPreview.SetImplicitHideAnimation(ContentShadow, GetOpacityAnimation(0, 1, _defaultHideAnimationDiration));
                ElementCompositionPreview.SetImplicitShowAnimation(ContentShadow, AnimationHelper.GetOpacityAnimation(_compositor, (float)ContentShadow.Opacity, 0, _defaultShowAnimationDuration));
            }
        }
示例#8
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            NavigationFrame.Navigated += NavigationFrameOnNavigated;
            NavView.BackRequested     += NavView_BackRequested;

#if HAS_UNO
            if (!string.IsNullOrWhiteSpace(e?.Parameter?.ToString()))
            {
                var parser = DeepLinkParser.Create(e.Parameter.ToString());
                System.Console.WriteLine($"Deeplink Root:{parser.Root}, Keys: {string.Join(",", parser.Keys)}");

                if (parser.TryGetValue("ShowUnoUnsupported", out var showUnoUnsupportedString) &&
                    bool.TryParse(showUnoUnsupportedString, out bool showUnoUnsupported))
                {
                    Console.WriteLine($"");
                    Samples.ShowUnoUnsupported = showUnoUnsupported;
                }
            }
#endif

            // Get list of samples
            var sampleCategories = await Samples.GetCategoriesAsync();

            System.Console.WriteLine($"Got {sampleCategories.Count} categorie (p: {e.Parameter})");
            NavView.MenuItemsSource = sampleCategories;

            SetAppTitle(string.Empty);
            NavigateToSample(null);

            if (!string.IsNullOrWhiteSpace(e?.Parameter?.ToString()))
            {
                var parser = DeepLinkParser.Create(e.Parameter.ToString());

                if (parser.TryGetValue("sample", out var sample))
                {
                    var targetSample = await Sample.FindAsync(parser.Root, sample);

                    if (targetSample != null)
                    {
                        NavigateToSample(targetSample);
                    }
                }
            }

            // NavView goes into a weird size on load unless the window size changes
            // Needs a gentle push to update layout
            NavView.Loaded += (s, args) => NavView.InvalidateMeasure();
            System.Console.WriteLine($"Done navigating");
        }
示例#9
0
        protected override async void OnActivated(IActivatedEventArgs args)
        {
            await RunAppInitialization(null);

            if (args.Kind == ActivationKind.Protocol)
            {
                try
                {
                    // Launching via protocol link
                    var parser       = DeepLinkParser.Create(args);
                    var targetSample = await Sample.FindAsync(parser.Root, parser["sample"]);

                    if (targetSample != null)
                    {
                        Shell.Current?.NavigateToSample(targetSample);
                    }
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine($"Error processing protocol launch: {ex.ToString()}");
                }
            }
        }
示例#10
0
        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));
        }
示例#11
0
        /// <summary>
        ///     Handle app protocol. If true is returned this method handled page
        ///     navigation. If false is returned, you must handle app protocol
        /// </summary>
        public static async Task <bool> HandleProtocolAsync(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                return(false);
            }

            try
            {
                var parser  = DeepLinkParser.Create(path);
                var section = parser.Root?.Split('/')[0]?.ToLower();

                // Try get the session ID is one was passed through.
                parser.TryGetValue("session", out var sessionId);
                if (!string.IsNullOrEmpty(sessionId))
                {
                    SettingsService.Instance.SessionId = sessionId;
                }

                switch (section)
                {
                case "resume-playback":
                    await HandleResumeAsync();

                    break;

                case "cortana":
                    if (!parser.TryGetValue("command", out var command))
                    {
                        throw new SoundByteException("Incorrect Protocol", "Command was not supplied (command={command}).");
                    }

                    await HandleCortanaCommandAsync(command);

                    break;

                case "track":
                    if (!parser.TryGetValue("d", out var rawProtocolData))
                    {
                        throw new SoundByteException("Incorrect Protocol", "Data was not supplied (d={data}).");
                    }

                    await HandleTrackProtocolAsync(rawProtocolData);

                    break;

                case "user":
                    parser.TryGetValue("id", out var userId);
                    parser.TryGetValue("service", out var userService);

                    // Get user
                    var user = await BaseUser.GetUserAsync(int.Parse(userService), userId);

                    if (user == null)
                    {
                        throw new Exception("User does not exist");
                    }

                    App.NavigateTo(typeof(UserView), user);
                    return(true);

                case "playlist":
                    parser.TryGetValue("id", out var playlistId);
                    parser.TryGetValue("service", out var playlistService);

                    // Get playlist
                    var playlist = await BasePlaylist.GetPlaylistAsync(int.Parse(playlistService), playlistId);

                    if (playlist == null)
                    {
                        throw new Exception("Playlist does not exist");
                    }

                    App.NavigateTo(typeof(PlaylistView), playlist);
                    return(true);

                case "playback":
                    parser.TryGetValue("command", out var playbackCommand);
                    HandlePlaybackCommand(playbackCommand);
                    break;
                }

                return(false);
            }
            catch (Exception e)
            {
                await NavigationService.Current.CallMessageDialogAsync("The specified protocol is not correct. App will now launch as normal.\n\n" + e.Message);

                return(false);
            }
        }
示例#12
0
        public async Task HandleProtocolAsync(string path)
        {
            LoggingService.Log(LoggingService.LogType.Debug, "Performing protocol work using path of " + path);


            if (!string.IsNullOrEmpty(path))
            {
                try
                {
                    if (path == "playUserLikes" || path == "shufflePlayUserLikes")
                    {
                        if (SoundByteV3Service.Current.IsServiceConnected(ServiceType.SoundCloud))
                        {
                            // Navigate to the now playing screen
                            RootFrame.Navigate(typeof(NowPlayingView));

                            // Get and load the user liked items
                            var userLikes = new SoundByteCollection <LikeSoundCloudSource, BaseTrack>();
                            userLikes.Source.User = SoundByteV3Service.Current.GetConnectedUser(ServiceType.SoundCloud);

                            // Loop through loading all the likes
                            while (userLikes.HasMoreItems)
                            {
                                await userLikes.LoadMoreItemsAsync(50);
                            }

                            // Play the list of items
                            await PlaybackService.Instance.StartModelMediaPlaybackAsync(userLikes, path == "shufflePlayUserLikes");

                            return;
                        }
                    }

                    if (path == "playUserStream")
                    {
                        if (SoundByteV3Service.Current.IsServiceConnected(ServiceType.SoundCloud))
                        {
                            // Navigate to the now playing screen
                            RootFrame.Navigate(typeof(NowPlayingView));

                            // Get and load the user liked items
                            var userStream = new SoundByteCollection <StreamSoundCloudSource, GroupedItem>();

                            // 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(50);
                            }

                            // Play the list of items
                            await PlaybackService.Instance.StartPlaylistMediaPlaybackAsync(
                                userStream.Where(x => x.Track != null).Select(x => x.Track).ToList());

                            return;
                        }
                    }

                    var parser = DeepLinkParser.Create(path);

                    var section = parser.Root.Split('/')[0].ToLower();
                    var page    = parser.Root.Split('/')[1].ToLower();

                    await App.SetLoadingAsync(true);

                    if (section == "core")
                    {
                        switch (page)
                        {
                        case "track":

                            BaseTrack track = null;

                            switch (parser["service"])
                            {
                            case "soundcloud":
                                track = (await SoundByteV3Service.Current.GetAsync <SoundCloudTrack>(ServiceType.SoundCloud, $"/tracks/{parser["id"]}")).ToBaseTrack();
                                break;

                            case "youtube":
                                break;

                            case "fanburst":
                                track = (await SoundByteV3Service.Current.GetAsync <FanburstTrack>(ServiceType.Fanburst, $"/videos/{parser["id"]}")).ToBaseTrack();
                                break;
                            }

                            if (track != null)
                            {
                                var startPlayback =
                                    await PlaybackService.Instance.StartPlaylistMediaPlaybackAsync(new List <BaseTrack> {
                                    track
                                });

                                if (!startPlayback.Success)
                                {
                                    await new MessageDialog(startPlayback.Message, "Error playing track.").ShowAsync();
                                }
                            }
                            break;

                        case "playlist":
                            var playlist =
                                await SoundByteV3Service.Current.GetAsync <SoundCloudPlaylist>(ServiceType.SoundCloud, $"/playlists/{parser["id"]}");

                            App.NavigateTo(typeof(PlaylistView), playlist.ToBasePlaylist());
                            return;

                        case "user":
                            var user = await SoundByteV3Service.Current.GetAsync <SoundCloudUser>(ServiceType.SoundCloud, $"/users/{parser["id"]}");

                            App.NavigateTo(typeof(UserView), user.ToBaseUser());
                            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();
                }
                await App.SetLoadingAsync(false);
            }

            RootFrame.Navigate(SoundByteV3Service.Current.IsServiceConnected(ServiceType.SoundCloud)
                ? typeof(SoundCloudStreamView)
                : typeof(ExploreView));
        }
示例#13
0
        public async Task HandleProtocolAsync(string path)
        {
            LoggingService.Log(LoggingService.LogType.Debug, "Performing protocol work using path of " + path);

            if (!string.IsNullOrEmpty(path))
            {
                try
                {
                    if (path == "playUserLikes" || path == "shufflePlayUserLikes")
                    {
                        if (SoundByteService.Current.IsServiceConnected(ServiceType.SoundCloud))
                        {
                            // Navigate to the now playing screen
                            RootFrame.Navigate(typeof(NowPlayingView));

                            // Get and load the user liked items
                            var userLikes = new SoundByteCollection <SoundCloudLikeSource, BaseTrack>();
                            userLikes.Source.User = SoundByteService.Current.GetConnectedUser(ServiceType.SoundCloud);

                            // Loop through loading all the likes
                            while (userLikes.HasMoreItems)
                            {
                                await userLikes.LoadMoreItemsAsync(50);
                            }

                            // Play the list of items
                            await BaseViewModel.PlayAllTracksAsync(userLikes, null, path == "shufflePlayUserLikes");

                            return;
                        }
                    }

                    if (path == "playUserStream")
                    {
                        if (SoundByteService.Current.IsServiceConnected(ServiceType.SoundCloud))
                        {
                            // Navigate to the now playing screen
                            RootFrame.Navigate(typeof(NowPlayingView));

                            // Get and load the user liked items
                            var userStream = new SoundByteCollection <SoundCloudStreamSource, GroupedItem>();

                            // 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(50);
                            }

                            // Play the list of items
                            var result = await PlaybackService.Instance.InitilizePlaylistAsync <DummyTrackSource>(
                                userStream.Where(x => x.Track != null).Select(x => x.Track).ToList());

                            if (result.Success)
                            {
                                await PlaybackService.Instance.StartTrackAsync();
                            }

                            return;
                        }
                    }

                    var parser = DeepLinkParser.Create(path);

                    var section = parser.Root?.Split('/')[0]?.ToLower();

                    await App.SetLoadingAsync(true);

                    if (section == "core")
                    {
                        var page = parser.Root?.Split('/')[1]?.ToLower();

                        switch (page)
                        {
                        case "track":

                            BaseTrack track = null;

                            switch (parser["service"])
                            {
                            case "soundcloud":
                                track = (await SoundByteService.Current.GetAsync <SoundCloudTrack>(ServiceType.SoundCloud, $"/tracks/{parser["id"]}")).Response.ToBaseTrack();
                                break;

                            case "youtube":
                                break;

                            case "fanburst":
                                track = (await SoundByteService.Current.GetAsync <FanburstTrack>(ServiceType.Fanburst, $"/videos/{parser["id"]}")).Response.ToBaseTrack();
                                break;
                            }

                            if (track != null)
                            {
                                var startPlayback =
                                    await PlaybackService.Instance.InitilizePlaylistAsync <DummyTrackSource>(new List <BaseTrack> {
                                    track
                                });

                                if (startPlayback.Success)
                                {
                                    await PlaybackService.Instance.StartTrackAsync();
                                }
                                else
                                {
                                    await NavigationService.Current.CallMessageDialogAsync(startPlayback.Message,
                                                                                           "Error playing track.");
                                }
                            }
                            break;

                        case "playlist":
                            var playlist =
                                await SoundByteService.Current.GetAsync <SoundCloudPlaylist>(ServiceType.SoundCloud, $"/playlists/{parser["id"]}");

                            App.NavigateTo(typeof(PlaylistView), playlist.Response.ToBasePlaylist());
                            return;

                        case "user":
                            var user = await SoundByteService.Current.GetAsync <SoundCloudUser>(ServiceType.SoundCloud, $"/users/{parser["id"]}");

                            App.NavigateTo(typeof(UserView), user.Response.ToBaseUser());
                            return;

                        case "changelog":
                            await NavigationService.Current.CallDialogAsync <WhatsNewDialog>();

                            break;
                        }
                    }
                    else if (section == "rs" || section == "remote-subsystem")
                    {
                        try
                        {
                            await App.SetLoadingAsync(true);

                            parser.TryGetValue("d", out var data);
                            parser.TryGetValue("t", out var timespan);

                            var result = App.RoamingService.DecodeActivityParameters(data);

                            // Get the current track object
                            BaseTrack currentTrack = null;
                            var       tracks       = new List <BaseTrack>();

                            switch (result.CurrentTrack.Service)
                            {
                            case ServiceType.Fanburst:
                                break;

                            case ServiceType.SoundCloud:
                            case ServiceType.SoundCloudV2:
                                currentTrack = (await SoundByteService.Current.GetAsync <SoundCloudTrack>(ServiceType.SoundCloud, $"/tracks/{result.CurrentTrack.TrackId}")).Response.ToBaseTrack();
                                break;

                            case ServiceType.YouTube:
                                currentTrack = (await SoundByteService.Current.GetAsync <YouTubeVideoHolder>(ServiceType.YouTube, "videos", new Dictionary <string, string>
                                {
                                    { "part", "snippet,contentDetails" },
                                    { "id", result.CurrentTrack.TrackId }
                                })).Response.Tracks.FirstOrDefault()?.ToBaseTrack();
                                break;

                            case ServiceType.ITunesPodcast:
                                // TODO: THIS
                                break;
                            }

                            //TODO: List has to be put back into wanted order.

                            var soundCloudIds = string.Join(',', result.Tracks.Where(x => x.Service == ServiceType.SoundCloud || x.Service == ServiceType.SoundCloudV2).Select(x => x.TrackId));
                            var fanburstIds   = string.Join(',', result.Tracks.Where(x => x.Service == ServiceType.Fanburst).Select(x => x.TrackId));
                            var youTubeIds    = string.Join(',', result.Tracks.Where(x => x.Service == ServiceType.YouTube).Select(x => x.TrackId));

                            // SoundCloud tracks
                            tracks.AddRange((await SoundByteService.Current.GetAsync <List <SoundCloudTrack> >(ServiceType.SoundCloud, $"/tracks?ids={soundCloudIds}")).Response.Select(x => x.ToBaseTrack()));

                            // YouTube Tracks
                            tracks.AddRange((await SoundByteService.Current.GetAsync <YouTubeVideoHolder>(ServiceType.YouTube, "videos", new Dictionary <string, string>
                            {
                                { "part", "snippet,contentDetails" },
                                { "id", youTubeIds }
                            })).Response.Tracks.Select(x => x.ToBaseTrack()));

                            var startPlayback = await PlaybackService.Instance.InitilizePlaylistAsync(result.Source, tracks);

                            if (startPlayback.Success)
                            {
                                TimeSpan?timeSpan = null;

                                if (!string.IsNullOrEmpty(timespan))
                                {
                                    timeSpan = TimeSpan.FromMilliseconds(double.Parse(timespan));
                                }

                                await PlaybackService.Instance.StartTrackAsync(currentTrack, timeSpan);
                            }
                            else
                            {
                                await NavigationService.Current.CallMessageDialogAsync(startPlayback.Message, "The remote protocol subsystem failed.");
                            }

                            await App.SetLoadingAsync(false);
                        }
                        catch (Exception e)
                        {
                            await App.SetLoadingAsync(false);

                            await NavigationService.Current.CallMessageDialogAsync(e.Message, "The remote protocol subsystem failed.");
                        }
                    }
                }
                catch (Exception ex)
                {
                    await NavigationService.Current.CallMessageDialogAsync(
                        "The specified protocol is not correct. App will now launch as normal.\n\n" + ex.Message);
                }
                await App.SetLoadingAsync(false);
            }

            if (DeviceHelper.IsMobile)
            {
                RootFrame.Navigate(typeof(MobileView));
            }
            else
            {
                RootFrame.Navigate(typeof(ExploreView));
            }
        }