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 PwgCmdGetImageforTag : AsyncCommand { public override string Text { get { return "Get images for a Tag"; } } protected override void OnExecute(object parameter) { PwgTagWPF tagParam; Int32 aPage = 0; Int32 aPerPage = 0; Int32 acount = 0; try { Uri uriServer = new Uri(PwgModelManager.Instance.Session.ServeurName); if (parameter is PwgTagWPF) { PwgImageListWPF lstImgWPF = PwgModelManager.Instance.ImageList; SendUiInfo("Removing tags..."); PwgModelManager.Instance.ImageShown = null; if (lstImgWPF != null) { lstImgWPF.Clear(); } tagParam = (PwgTagWPF)parameter; SendUiInfo("Setting up cache data..."); ImageCacheManager.Instance.SetCurrentCategory("Tag-" + tagParam.Name); SendUiInfo("Retriving images list from server..."); List lstTagId = new List() { tagParam.Id }; List lstImg = PwgServiceProvider.Instance.PwgTagsService.GetListOfImagesFormTags(lstTagId,null,null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, true, ref aPage, ref aPerPage, ref acount); PwgImageListWPFHelper.ConvertPwgImageListToPwgImageListWPF(lstImg, ref lstImgWPF); } } catch (PwgServiceException ex) { SendUiInfo("Error " + ex.NumeroErr + " " + ex.MessageErr); } } } }