Exemple #1
0
        private void Browser_TitleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            Title = Browser.Title.Replace("- YouTube", "");

            DisplayDjMode();

            Dispatcher.BeginInvoke((Action)(() =>
            {
                if (Browser.IsLoaded)
                {
                    // Save the last video that was played from either request or personal playlist by ID
                    CefSharpCache loadedCefSharpCache = CefSharpCache.Load();
                    loadedCefSharpCache.Url = Browser.Address;

                    if (Browser.Address.Contains($"list={YoutubeClient.SongRequestSetting.RequestPlaylistId}") &&
                        Browser.Address.Contains("v="))
                    {
                        loadedCefSharpCache.LastRequestPlaylistVideoId = _youTubeClientInstance.GetYouTubeVideoId(Browser.Address);
                    }
                    else if (Browser.Address.Contains($"list={YoutubeClient.SongRequestSetting.PersonalPlaylistId}") &&
                             Browser.Address.Contains("v="))
                    {
                        loadedCefSharpCache.LastPersonalPlaylistVideoId = _youTubeClientInstance.GetYouTubeVideoId(Browser.Address);
                    }

                    CefSharpCache.Save(loadedCefSharpCache);
                }
            }));
        }