[11904] | 1 | using System; |
---|
| 2 | using System.Collections.Generic; |
---|
| 3 | using Com.Piwigo.Lib.IService; |
---|
| 4 | using Com.Piwigo.Wpf.DTO; |
---|
| 5 | using Com.Piwigo.Lib.DTO; |
---|
| 6 | using Com.Piwigo.Wpf.DTO.Helper; |
---|
| 7 | using Com.Piwigo.Wpf.Helper; |
---|
| 8 | using Com.Piwigo.Wpf.Service; |
---|
| 9 | |
---|
| 10 | namespace 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 | } |
---|