public ServiceWindow(User user, UserManager manager, YoutubeAPIClient yt, DataBaseContext dbContext) { InitializeComponent(); _user = user; _manager = manager; _yt = yt; _dbContext = dbContext; RefreshView(); LoginLabel.Content = "Signed as: " + _user.UserName; }
public MainWindow() { InitializeComponent(); var yt = new YoutubeAPIClient("AIzaSyDueuiy9SlXlD0gMaEIlbODf345tRmaVK0"); var dbContext = new DataBaseContext(); var manager = new UserManager(yt, dbContext); var user = manager.Register(); manager.AddUserChannel(user, "https://www.youtube.com/channel/UCSwtGkvmxXhWe-kK1dlm8gA", false); manager.AddUserChannel(user, "https://www.youtube.com/channel/UC7_tK6JLTJDYPzHR76o85vQ", false); var channelAndVideos = new Dictionary <Entities.Channel, List <SearchResult> >(); foreach (var channel in user.Channels) { var videos = yt.ChannelLastVideos(channel, 5); channelAndVideos.Add(channel, videos); } ChannelsAndVideos.ItemsSource = channelAndVideos; /* * For displaying as message box * foreach (var entry in channelAndVideos) { * MessageBox.Show(entry.Key.ChannelName); * foreach (var video in entry.Value) { * MessageBox.Show(video.Snippet.ChannelTitle + "\n" + video.Snippet.Title); * } * } */ /* * For displaying last N videos as message box * var videos = yt.ChannelListLastVideos(user.Channels, 5); * foreach (var video in videos) { * MessageBox.Show(video.Snippet.ChannelTitle + "\n" + video.Snippet.Title); * } */ }
public UserManager(YoutubeAPIClient yt, DataBaseContext dbContext) { _yt = yt; _dbContext = dbContext; }