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

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

PiwigoWPF

File size: 2.1 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 : PwgCmdBase
13    {
14        public override bool CanExecute(object parameter)
15        {
16            Boolean retVal = false;
17            if ( AppHelper.IsInDesignModeStatic == true)
18            {
19                retVal = false;
20            }
21            else
22            {
23                if ((PwgModelManager.Instance.Session != null)
24                    & (PwgModelManager.Instance.Session.ServeurName != null))
25                {
26                    retVal = !String.IsNullOrWhiteSpace(PwgModelManager.Instance.Session.ServeurName);
27                }
28            }
29            return (retVal);
30        }
31
32        public override void Execute(object parameter)
33        {
34            PwgCategoryWPF catParam;
35            Int32 aPage = 0;
36            Int32 aPerPage = 0;
37            Int32 acount = 0;
38
39            try {
40                Uri uriServer = new Uri(PwgModelManager.Instance.Session.ServeurName);
41                if (parameter is PwgCategoryWPF)
42                {
43                    catParam = (PwgCategoryWPF)parameter;
44
45                    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);
46                    PwgImageListWPF lstImgWPF = PwgModelManager.Instance.ImageList;
47
48                    PwgImageListWPFHelper.ConvertPwgImageListToPwgImageListWPF(lstImg, ref lstImgWPF);
49                }
50             
51            }
52            catch (PwgServiceException ex)
53            {
54                Console.WriteLine("Erreur " + ex.NumeroErr + " " + ex.MessageErr);
55                Console.WriteLine(ex.Message);
56            }
57
58        }
59    }
60}
Note: See TracBrowser for help on using the repository browser.