public static void InitializeGallery(GalleryControlGallery gallery, StorageVolumeInfoCollection volumes, AllowMedia allowMediaDelegate)
        {
            gallery.Groups.Clear();
            gallery.ShowGroupCaption  = false;
            gallery.ShowItemText      = true;
            gallery.ItemImageLocation = DevExpress.Utils.Locations.Left;
            gallery.FixedImageSize    = false;
            gallery.AllowHoverImages  = false;
            gallery.StretchItems      = true;

            GalleryItemGroup group = new GalleryItemGroup();

            gallery.Groups.Add(group);

            foreach (StorageVolumeInfo volume in volumes)
            {
                if (allowMediaDelegate != null && !allowMediaDelegate(volume))
                {
                    continue;
                }
                GalleryItem item = CreateItem(volume);
                item.Enabled = allowMediaDelegate == null ? true : allowMediaDelegate(volume);
                item.Image   = FileSystemImageCache.Cache.GetImage(volume.HintName, IconSizeType.Medium, new Size(32, 32));
                group.Items.Add(item);
            }
        }
        public static void InitializeGallery(GalleryControlGallery gallery, AllowMedia allowMediaDelegate)
        {
            StorageManager.Default.UpdateDevices();
            StorageVolumeInfoCollection volumes = new StorageVolumeInfoCollection();

            foreach (StorageVolumeInfo v in StorageManager.Default.PresentVolumes)
            {
                volumes.Add(v);
            }
            InitializeGallery(gallery, volumes, allowMediaDelegate);
        }
 private void OnDataSourceChanged(StorageVolumeInfoCollection prev, StorageVolumeInfoCollection next)
 {
     if (prev != null)
     {
         prev.CollectionChanged -= OnDataSourceCollectionChanged;
     }
     if (next != null)
     {
         next.CollectionChanged += OnDataSourceCollectionChanged;
     }
     UpdateGallerySource();
 }