示例#1
0
        public List <Library> GetLibrarys([FromRoute] int page = 1)
        {
            var qry = _context.Librarys.OrderBy(p => p.LibraryName);

            PagingList <Library> LibraryList;

            if (page != 0)
            {
                LibraryList = PagingList.Create(qry, StringsPerPage, page);
            }
            else
            {
                LibraryList = PagingList.Create(qry, _context.Librarys.Count() + 1, 1);
            }

            return(LibraryList.ToList());
        }
示例#2
0
        /// <summary>
        /// Checks for any missing images in library (i.e. image exists in library but not on disk); gives
        /// user message box notif and returns true if missing image(s) found; returns false otherwise
        /// </summary>
        /// <returns>True if missing image(s) found, false otherwise</returns>
        public bool CheckMissing()
        {
            List <string> missingImages = new List <string>();

            // Loop over each WBImage in library
            foreach (WBImage image in LibraryList.ToList())
            {
                // Check if image does not exist at WBImage's associated path (or no permissions to that file)
                if (!File.Exists(image.Path))
                {
                    // Add this image's file name to the list of missing images
                    missingImages.Add(Path.GetFileName(image.Path));

                    // Remove this WBImage from the library
                    LibraryList.Remove(image);
                }
            }

            // If missing images found, show message box explaining this to user and return true
            if (missingImages.Count > 0)
            {
                string message = "The following image files are missing and were removed from the library:\n\n";
                foreach (string filename in missingImages)
                {
                    message += filename + "\n";
                }
                message += "\nThese files may have been moved or deleted, or WallBrite may not have permission to access them. If you're sure " +
                           "the files are still where they were, try running WallBrite as administrator to make sure it has permissions to access them.";

                FlexibleMessageBox.Show(message, "Missing Files", WinForms.MessageBoxButtons.OK, WinForms.MessageBoxIcon.Warning);
                return(true);
            }

            // If no missing images found, return false
            return(false);
        }