[12015] | 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 PwgCmdGetSubCategorieforCategory : AsyncCommand |
---|
| 13 | { |
---|
| 14 | public override string Text { get { return "Get sub-categories for a category"; } } |
---|
| 15 | |
---|
| 16 | protected override void OnExecute(object parameter) |
---|
| 17 | { |
---|
| 18 | PwgCategoryWPF catParam; |
---|
| 19 | try |
---|
| 20 | { |
---|
| 21 | if (parameter is PwgCategoryWPF) |
---|
| 22 | { |
---|
| 23 | PwgImageListWPF lstImgWPF = PwgModelManager.Instance.ImageList; |
---|
| 24 | catParam = (PwgCategoryWPF)parameter; |
---|
| 25 | |
---|
| 26 | SendUiInfo("Retriving Category list from server..."); |
---|
| 27 | List<PwgCategory> lstCat = PwgServiceProvider.Instance.PwgCategoriesService.GetListOfCategory(catParam.Id, null, null); |
---|
| 28 | if (catParam.Childrens == null) |
---|
| 29 | { |
---|
| 30 | catParam.Childrens = new PwgCategoryListWPF(); |
---|
| 31 | } |
---|
| 32 | PwgCategoryListWPF lstCatWPF = catParam.Childrens; |
---|
| 33 | |
---|
| 34 | PwgCategoryListWPFHelper.ConvertPwgCategoryListToPwgCategoryListWPF(lstCat, ref lstCatWPF); |
---|
| 35 | catParam.IsExpanded = true; |
---|
| 36 | } |
---|
| 37 | } |
---|
| 38 | catch (PwgServiceException ex) |
---|
| 39 | { |
---|
| 40 | SendUiInfo("Error " + ex.NumeroErr + " " + ex.MessageErr); |
---|
| 41 | } |
---|
| 42 | } |
---|
| 43 | } |
---|
| 44 | } |
---|