Beispiel #1
0
        private void HandlePassedData(List <BitmapImage> argBitmap, List <string> argPathes)
        {
            if (bitmapList != null && bitmapList.Count > 0)
            {
                bitmapList.Clear();
            }
            if (pathesList != null && pathesList.Count > 0)
            {
                pathesList.Clear();
            }
            this.bitmapList = new List <BitmapImage>(argBitmap);
            this.pathesList = new List <string>(argPathes);

            if (bitmapList.Count == pathesList.Count)
            {
                if (GalleryCollection != null && GalleryCollection.Count > 0)
                {
                    GalleryCollection.Clear();
                }
                for (int i = 0; i < bitmapList.Count; i++)
                {
                    GalleryCollection.Add(new GalleryModel(bitmapList[i], Path.GetFileName(pathesList[i])));
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Return the list of galleries created by a user. Sorted from newest to oldest.
        /// </summary>
        public GalleryCollection VtGetListOfGalleries()
        {
            var galleryCollection = new GalleryCollection();

            var startTime = DateTime.Now;
            GalleryCollection searchedForPage = null;
            var page = 1;

            do
            {
                RaiseSearchProgressEvent("GalleriesGetList", galleryCollection.Count, startTime);

                searchedForPage = GalleriesGetList(page, SearchOptions_PerPage_MAX);
                foreach (var gallery in searchedForPage)
                {
                    galleryCollection.Add(gallery);
                }
                page++;
            } while (searchedForPage.Count >= SearchOptions_PerPage_MAX);

            return(galleryCollection);
        }
        /// <summary>
        /// Get a list of galleries the specified <paramref name="userName"/> can administer. Site administrators can view all
        /// galleries, while gallery administrators may have access to zero or more galleries.
        /// </summary>
        /// <param name="userName">Name of the user.</param>
        /// <returns>
        /// Returns an <see cref="IGalleryCollection"/> containing the galleries the current user can administer.
        /// </returns>
        public static IGalleryCollection GetGalleriesUserCanAdminister(string userName)
        {
            IGalleryCollection adminGalleries = new GalleryCollection();
            foreach (IGalleryServerRole role in RoleController.GetGalleryServerRolesForUser(userName))
            {
                if (role.AllowAdministerSite)
                {
                    return Factory.LoadGalleries();
                }
                else if (role.AllowAdministerGallery)
                {
                    foreach (IGallery gallery in role.Galleries)
                    {
                        if (!adminGalleries.Contains(gallery))
                        {
                            adminGalleries.Add(gallery);
                        }
                    }
                }
            }

            return adminGalleries;
        }
        /// <summary>
        /// Gets a collection of all the galleries the specified <paramref name="userName" /> has access to.
        /// </summary>
        /// <param name="userName">Name of the user.</param>
        /// <returns>Returns an <see cref="IGalleryCollection" /> of all the galleries the specified <paramref name="userName" /> has access to.</returns>
        public static IGalleryCollection GetGalleriesForUser(string userName)
        {
            IGalleryCollection galleries = new GalleryCollection();

            foreach (IGalleryServerRole role in RoleController.GetGalleryServerRolesForUser(userName))
            {
                foreach (IGallery gallery in role.Galleries)
                {
                    if (!galleries.Contains(gallery))
                    {
                        galleries.Add(gallery);
                    }
                }
            }

            return galleries;
        }