private void GoPath(string path, int pageIndex) { try { var catalogueLogic = new CollectionLogic.CatalogueLogic(cbbSiteType.SelectedItem.ToString()); catalogueLogic.SetPath(path); catalogueLogic.PageNum = pageIndex; var localTagID = ((CityLocalTagEntity)clbStoreTag.SelectedItem).LocalTagID; var cityLocalTagBll = new Maticsoft.BLL.CityLocalTag(); var cityLocalTag = cityLocalTagBll.GetModel(localTagID); if (cityLocalTag != null) { catalogueLogic.CircleId = int.Parse(cityLocalTag.Circleid); } var catalogueList = catalogueLogic.GetStoreInfo(pageIndex); #region GoPathDelegate goPathDelegate = (nextPage, beforePage, pageNum, cList) => { catalogueListBox.Items.Clear(); if (catalogueList != null) { catalogueListBox.Items.AddRange(cList.ToArray()); } for (int i = 0; i < catalogueListBox.Items.Count; i++) { catalogueListBox.SetItemChecked(i, ((Maticsoft.Model.Catalogue)catalogueListBox.Items[i]).IsRead); } labPage.Text = pageNum.ToString(CultureInfo.InvariantCulture); btnNextPage.Enabled = !string.IsNullOrEmpty(nextPage); btnNextPage.Tag = nextPage; if (pageIndex > 1) { btnBeforePage.Enabled = !string.IsNullOrEmpty(beforePage); btnBeforePage.Tag = beforePage; } else { btnBeforePage.Enabled = false; btnBeforePage.Tag = string.Empty; } }; #endregion this.Invoke(goPathDelegate, catalogueLogic.NextPage, catalogueLogic.BeforePage, catalogueLogic.PageNum, catalogueList); } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }
private void GoPath(string path, int pageIndex) { var catalogueLogic = new CatalogueLogic(); catalogueLogic.SetPath(path); catalogueLogic.PageNum = pageIndex; var localTagID = ((CityLocalTagEntity)clbStoreTag.SelectedItem).LocalTagID; var cityLocalTagBll = new Maticsoft.BLL.CityLocalTag(); var cityLocalTag = cityLocalTagBll.GetModel(localTagID); if (cityLocalTag != null) { catalogueLogic.CircleId = int.Parse(cityLocalTag.Circleid); } var catalogueList = catalogueLogic.GetStoreInfo(pageIndex); #region GoPathDelegate goPathDelegate = (s, index, cList) => { catalogueListBox.Items.Clear(); if (catalogueList != null) { catalogueListBox.Items.AddRange(catalogueList.ToArray()); } for (int i = 0; i < catalogueListBox.Items.Count; i++) { catalogueListBox.SetItemChecked(i, ((Maticsoft.Model.Catalogue)catalogueListBox.Items[i]).IsRead); } labPage.Text = catalogueLogic.PageNum.ToString(CultureInfo.InvariantCulture); btnNextPage.Enabled = catalogueLogic.IflastPage == 0; }; #endregion this.Invoke(goPathDelegate, path, pageIndex, catalogueList); }