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 PwgCmdGetSubCategorieforCategory : AsyncCommand { public override string Text { get { return "Get sub-categories for a category"; } } protected override void OnExecute(object parameter) { PwgCategoryWPF catParam; try { if (parameter is PwgCategoryWPF) { PwgImageListWPF lstImgWPF = PwgModelManager.Instance.ImageList; catParam = (PwgCategoryWPF)parameter; SendUiInfo("Retriving Category list from server..."); List lstCat = PwgServiceProvider.Instance.PwgCategoriesService.GetListOfCategory(catParam.Id, null, null); if (catParam.Childrens == null) { catParam.Childrens = new PwgCategoryListWPF(); } PwgCategoryListWPF lstCatWPF = catParam.Childrens; PwgCategoryListWPFHelper.ConvertPwgCategoryListToPwgCategoryListWPF(lstCat, ref lstCatWPF); catParam.IsExpanded = true; } } catch (PwgServiceException ex) { SendUiInfo("Error " + ex.NumeroErr + " " + ex.MessageErr); } } } }