private void Browser_LoadCompleted(object sender, NavigationEventArgs e)
 {
     Url.Text = e.Uri.ToString();
     MixpanelTrack("Navigated", new {Url = e.Uri.ToString(), _settings.Guid});
     _youtubeUrl = YoutubeUrl.Create(e.Uri);
     Loading();
 }
        private void PrepareUrl(Uri uri)
        {
            List.ItemsSource = null;

            _youtubeUrl = YoutubeUrl.Create(uri);
            if (_youtubeUrl == null) {
                Loading(false);
                return;
            }
            switch (_youtubeUrl.Type) {
                case VideoUrlType.User:
                    GetItems(SelectionMode.Single);
                    break;
                case VideoUrlType.Channel:
                    GetItems();
                    break;
                case VideoUrlType.Video:
                    if (_youtubeUrl.ChannelId != "") {
                        GetItems();
                    } else
                        Loading(false);
                    break;
                case VideoUrlType.Unknown:
                    Loading(false);
                    break;
            }
        }
Beispiel #3
0
 public async Task<MSYoutubeEntry> GetAsync(YoutubeUrl youtubeUrl, Uri uri, MSYoutubeLoading loading)
 {
     var feed = new MSYoutubeEntry {
         YoutubeUrl = youtubeUrl,
         NextPageUri =
             new Uri(uri + ((String.IsNullOrEmpty(uri.Query)) ? "?" : "&") + "start-index=1&max-results=40")
     };
     await _GetAsync(uri, feed, loading);
     return feed;
 }
Beispiel #4
0
        public static YoutubeUrl Create(Uri u)
        {

            var surl = u.ToString();
            if (surl.StartsWith("https://")) {
                surl = "http://" + surl.Substring(8);
            } else if (!surl.StartsWith("http://")) {
                surl = "http://" + u;
            }
            var url = new YoutubeUrl { Uri = u, Type = VideoUrlType.Unknown, Provider = ContentProviderType.NONE };
            url.Parse(surl);
            return url;
        }