Esempio n. 1
0
 public static Playlist Copy(Playlist toCopy)
 {
     Playlist playlist = new Playlist { playlistId = toCopy.playlistId, clipCount = toCopy.clipCount, name = toCopy.name, thumbnailLocation = toCopy.thumbnailLocation, displayColumns = toCopy.displayColumns, totalFilesSize = toCopy.totalFilesSize };
     BindableCollection<Clip> clips = new BindableCollection<Clip>();
     foreach (Clip c in toCopy.clips)
     {
         Clip clip = new Clip { breakDownData = c.breakDownData, clipId = c.clipId, order = c.order };
         BindableCollection<Angle> angles = new BindableCollection<Angle>();
         foreach (Angle a in c.angles)
         {
             Angle angle = new Angle { angleName = a.angleName, angleType = null, clipAngleId = a.clipAngleId, duration = a.duration, fileLocation = a.fileLocation, isPreloaded = a.isPreloaded, preloadFile = a.preloadFile, thumbnailLocation = a.thumbnailLocation, fileSize =a.fileSize };
             angles.Add(angle);
         }
         clip.angles = angles;
         clips.Add(clip);
     }
     playlist.clips = clips;
     return playlist;
 }
        public void SetClip(Clip clip)
        {
            if (clip != null && (SelectedClip == null || SelectedClip.clipId != clip.clipId))
            {
                SelectedClip = clip;
                SelectedClipIndex = FilteredClips.IndexOf(clip);

                listView.SelectedItem = SelectedClip;

                Angle nextAngle = clip.angles.FirstOrDefault(angle => angle.angleType.IsChecked);
                SelectedAngle = (nextAngle != null && nextAngle.isPreloaded) ? new Angle(nextAngle.clipAngleId, nextAngle.preloadFile) : nextAngle;
                
                int nextClipIndex = (SelectedClipIndex + 1) % FilteredClips.Count;
                PreloadClips(preloadCT, SelectedClip.angles.Where(angle => angle.angleType.IsChecked).Take(2));
            }
            else
            {
                listView.SelectedItem = SelectedClip;
            }
        }
Esempio n. 3
0
 public static Clip FromDTO(ClipDTO clipDTO, string[] displayColumns)
 {
     Clip clip = new Clip();
     clip.breakDownData = new string[displayColumns.Length];
     clip.clipId = clipDTO.ClipID;
     clip.order = clipDTO.OriginalOrder;
     for (int i = 0; i < clip.breakDownData.Length; i++)
     {
         clip.breakDownData[i] = "-";
     }
     foreach(string key in clipDTO.breakdownData.Keys)
     {
         for (int i = 0; i < displayColumns.Length; i++)
         {
             if (key.ToUpper() == displayColumns[i].ToUpper())
             {
                 clip.breakDownData[i] = clipDTO.breakdownData[key];
             }
         }
     }
     foreach (AngleDTO angleDTO in clipDTO.ClipAngles)
     {
         Angle a = Angle.FromDTO(angleDTO);
         if (a != null)
         {
             clip.angles.Add(a);
         }
     }
     return clip;
 }