private void btnOrder_Click(Object sender, EventArgs e) { if (item_list_view_adapter == null) { item_list_view_adapter = new ItemListViewAdapter(Activity, Resource.Layout.item_list_element, Resource.Id.DescItem, new JavaList <ItemSingle>()); } EditText amount = (EditText)dialog.FindViewById(Resource.Id.Amount); EditText itemName = (EditText)dialog.FindViewById(Resource.Id.itemName); EditText basePrice = (EditText)dialog.FindViewById(Resource.Id.BasePrice); EditText discount = (EditText)dialog.FindViewById(Resource.Id.Discount); TextView endprice = (TextView)dialog.FindViewById(Resource.Id.Endprice); if (!amount.Text.Equals("")) { String id = itemName.Text; ItemAdapter temp_adapter = (ItemAdapter)actv_Item.Adapter; ItemSingle item = (ItemSingle)temp_adapter.getItem(id); item.quantity = amount.Text; item.endprice = endprice.Text; item_list_view_adapter.Add(item); items_list.Adapter = item_list_view_adapter; item_list_view_adapter.NotifyDataSetChanged(); actv_Item.Text = ""; dialog.Dismiss(); } else { Activity.RunOnUiThread(() => { Toast.MakeText(Activity, "Please enter the Amount!", ToastLength.Short).Show(); }); } }
private void Item_Order_Popup(String itemID, LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View itemOrderPopup = inflater.Inflate(Resource.Layout.Item_Order_Popup, null); dialog = new Dialog(container.Context); dialog.SetContentView(itemOrderPopup); dialog.SetTitle("Order selected Item"); String itemDesc = null; ItemSingle item = item_list_adapter.getItem(itemID); EditText itemName = (EditText)dialog.FindViewById(Resource.Id.itemName); EditText amount = (EditText)dialog.FindViewById(Resource.Id.Amount); EditText basePrice = (EditText)dialog.FindViewById(Resource.Id.BasePrice); EditText discount = (EditText)dialog.FindViewById(Resource.Id.Discount); TextView endprice = (TextView)dialog.FindViewById(Resource.Id.Endprice); Button btnOrder = (Button)dialog.FindViewById(Resource.Id.btnOrder); Button btnCancel = (Button)dialog.FindViewById(Resource.Id.btnCancelOrder); itemDesc = item.description; itemName.Text = item.no; amount.Text = ""; amount.Hint = "Amount..."; basePrice.Text = item.unitprice; discount.Text = ""; discount.Hint = "Discount..."; endprice.Text = "0.00"; dialog.Show(); amount.AfterTextChanged += delegate { ThreadPool.QueueUserWorkItem(o => { amount_TextChanged(this, null); }); }; btnOrder.Click += delegate { btnOrder_Click(this, null); }; }