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

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

root category handled

File size: 2.0 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                    PwgModelManager.Instance.ImageShown = null;
31                    if (lstImgWPF != null)
32                    {
33                        lstImgWPF.Clear();
34                    }
35
36                    catParam = (PwgCategoryWPF)parameter;
37                    SendUiInfo("Setting up cache data...");
38                    ImageCacheManager.Instance.SetCurrentCategory(catParam.Id.ToString());
39
40                    SendUiInfo("Retriving images list from server...");
41                    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);
42                   
43                    PwgImageListWPFHelper.ConvertPwgImageListToPwgImageListWPF(lstImg, ref lstImgWPF);
44                }
45            }
46            catch (PwgServiceException ex)
47            {
48                SendUiInfo("Error " + ex.NumeroErr + " " + ex.MessageErr);
49            }
50        }
51    }
52}
Note: See TracBrowser for help on using the repository browser.