Ejemplo n.º 1
0
        public override StorageMedia Clone()
        {
            var item = new StoragePhoto(File, _basic, Properties);

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

            return(item);
        }
Ejemplo n.º 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));
     }
 }
Ejemplo n.º 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);
        }