source: extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdGetImageforCategory.cs @ 11922

Last change on this file since 11922 was 11922, checked in by bayral, 13 years ago

Async image thumbail retriving

File size: 1.9 KB
Line 
1using System;
2using System.Collections.Generic;
3using Com.Piwigo.Lib.IService;
4using Com.Piwigo.Wpf.DTO;
5using Com.Piwigo.Lib.DTO;
6using Com.Piwigo.Wpf.DTO.Helper;
7using Com.Piwigo.Wpf.Helper;
8using Com.Piwigo.Wpf.Service;
9
10namespace Com.Piwigo.Wpf.Command
11{
12    public sealed class PwgCmdGetImageforCategory : AsyncCommand
13    {
14        public override string Text { get { return "Get images for a category"; } }
15
16        protected override void OnExecute(object parameter)
17        {
18            PwgCategoryWPF catParam;
19            Int32 aPage = 0;
20            Int32 aPerPage = 0;
21            Int32 acount = 0;
22
23            try
24            {
25                Uri uriServer = new Uri(PwgModelManager.Instance.Session.ServeurName);
26                if (parameter is PwgCategoryWPF)
27                {
28                    PwgImageListWPF lstImgWPF = PwgModelManager.Instance.ImageList;
29                    SendUiInfo("Removing image...");
30                    if (lstImgWPF != null)
31                    {
32                        lstImgWPF.Clear();
33                    }
34
35                    catParam = (PwgCategoryWPF)parameter;
36                    SendUiInfo("Setting up cache data...");
37                    ImageCacheManager.Instance.SetCurrentCategory(catParam.Id.ToString());
38
39                    SendUiInfo("Retriving images list from server...");
40                    List<PwgImage> lstImg = PwgServiceProvider.Instance.PwgCategoriesService.GetListOfImagesFormCategory(catParam.Id, false, null, null, null, null, null, null, null, null, null, null, null, null, null, true, ref aPage, ref aPerPage, ref  acount);
41                   
42                    PwgImageListWPFHelper.ConvertPwgImageListToPwgImageListWPF(lstImg, ref lstImgWPF);
43                }
44            }
45            catch (PwgServiceException ex)
46            {
47                SendUiInfo("Error " + ex.NumeroErr + " " + ex.MessageErr);
48            }
49        }
50    }
51}
Note: See TracBrowser for help on using the repository browser.