/// <summary> /// Initialization /// </summary> public Video_ViewModel() { __LibraryFile = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Epitech\\__MyLibrary"; _NbFilesLoaded = 0; Loading = true; _ProgressTimer = new DispatcherTimer(); _Library = new Model.Library(__LibraryFile, this); _Playlist = new Model.Playlist(); _Video = new Model.Video(); _IsPlaying = false; _IsLoaded = false; _Maximum = 10; _SaveVolume = 0; _SaveWidth = Video.Media.Width; _SaveHeight = Video.Media.Height; _Choice = 0; IsFullScreen = false; _LibrarySearch = "Custom Search..."; _GoSearch = true; _WindowStateSave = WindowState.Normal; ControlZindex = 7; _ProgressTimer.Interval = TimeSpan.FromSeconds(1); _ProgressTimer.Tick += ProgressTimer_Tick; Video.Media.MediaOpened += new RoutedEventHandler(EVNT_MediaOpened); Video.Media.MediaEnded += new RoutedEventHandler(EVNT_MediaEnded); Video.Media.ScrubbingEnabled = true; Video.Media.IsEnabled = true; _ProgressTimer.Start(); InitCommands(); }
public void PlayPlaylist(Model.Playlist playlist) { if (playlist == null || playlist.Medias.Count() == 0) { return; } PlayMedia(playlist.Medias[playlist.CurrentIndex]); _IsPlayingPlaylist = true; }
public void openPlaylist(string name) { foreach (Model.Playlist item in _playlist) { if (item.Name == name) { currentPlaylist = item; currentClip = 0; break; } } }
public void AddPlaylist(Model.Playlist newPlaylist) { if (Playlists.Any(cus => cus.Name == newPlaylist.Name) == false) { XML.PlaylistXML playlistXML = new XML.PlaylistXML(); playlistXML.Load("playlists.xml"); if (!playlistXML.HasPlaylist(newPlaylist.Name)) { playlistXML.AddPlaylist(newPlaylist.Name); playlistXML.WriteInFile("playlists.xml"); Playlists.Add(newPlaylist); } } }
public void RemovePlaylist(Model.Playlist selectedPlaylist) { if (Playlists.Any(cus => cus.Name == selectedPlaylist.Name) == true) { XML.PlaylistXML playlistXML = new XML.PlaylistXML(); playlistXML.Load("playlists.xml"); if (playlistXML.HasPlaylist(selectedPlaylist.Name)) { playlistXML.RemovePlaylist(selectedPlaylist.Name); playlistXML.WriteInFile("playlists.xml"); Playlists.Remove(selectedPlaylist); } } }
private async void ucPlaylistUpsert_Load(object sender, EventArgs e) { BuildAllTracksList(); BuildPlaylistTracksList(); var tracksRequest = new TrackSearchRequest() { Page = _allTracksPage, ItemsPerPage = _itemsPerPage }; await LoadListAllTracks(tracksRequest); if (_ID.HasValue) { _playlist = await _playlistApiService.GetById <Model.Playlist>(_ID.Value); txtName.Text = _playlist.Name; txtCreatedAt.Text = _playlist.CreatedAt; txtOwner.Text = _playlist.User.Username; if (_playlist.Image.Length != 0) { pbPlaylistImage.Image = ImageHelper.ByteArrayToSystemDrawing(_playlist.Image); pbPlaylistImage.SizeMode = PictureBoxSizeMode.StretchImage; } _playlistTracks = await _playlistApiService.GetTracks <List <Model.Track> >(_ID.Value, null); var request = new TrackSearchRequest() { Page = _playlistTracksPage, ItemsPerPage = _itemsPerPage }; LoadListPlaylistTracks(request); } else { DataGridViewHelper.PopulateWithList(dgvPlaylistTracks, _playlistTracks, props); } SetButtonSavePosition(); }
public Model.Playlist GetPlaylistInfo(string playlistId) { Model.Playlist informationAboutPlaylist = null; try { var yt = new YouTubeService(new BaseClientService.Initializer() { ApiKey = _APIKEY }); var channelRequest = yt.Playlists.List("snippet"); channelRequest.Id = playlistId; var channelResponse = channelRequest.Execute(); Google.Apis.YouTube.v3.Data.Playlist playlist = channelResponse.Items[0]; var playlistItemsListRequest = yt.PlaylistItems.List("snippet"); playlistItemsListRequest.PlaylistId = playlistId; playlistItemsListRequest.MaxResults = 50; // Retrieve the list of videos uploaded to the authenticated user's channel. var playlistItemsListResponse = playlistItemsListRequest.Execute(); informationAboutPlaylist = new Model.Playlist() { Thumbnail = GetMaxResolution(playlist.Snippet.Thumbnails), Description = playlist.Snippet.Description, Name = playlist.Snippet.Title }; } catch (Exception ex) { //MessageBox.Show(ex.Message); } return(informationAboutPlaylist); }
private void ExecuteCreatePlaylist() { Model.Playlist NewPlaylist = new Model.Playlist() { Name = playlistName }; this.PlaylistsList.Add(NewPlaylist); this.CurrentPlaylist = NewPlaylist; XML.XMLPlaylist XMLPlaylist = new XML.XMLPlaylist(); XMLPlaylist.LoadXML("Playlist.xml"); XMLPlaylist.AddPlaylist(playlistName); XMLPlaylist.WriteXML("Playlist.xml"); }