public void LoadAllVideos(ObservableCollection <DownloadedVideo> DownloadedList) { var listTask = GetAllFilesInFolder(); listTask.ContinueWith(task => { var list = listTask.Result; DownloadedList.Clear(); foreach (var item in list) { if (item.Name.EndsWith("mp4", StringComparison.CurrentCulture) || item.Name.EndsWith("webM", StringComparison.CurrentCulture)) { DownloadedVideo video = new DownloadedVideo { VideoName = item.Name, VideoPath = item.Path, VideoTime = videoUtils.GetVideoDuration(item.Path), IsDownloading = false, VideoThumbnail = videoUtils.GetVideoThumbnail(item.Path) }; DownloadedList.Add(video); } } }); }
void ShareVideo(DownloadedVideo item) { if (item != null) { videoHelper.OpenActionSheet(item.VideoPath); ListItemSelected = null; } }
void RemoveVideo(DownloadedVideo videoItem) { string path = videoItem.VideoPath; int index = DownloadedList.IndexOf(videoItem); System.Diagnostics.Debug.WriteLine("Menu item delete click and its index in collection is: " + index); DownloadedList.RemoveAt(index); videoHelper.RemoveVideoFile(videoItem.VideoName); }
private void CreateNewDownloadedVideo(string name) { DownloadedVideo video = new DownloadedVideo { VideoName = name, VideoPath = "", VideoTime = "Downloading...", IsDownloading = true, VideoThumbnail = ImageSource.FromFile("downloading.png") }; DownloadedList.Add(video); }