/// <summary>
        /// Load images in background thread
        /// </summary>
        /// <param name="dirInfoObj"></param>
        private void ShowImageThread(object dirInfoObj)
        {
            IDirectoryInfo dirInfo = (IDirectoryInfo)dirInfoObj;

            lock (_showDirLock)
            {
                _loading = true; //Start loading
                //Create Grid
                foreach (IFileInfo fileInfo in dirInfo.Files)
                {
                    if (fileInfo.Extension != ".jpg")
                        continue;
                    ImageBox imgBox = new ImageBox(fileInfo, _boxSize);
                    _thumbnail.Add(imgBox);
                }

                //Update
                UpdateImage(false);
                //SetVScrollMaximum(_thumbnail.Size.Height - Size.Height);

                //Load image
                foreach (ImageBox box in _thumbnail.Sprites)
                {
                    if (_cancel)
                        break;
                    box.LoadImage();
                    UpdateImage(true);
                }
                _loading = false; //End loading
                _cancel = false; //Reset cancel flag
            }
        }
示例#2
0
 public void Remove(ImageBox imageBox)
 {
     lock (_spriteCln)
         _spriteCln.Remove(imageBox);
 }
示例#3
0
        /// <summary>
        /// Load images in background thread
        /// </summary>
        /// <param name="dirInfoObj"></param>
        private void ShowImageThread(object dirInfoObj)
        {
            IDirectoryInfo dirInfo = (IDirectoryInfo)dirInfoObj;

            lock (_showDirLock)
            {
                _loading = true; //Start loading
                //Create Grid
                foreach (IFileInfo fileInfo in dirInfo.Files)
                {
                    if (fileInfo.Extension != ".jpg")
                        continue;
                    ImageBox imgBox = new ImageBox(fileInfo, _boxSize);
                    _thumbnail.Add(imgBox);
                }
                //Show Grid
                UpdateImage(false);
                //Load image
                foreach (ImageBox box in _thumbnail.Sprites)
                {
                    if (_cancel)
                        break;
                    box.LoadImage();
                    Image oldImage = this.Image;
                    UpdateImage(true);
                    oldImage.Dispose(); //Clean old image memory
                }
                _loading = false; //End loading
                _cancel = false; //Reset cancel flag
            }
        }
示例#4
0
 public void Add(ImageBox imageBox)
 {
     lock (_spriteCln)
         _spriteCln.Add(imageBox);
 }