Ignore:
Timestamp:
Aug 8, 2011, 6:57:56 PM (13 years ago)
Author:
bayral
Message:

Async image thumbail retriving

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/PiwigoLib/PiwigoWpf/Services/ImageCacheManager.cs

    r11911 r11922  
    3939        static ImageCacheManager()
    4040        {
     41            Int32 a, b;
     42            ThreadPool.GetMaxThreads(out a, out b);
     43            if (a>20) a = 20;
     44            ThreadPool.SetMaxThreads(a, b);
    4145        }
    4246
     
    211215            public String GetImageFilename(PwgImageWPF aImageWPF)
    212216                {
    213                     String retValue = String.Empty;
     217                    String retImgSrc = String.Empty;
    214218                    if (aImageWPF == null)
    215219                    {
    216                         return retValue;
     220                        return retImgSrc;
    217221                    }
    218222
     
    223227                        if (!File.Exists(localFile))
    224228                        {
     229                            retImgSrc = GetDefaultImage();
     230
    225231                            ThreadPool.QueueUserWorkItem((WaitCallback)delegate
    226232                            {
     
    240246                                image.Save(localFile);
    241247
     248                                aImageWPF.ImgSource = localFile;
    242249                            });
    243 
    244                             retValue = localFile;
    245                         }
     250                        }
     251                        else
     252                        {
     253                            retImgSrc = localFile;
     254                        }
     255                        return retImgSrc;
    246256                    }
    247257                    else
     
    249259                        throw new ApplicationException("Current category not set before using image cache.");
    250260                    }
    251                     return retValue;
    252261                }
    253262
Note: See TracChangeset for help on using the changeset viewer.