private void addToMediae(Media m)
        {
            var mediaInList = Mediae.FirstOrDefault(media => media.Path == m.Path);

            if (mediaInList == null) {
                dispatcher.BeginInvoke((Action)(() => Mediae.Add(m)), DispatcherPriority.DataBind);
            } else {
                dispatcher.BeginInvoke((Action)(() => mediaInList.UpdateWith(m)), DispatcherPriority.DataBind);
            }
        }
Exemple #2
0
        public void UpdateWith(Media m)
        {
            PidCount = m.PidCount;
            FormatName = m.FormatName;
            FormatNameLong = m.FormatNameLong;
            PlaytimeSeconds = m.PlaytimeSeconds;
            FileSize = m.FileSize;
            Bitrate = m.Bitrate;

            if (this.VideoPid == null && m.VideoPid == null) {

            } else {
                VideoPid.UpdateWith(m.VideoPid);
            }

            if (m.AudioPids != null && m.AudioPids.Count > 0) {
                AudioPids = m.AudioPids;
            }

            // @TODO: Any better way to update pids?
        }
 private void addNowPlaying()
 {
     var media = new Media(ApiInstance.NowPlaying.Path);
     addToMediae(media);
 }