예제 #1
0
 protected override void CreateChildControls()
 {
     if ((FolderModeTemplate != null) && (_mode == AlbumHandlerMode.Folder))
     {
         Controls.Clear();
         _parentFolder = null;
         AlbumTemplateContainer container = new AlbumTemplateContainer(this);
         container.EnableViewState = false;
         FolderModeTemplate.InstantiateIn(container);
         Controls.Add(container);
     }
     if ((PageModeTemplate != null) && (_mode == AlbumHandlerMode.Page))
     {
         Controls.Clear();
         _image = null;
         AlbumTemplateContainer container = new AlbumTemplateContainer(this);
         container.EnableViewState = false;
         PageModeTemplate.InstantiateIn(container);
         Controls.Add(container);
     }
 }
예제 #2
0
        /// <summary>
        /// Ensures that the next and previous image infos have been computed.
        /// </summary>
        private void EnsureNextPrevious()
        {
            bool pictureFound = false;
            string dirPath = System.IO.Path.GetDirectoryName(_physicalPath);
            FileInfo[] pics = GetImages(dirPath);
            Array.Sort(pics, CompareFileNames);

            string prev = null;
            string next = null;
            string prevPhysPath = null;
            string nextPhysPath = null;

            if (ParentFolder == null) return;
            if (ParentFolder.Path == null) return;

            string parentPath = ParentFolder.Path;

            if (pics != null && pics.Length > 0)
            {
                foreach (FileInfo p in pics)
                {
                    // don't lower - JA 2008-03-23
                    //string picture = p.Name.ToLower();
                    string picture = p.Name;

                    if (String.Equals(p.FullName, _physicalPath, StringComparison.InvariantCultureIgnoreCase))
                    {
                        pictureFound = true;
                    }
                    else if (pictureFound)
                    {
                        nextPhysPath = p.FullName;
                        next = parentPath + '/' + picture;
                        break;
                    }
                    else
                    {
                        prevPhysPath = p.FullName;
                        prev = parentPath + '/' + picture;
                    }
                }
            }

            if (!pictureFound)
            {
                prevPhysPath = null;
                nextPhysPath = null;
            }
            if (prev != null)
            {
                _previousImage = new ImageInfo(this, prev, prevPhysPath);
            }
            if (next != null)
            {
                _nextImage = new ImageInfo(this, next, nextPhysPath);
            }
        }