/// <summary> /// Populates the category. /// </summary> /// <returns>The category.</returns> public override async Task<bool> PopulateCategory () { #region Animated overlay loader // Determine the correct size to start the overlay (depending on device orientation) var bounds = UIScreen.MainScreen.Bounds; // portrait bounds if (UIApplication.SharedApplication.StatusBarOrientation == UIInterfaceOrientation.LandscapeLeft || UIApplication.SharedApplication.StatusBarOrientation == UIInterfaceOrientation.LandscapeRight) { bounds.Size = new CGSize(bounds.Size.Height, bounds.Size.Width); } // show the loading overlay on the UI thread using the correct orientation sizing loadingOverlay = new LoadingOverlay (bounds); this.View.Add(loadingOverlay); #endregion RestService rest = new RestService (); var result = await rest.GetDataAsync(rest.MobileRestURL, "Category/"+this.ParentCategoryId+""); if (!string.IsNullOrEmpty (result)) { categories = JsonConvert.DeserializeObject <List<Mob_Category>>(result); } tableItems = new List<CategoryTableItem> (); for(int i=0; i < categories.Count ; i++) { tableItems.Add (new CategoryTableItem (){ Heading = categories[i].NameAr, ImageName= "bell70.png", HasChilds = categories[i].HasChilds, CategoryId = categories[i].CategoryId }); } var classifiedControlle = this.Storyboard.InstantiateViewController("ClassifiedViewController") as ClassifiedViewController; if (classifiedControlle != null) { tblSubCat.Source = new SubCategoryTableSource(tableItems, this ,classifiedControlle); } //base.LoadView (); FitpulseTheme.Apply (tblSubCat); //Hide loading overlay loader loadingOverlay.Hide(); return categories.Count > 0; }
/// <summary> /// Populates the category. /// </summary> /// <returns>The category.</returns> public async Task<List<ClassifiedHeaderTableItem>> PopulateClassifieds() { var classifiedslist = new List<Mob_Classifieds_Header> (); RestService rest = new RestService (); var result = await rest.GetDataAsync(rest.MobileRestURL, string.Format("Classified/Get/{0}/{1}/{2}", this.PageIndex,country,language)); if (!string.IsNullOrEmpty (result)) { classifiedslist = JsonConvert.DeserializeObject <List<Mob_Classifieds_Header>>(result); } var tableItems = new List<ClassifiedHeaderTableItem> (); tableItems = classifiedslist.Select(p=> new ClassifiedHeaderTableItem( ) { Address = p.CityName + " - " + p.DistrictName, Category = p.CategoryName, Date = p.CreateDate, ImageURL = p.ImageThumbURL, Price = p.Price.ToString(), Title = p.Title }).ToList(); return tableItems; }
/// <summary> /// Populates the category. /// </summary> /// <returns>The category.</returns> public override async Task<bool> PopulateCategory() { RestService rest = new RestService (); var result = await rest.GetDataAsync(rest.MobileRestURL, "Category"); if (!string.IsNullOrEmpty (result)) { categories = JsonConvert.DeserializeObject <List<Mob_Category>>(result); } tableItems = new List<CategoryTableItem> (); for(int i=0; i < categories.Count ; i++) { tableItems.Add (new CategoryTableItem (){ Heading = categories[i].NameAr, ImageName= "bell70.png", HasChilds = categories[i].HasChilds, CategoryId = categories[i].CategoryId }); } var classifiedControlle = (ClassifiedsViewController)Storyboard.InstantiateViewController("ClassifiedsViewController"); var subcategoryController = (SubCatViewController)Storyboard.InstantiateViewController("SubCatViewController"); if (classifiedControlle != null) { tableCategory.Source = new CategoryTableSource(tableItems,this,classifiedControlle,subcategoryController); } //Hide loading overlay loader loadingOverlay.Hide(); return categories.Count > 0; }