using System; using System.Collections.Generic; using Com.Piwigo.Lib.IService; using Com.Piwigo.Wpf.DTO; using Com.Piwigo.Lib.DTO; using Com.Piwigo.Wpf.DTO.Helper; using Com.Piwigo.Wpf.Helper; using Com.Piwigo.Wpf.Service; namespace Com.Piwigo.Wpf.Command { public sealed class PwgCmdGetImageforCategory : PwgCmdBase { public override bool CanExecute(object parameter) { Boolean retVal = false; if ( AppHelper.IsInDesignModeStatic == true) { retVal = false; } else { if ((PwgModelManager.Instance.Session != null) & (PwgModelManager.Instance.Session.ServeurName != null)) { retVal = !String.IsNullOrWhiteSpace(PwgModelManager.Instance.Session.ServeurName); } } return (retVal); } public override void Execute(object parameter) { PwgCategoryWPF catParam; Int32 aPage = 0; Int32 aPerPage = 0; Int32 acount = 0; try { Uri uriServer = new Uri(PwgModelManager.Instance.Session.ServeurName); if (parameter is PwgCategoryWPF) { catParam = (PwgCategoryWPF)parameter; List 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); PwgImageListWPF lstImgWPF = PwgModelManager.Instance.ImageList; PwgImageListWPFHelper.ConvertPwgImageListToPwgImageListWPF(lstImg, ref lstImgWPF); } } catch (PwgServiceException ex) { Console.WriteLine("Erreur " + ex.NumeroErr + " " + ex.MessageErr); Console.WriteLine(ex.Message); } } } }