Ignore:
Timestamp:
Aug 9, 2011, 6:08:04 PM (13 years ago)
Author:
bayral
Message:

New step for piwigowpf

File:
1 edited

Legend:

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

    r11922 r11926  
    2727        public static String GetDefaultImage()
    2828        {
    29             return ("pack://application:,,,/Pictures/Globe.png");
     29            return ("pack://application:,,,/Pictures/64x64/images.png");
     30        }
     31
     32        public static String GetLoadImage()
     33        {
     34            return ("pack://application:,,,/Pictures/64x64/html.png");
    3035        }
    3136
     
    213218            }
    214219
    215             public String GetImageFilename(PwgImageWPF aImageWPF)
    216                 {
    217                     String retImgSrc = String.Empty;
     220            public String GetImageFilename(PwgImageWPF aImageWPF, String strImageType)
     221                {
     222                    String retImgSrc = GetDefaultImage();
    218223                    if (aImageWPF == null)
    219224                    {
     
    223228                    if (_currentCategory != null)
    224229                    {
    225                         String localFile = Path.Combine(_currentCategory.BasePath.FullName, String.Format("{0}-{1}", aImageWPF.Id, aImageWPF.File));
     230                        String localDir = Path.Combine(_currentCategory.BasePath.FullName, strImageType);
     231                        if (!Directory.Exists(localDir))
     232                        {
     233                            Directory.CreateDirectory(localDir);
     234                        }
     235
     236                        String localFile = Path.Combine(localDir, String.Format("{0}-{1}", aImageWPF.Id, aImageWPF.File));
    226237
    227238                        if (!File.Exists(localFile))
    228239                        {
    229                             retImgSrc = GetDefaultImage();
     240                            retImgSrc = GetLoadImage();
    230241
    231242                            ThreadPool.QueueUserWorkItem((WaitCallback)delegate
     
    246257                                image.Save(localFile);
    247258
    248                                 aImageWPF.ImgSource = localFile;
     259                                switch (strImageType)
     260                                {
     261                                    case "Thumb" :
     262                                        aImageWPF.ImgSourceThumb = localFile;
     263                                        break;
     264                                    case "LowRes":
     265                                        aImageWPF.ImgSource = localFile;
     266                                        break;
     267                                }
     268
    249269                            });
    250270                        }
Note: See TracChangeset for help on using the changeset viewer.