Beispiel #1
0
        private void SetFilteredVideoList()
        {
            var result = OriginalVideoList.Where(o => o.Quality == (string.IsNullOrEmpty(selectedQuality) ? o.Quality : selectedQuality) &&
                                                 o.Tags.Any(t => VideoTagList.Where(g => g.Activated).Select(g => g.Name).Contains(t)) &&
                                                 GetVideoIdsByDuration(SelectedDuration).Contains(o.Id) &&
                                                 o.Title.ToLower().Contains((string.IsNullOrEmpty(searchText) ? o.Title.ToLower() : searchText.ToLower())));

            VideoList = result;
        }
Beispiel #2
0
        private void FillTagList()
        {
            var existingTagNames = VideoTagList.Select(t => t.Name);

            foreach (var tag in OriginalVideoList.SelectMany(o => o.Tags).Distinct())
            {
                if (!existingTagNames.Contains(tag))
                {
                    var myTag = new Tag {
                        Name = tag, Activated = true
                    };
                    myTag.ActivateEvent += TagActivityEvent;
                    VideoTagList.Add(myTag);
                }
            }
        }
Beispiel #3
0
        private IEnumerable <Video> GetVideoByDuration(string length)
        {
            IEnumerable <Video> result = new List <Video>(OriginalVideoList);

            if (!string.IsNullOrEmpty(length))
            {
                switch (Enum.Parse(typeof(VideoLength), length))
                {
                case VideoLength.Short:
                    result = OriginalVideoList.Where(v => v.Duration <= Settings.Default.ShortLength);
                    break;

                case VideoLength.Medium:
                    result = OriginalVideoList.Where(v => v.Duration > Settings.Default.ShortLength && v.Duration < Settings.Default.LongLegth);
                    break;

                case VideoLength.Long:
                    result = OriginalVideoList.Where(v => v.Duration > Settings.Default.LongLegth);
                    break;
                }
            }
            return(result);
        }