Example #1
0
        public Track FindTrackByName(string ShowName, string TrackName)
        {
            var show = ShowMedia.Find(
                delegate(TrackCollection trackCollection)
            {
                return(trackCollection.Name.Equals(ShowName));
            }
                );

            if (show == null)
            {
                throw new InvalidShowNameFoundException(ShowName);
            }
#if NOT_NET4
            Track result = null;
            foreach (Track t in show.Tracks)
            {
                if (t.Name.Equals(TrackName))
                {
                    result = t;
                    break;
                }
            }
#else
            var result = show.Tracks.First(track => track.Name.Equals(TrackName));
#endif

            /*var result = show.Tracks.Find(
             *  delegate(Track track)
             *  {
             *      return track.Name.Equals(TrackName);
             *  }
             *  );
             */
            if (result == null)
            {
                throw new InvalidTrackFoundException(ShowName + Settings.slash + TrackName);
            }

            return(result);
        }
Example #2
0
        public void UpdateTrackDisplay(string ShowName)
        {
            var item = ShowMedia.Find(
                delegate(TrackCollection t)
            {
                return(t.Name.Equals(ShowName));
            }
                );

            if (item == null)
            {
                throw new InvalidShowNameFoundException();
            }
            TrackDisplayList.Items.Clear();

            if (item != null)
            {
                foreach (Track t in item.Tracks)
                {
                    TrackDisplayList.Items.Add(t.Name).SubItems.Add(t.Duration);
                }
            }
        }