public ShopItems() { try { InitializeComponent(); LoggerMobile.Instance.logMessage("Opening ShopItems", Portable.Util.Log.Enums.LoggerEnum.message); _viewModel = (ShopItemsViewModel)Resources["viewModel"]; resultListBox.ItemRealized += resultListBox_ItemRealized; this.Loaded += new RoutedEventHandler(MainPage_Loaded); initialArray = new ShopsJson(); ApplicationBar = new ApplicationBar(); ApplicationBar.Mode = ApplicationBarMode.Default; ApplicationBar.Opacity = 1.0; ApplicationBar.IsVisible = true; ApplicationBar.IsMenuEnabled = true; ApplicationBarIconButton searchBtn = new ApplicationBarIconButton(); searchBtn.IconUri = new Uri("/Assets/Icons/feature.search.png", UriKind.Relative); searchBtn.Text = "Search"; searchBtn.Click += searchBtn_Click; ApplicationBar.Buttons.Add(searchBtn); } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.WP8); } }
protected override void OnCreate(Bundle bundle) { try { RequestWindowFeature(WindowFeatures.NoTitle); base.OnCreate(bundle); LoggerMobile.Instance.logMessage("Opening ShopsAdapter", LoggerEnum.message); SetContentView(Resource.Layout.PublicEvents); LegacyBar = FindViewById<LegacyBar.Library.Bar.LegacyBar>(Resource.Id.actionbar); LegacyBar.SetHomeLogo(Resource.Drawable.icon); LegacyBar.SeparatorColor = Color.Purple; LegacyBar.Title = "Shop Derby"; LegacyBar = FindViewById<LegacyBar.Library.Bar.LegacyBar>(Resource.Id.actionbar); AddHomeAction(typeof(Main), Resource.Drawable.icon); // Get our button from the layout resource, // and attach an event to it Action<ShopsJson> shops = new Action<ShopsJson>(UpdateAdapter); LegacyBar.ProgressBarVisibility = ViewStates.Visible; eventsList = FindViewById<ListView>(Resource.Id.eventsList); initialArray = new ShopsJson(); Action pullMore = new Action(PullMore); Shop.PullShopItems(lastPagePulled, PAGE_COUNT, (Context)this, shops); ListAdapter = new ShopItemsAdapter(this, initialArray.Items, pullMore); eventsList.Adapter = ListAdapter; eventsList.FastScrollEnabled = true; eventsList.ItemClick += skaterList_ItemClick; var myString = new SpannableStringBuilder("lol"); Selection.SelectAll(myString); // needs selection or Index Out of bounds search_events = FindViewById<EditText>(Resource.Id.search_events); search_events.TextChanged += search_skaters_TextChanged; var searchMenuItemAction = new SearchAction(this, null, Resource.Drawable.ic_action_search, search_events); LegacyBar.AddAction(searchMenuItemAction); LegacyBarAction infoAction = new DefaultLegacyBarAction(this, CreateInfoIntent(), Resource.Drawable.action_about); LegacyBar.AddAction(infoAction); m_AdView = FindViewById(Resource.Id.adView); m_AdView.Visibility = ViewStates.Gone; if (SettingsMobile.Instance.User != null && SettingsMobile.Instance.User.IsValidSub) { } } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.Android, (Context)this); } }
public JsonResult SearchAllMerch(int p, int c, string s) { List<StoreItem> names = SiteCache.SearchPublishedStoreItems(c, p, s); ShopsJson shop = new ShopsJson(); shop.Items = new List<ShopItemJson>(); shop.Count = c; shop.Page = p; for (int i = 0; i < names.Count; i++) { ShopItemJson j = new ShopItemJson(); j.Description = names[i].Description; j.Name = names[i].Name; j.AcceptsPayPal = names[i].AcceptsPayPal; j.AcceptsStripe = names[i].AcceptsStripe; j.CanRunOutOfStock = names[i].CanRunOutOfStock; for (int js = 0; js < names[i].Colors.Count; js++) { j.Colors.Add(names[i].Colors[js].HexColor); } j.IsPublished = names[i].IsPublished; j.ItemSize = names[i].ItemSize; j.ItemType = names[i].ItemType; j.Notes = RDN.Utilities.Strings.StringExt.ConvertTextAreaToHtml(names[i].Note); for (int js = 0; js < names[i].Photos.Count; js++) { j.PhotoUrls.Add(names[i].Photos[js].ImageUrl); j.PhotoUrlsThumbs.Add(names[i].Photos[js].ImageThumbUrl); } j.Shipping = names[i].Shipping; j.Price = names[i].Price; j.QuantityInStock = names[i].QuantityInStock; j.SoldBy = names[i].Store.Name; j.SoldById = names[i].Store.MerchantId.ToString().Replace("-", ""); j.StoreItemId = names[i].StoreItemId; j.Views = names[i].Views; j.RDNUrl = ServerConfig.WEBSITE_STORE_DEFAULT_LOCATION + "/roller-derby-item/" + RDN.Utilities.Strings.StringExt.ToSearchEngineFriendly(j.Name) + "/" + j.StoreItemId; shop.Items.Add(j); } return Json(shop, JsonRequestBehavior.AllowGet); }
public ShopsViewController() { initialArray = new ShopsJson(); }
void UpdateAdapter(ShopsJson skaters) { if (IsSearching) initialArray.Items.Clear(); initialArray.Items.AddRange(skaters.Items); InvokeOnMainThread(() => { try { //table.InsertRows(indexPaths.ToArray(), UITableViewRowAnimation.Fade); table.ReloadData(); loading.Hide(); } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.iPhone); } }); }
void UpdateAdapter(ShopsJson events) { initialArray.Items.AddRange(events.Items); RunOnUiThread(() => { try { int firstPosition = eventsList.ScrollY; ListAdapter.NotifyDataSetChanged(); LegacyBar.ProgressBarVisibility = ViewStates.Gone; eventsList.ScrollTo(0, firstPosition); //_dialog.Dismiss(); } catch (Exception exception) { ErrorHandler.Save(exception, MobileTypeEnum.Android, (Context)this); } }); }