public async Task Login() { await _youTubeServiceControl.Login(); _youTubeService = _youTubeServiceControl.GetAuthorizedService(); await _subscriptionsHolder.Init(); await LoadProfileInfo(); }
public async Task Subscribe(string channelId) { if (string.IsNullOrEmpty(channelId)) { return; } try { var resourcId = new ResourceId() { ChannelId = channelId, Kind = "youtube#channel" }; var snippet = new SubscriptionSnippet() { ResourceId = resourcId }; var body = new Subscription() { Snippet = snippet }; var request = _youTubeService.GetAuthorizedService().Subscriptions.Insert(body, "snippet"); request.Key = _youTubeService.ApiKey; var response = await request.ExecuteAsync(); Add(channelId, response.Id); } catch (Exception e) { Debug.WriteLine(e); } }