public virtual async Task <GetCategoryTreeResponse> GetCategoriesTreeAsync(string rootCategory = "1") { try { const int maxCheckCount = 2; const int delayBeforeCheck = 1800000; var privateClient = this._clientFactory.CreateMagentoCategoriesRepositoryServiceClient(); var res = new catalogCategoryManagementV1GetTreeResponse1(); await ActionPolicies.GetAsync.Do(async() => { var statusChecker = new StatusChecker(maxCheckCount); TimerCallback tcb = statusChecker.CheckStatus; privateClient = this._clientFactory.RefreshMagentoCategoriesRepositoryServiceClient(privateClient); using (var stateTimer = new Timer(tcb, privateClient, 1000, delayBeforeCheck)) { var someRequest = new CatalogCategoryManagementV1GetTreeRequest() { depth = 111, depthSpecified = true, rootCategoryId = ( int )rootCategory.ToDecimalOrDefault(), rootCategoryIdSpecified = true }; res = await privateClient.catalogCategoryManagementV1GetTreeAsync(someRequest).ConfigureAwait(false); } }).ConfigureAwait(false); return(new GetCategoryTreeResponse(res)); } catch (Exception exc) { throw new MagentoSoapException($"An error occured during GetCategoriesTree({rootCategory})", exc); } }
public GetCategoryTreeResponse(catalogCategoryManagementV1GetTreeResponse1 catalogCategoryTreeResponse) { if (catalogCategoryTreeResponse == null || catalogCategoryTreeResponse.catalogCategoryManagementV1GetTreeResponse == null || catalogCategoryTreeResponse.catalogCategoryManagementV1GetTreeResponse.result == null) { return; } var rootCategory = new CategoryNode(catalogCategoryTreeResponse.catalogCategoryManagementV1GetTreeResponse.result); this.RootCategory = rootCategory; }