/// <summary> /// Returns a list of slides based on filters. /// </summary> /// <param name="playmode">Play Mode filter.</param> /// <param name="visibility">Visibility filter.</param> /// <returns>A list of filtered slides.</returns> public List <PresentationSlide> GetSlides(PlayModeType playmode, VisibilityType visibility) { if (playmode == PlayModeType.All && visibility == VisibilityType.All) { return(Slides); } var list = new List <PresentationSlide>(slides.Count); foreach (var slide in Slides) { if (slide.StartInPlayMode) { if ((playmode & PlayModeType.PlayMode) == 0) { continue; } } else { if ((playmode & PlayModeType.NonPlayMode) == 0) { continue; } } if (slide.Visible) { if ((visibility & VisibilityType.Visible) == 0) { continue; } } else { if ((visibility & VisibilityType.Hidden) == 0) { continue; } } list.Add(slide); } return(list); }
private static string ConvertToValue(PlayModeType type) { switch (type) { case PlayModeType.Normal: return("NORMAL"); case PlayModeType.RepeatAll: return("REPEAT_ALL"); case PlayModeType.Shuffle: return("SHUFFLE"); case PlayModeType.ShuffleNoRepeat: return("SHUFFLE_NOREPEAT"); default: throw new ArgumentException($"{typeof(PlayModeType).Name} type value: {type} is not valid."); } }
public PlayMode(PlayModeType type) { Value = ConvertToValue(type); Type = type; }