示例#1
0
        public override StorageMedia Clone()
        {
            var item = new StorageVideo(File, _basic, Properties, Profile);

            item._thumbnail = _thumbnail;
            item._preview   = _preview;

            return(item);
        }
示例#2
0
 public static async Task <StorageMedia> CreateAsync(StorageFile file, bool selected)
 {
     if (file.ContentType.Equals("video/mp4"))
     {
         return(await StorageVideo.CreateAsync(file, selected));
     }
     else
     {
         return(await StoragePhoto.CreateAsync(file, selected));
     }
 }
示例#3
0
        public static async Task <IEnumerable <StorageMedia> > CreateAsync(IEnumerable <IStorageItem> items)
        {
            var results = new List <StorageMedia>();

            foreach (StorageFile file in items.OfType <StorageFile>())
            {
                if (file.ContentType.Equals("image/jpeg", StringComparison.OrdinalIgnoreCase) ||
                    file.ContentType.Equals("image/png", StringComparison.OrdinalIgnoreCase) ||
                    file.ContentType.Equals("image/bmp", StringComparison.OrdinalIgnoreCase) ||
                    file.ContentType.Equals("image/gif", StringComparison.OrdinalIgnoreCase))
                {
                    var photo = await StoragePhoto.CreateAsync(file, true);

                    if (photo != null)
                    {
                        results.Add(photo);
                    }
                    else
                    {
                        results.Add(new StorageDocument(file));
                    }
                }
                else if (file.ContentType == "video/mp4")
                {
                    var video = await StorageVideo.CreateAsync(file, true);

                    if (video != null)
                    {
                        results.Add(video);
                    }
                    else
                    {
                        results.Add(new StorageDocument(file));
                    }
                }
                else
                {
                    results.Add(new StorageDocument(file));
                }
            }

            return(results);
        }