source: extensions/PiwigoLib/PiwigoWpf/Command/PwgCmdGetImageforTag.cs

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

rename category to Albums

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 PwgCmdGetImageforTag : AsyncCommand
13    {
14        public override string Text { get { return "Get images for a Tag"; } }
15
16        protected override void OnExecute(object parameter)
17        {
18            PwgTagWPF tagParam;
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 PwgTagWPF)
27                {
28                    PwgImageListWPF lstImgWPF = PwgModelManager.Instance.ImageList;
29                    SendUiInfo("Removing tags...");
30                    PwgModelManager.Instance.ImageShown = null;
31                    if (lstImgWPF != null)
32                    {
33                        lstImgWPF.Clear();
34                    }
35
36                    tagParam = (PwgTagWPF)parameter;
37                    SendUiInfo("Setting up cache data...");
38                    ImageCacheManager.Instance.SetCurrentAlbum("Tag-" + tagParam.Name);
39
40                    SendUiInfo("Retriving images list from server...");
41                    List<Int32> lstTagId = new List<int>() { tagParam.Id };
42                    List<PwgImage> 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);
43
44                    PwgImageListWPFHelper.ConvertPwgImageListToPwgImageListWPF(lstImg, ref lstImgWPF);
45                }
46            }
47            catch (PwgServiceException ex)
48            {
49                SendUiInfo("Error " + ex.NumeroErr + " " + ex.MessageErr);
50            }
51        }
52    }
53}
Note: See TracBrowser for help on using the repository browser.