public ProductAttributesEditAdapter( Context context, int resourceId = Resource.Layout.ProductAttributesEditRowItem ) : base(context, resourceId) { AttributeAdapter = new BaseArrayAdapter <Models.Attribute>(Context); }
public AddGoodsDispatchedNoteAdapter( Context context, ILocationService locationService, int resourceId = Resource.Layout.AddGoodsDispatchedNoteRowItem) : base(context, resourceId) { Criteria = new FilterCriteria() { ItemsPerPage = 10 }; _locationService = locationService; _locationAdapter = new BaseArrayAdapter <Models.Location>(Context); _activity = (Activity)Context; }
public override View GetView(int position, View convertView, ViewGroup parent) { AddGoodsDispatchedNoteAdapterViewHolder viewHolder = null; if (convertView == null) { convertView = _layoutInflater.Inflate(_resourceId, parent, false); viewHolder = new AddGoodsDispatchedNoteAdapterViewHolder(convertView); convertView.Tag = viewHolder; } else { viewHolder = (AddGoodsDispatchedNoteAdapterViewHolder)convertView.Tag; } var item = GetItem(position); viewHolder.Position = position; viewHolder.AddGoodsDispatchedNoteRowItemProductName.Text = item.Name; viewHolder.AddGoodsDispatchedNoteRowItemLocation.Adapter = _locationAdapter; var token = Helpers.Helpers.CancelAndSetTokenForView(viewHolder.AddGoodsDispatchedNoteRowItemLocation); Task.Run(async() => { var adapter = new BaseArrayAdapter <Models.Location>(Context, Android.Resource.Layout.SimpleListItem1); var result = await _locationService.GetLocationsByProduct("name", item.Name, token); _activity.RunOnUiThread(() => { viewHolder.AddGoodsDispatchedNoteRowItemLocation.Adapter = adapter; adapter.UpdateList(result.Data); }); }, token); return(convertView); }