private void RefreshMediaFiles(object parameters) { try { if (parameters is MediaSource) { MediaSource ms = (MediaSource)parameters; CStorage storage = new CStorage(); List <MediaFile> mfList = storage.GetMediaFiles(ms.Path); // TODO: also here information from DB should be insert in MediaFile object (such as description and owner) // if information is absence some fields will be empty MediaFiles.Clear(); foreach (MediaFile mf in mfList) { MediaFiles.Add(mf); } } else { return; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void ShowPublishedFiles(object parameters) { DataBase.DataProviders.DataProvider dataProvider = new DataBase.DataProviders.DataProvider(); List <MediaFile> mediaFiles = dataProvider.GetMediaFileList(); MediaFiles.Clear(); foreach (MediaFile mf in mediaFiles) { MediaFiles.Add(mf); } }
private void ShowImageMediaSources(object parameters) { RefreshMediaFiles(parameters); IEnumerable <MediaFile> query = MediaFiles.Where(mf => mf.Type == CommonElements.Enums.MediaType.Image).OrderBy(mf => mf.Name); List <MediaFile> result = query.ToList <MediaFile>(); MediaFiles.Clear(); foreach (MediaFile r in result) { MediaFiles.Add(r); } }
private void GroupFileList(object parameters) { var query = MediaFiles.GroupBy(mf => mf.Type).Select(g => new { Name = g.Key, Files = g.ToList <MediaFile>() }).ToList(); MediaFiles.Clear(); foreach (var mf in query) { MediaFiles.Add(new MediaFile { Name = mf.Name.ToString() }); foreach (MediaFile f in mf.Files) { MediaFiles.Add(f); } } }
private async Task LoadMediaFiles() { var tempFiles = await _mediaTempFolder.GetFilesAsync(); var localFiles = await _mediaFolder.GetFilesAsync(); var tempMedias = tempFiles.Select(file => new MediaItem(FolderType.Temp, ReservationId, file.Name)).ToList(); var localMedias = localFiles.Select(file => new MediaItem(FolderType.Local, ReservationId, file.Name)).ToList(); var totalFile = tempMedias.Concat(localMedias).ToList(); MediaFiles.Clear(); MediaFiles = totalFile; // old implementation? //MediaFiles = files.Select(file => string.Format("ms-appdata:///Temp/Media/{0}/{1}", ReservationId, file.Name)).ToList(); }
/// <summary> /// Muestra la lista de reproducción /// </summary> private void ShowReproductionList() { // Limpia la lista MediaFiles.Clear(); CanDownload = false; // Añade los elementos foreach (MediaAlbumModel album in ReproductionList.Albums) { foreach (MediaFileModel file in album.Files) { var fileViewModel = new MediaItemListViewModel(file); // Añade el archivo MediaFiles.Add(fileViewModel); // Indica si hay algún archivo para descargar if (fileViewModel.CanDownload) { CanDownload = true; } } } }
public void Clear() { MediaFiles.Clear(); }