void ResetInvoiceScreen()
        {
            header = new Library.TransHed();

            invoiceTabHeader.InitHeader();
            invoiceTabDetails.LoadDetailsAdapter();
        }
示例#2
0
 public void InsertIntoTransHedList(TransHed h, int index)
 {
     TransHedList.Insert(index, h);
 }
        public ItemsSelectDialog(Activity context, int theme, TransHed header) : base(context, theme)
        {
            currentContext = context;
            transHed       = header;
            activity       = context;
            //SetTitle(context.GetString (Resource.String.miItems));
            SetContentView(Resource.Layout.dialog_item_search);

            actionBar = (RetailMobile.Fragments.ItemActionBar)((Android.Support.V4.App.FragmentActivity)activity).SupportFragmentManager.FindFragmentById(Resource.Id.ActionBarDialog1);
            actionBar.ActionButtonClicked += new RetailMobile.Fragments.ItemActionBar.ActionButtonCLickedDelegate(ActionBarButtonClicked);
            actionBar.ClearButtons();
            actionBar.AddButtonRight(OK_BUTTON, currentContext.GetString(Resource.String.btnOK), Resource.Drawable.tick_16);
            actionBar.AddButtonLeft(CANCEL_BUTTON, currentContext.GetString(Resource.String.btnClose), Resource.Drawable.close_icon64);
            actionBar.SetTitle(currentContext.GetString(Resource.String.miItems));

            lvItems         = FindViewById <ListView>(Resource.Id.lvItems);
            tbSearch        = FindViewById <EditText>(Resource.Id.tbSearch);
            tbRetVal        = FindViewById <EditText>(Resource.Id.tbRetVal);
            cbCateg1        = FindViewById <Spinner>(Resource.Id.cbCateg1);
            cbCateg2        = FindViewById <Spinner>(Resource.Id.cbCateg2);
            imgItemSelected = FindViewById <ImageView>(Resource.Id.imgItemSelected);
            btnShowImage    = FindViewById <Button>(Resource.Id.btnShowImage);

            btnShowImage.Click += new EventHandler(btnShowImage_Click);

            tbSearch.AfterTextChanged += new EventHandler <Android.Text.AfterTextChangedEventArgs>(tbSearch_AfterTextChanged);
            tbRetVal.AfterTextChanged += new EventHandler <Android.Text.AfterTextChangedEventArgs>(tbSearch_AfterTextChanged);

            List <KeyValuePair <int, string> > categ1List = AddCategoryList(1);
            List <KeyValuePair <int, string> > categ2List = AddCategoryList(2);

            categ1List.Insert(0, new KeyValuePair <int, string>(0, activity.GetString(Resource.String.SpinnerAll)));
            categ2List.Insert(0, new KeyValuePair <int, string>(0, activity.GetString(Resource.String.SpinnerAll)));

            SpinnerAdapter <int, string> categ1Adapter = new SpinnerAdapter <int, string>(activity, categ1List);
            SpinnerAdapter <int, string> categ2Adapter = new SpinnerAdapter <int, string>(activity, categ2List);

            cbCateg1.Adapter       = categ1Adapter;
            cbCateg2.Adapter       = categ2Adapter;
            cbCateg1.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(cbCateg1_ItemSelected);
            cbCateg2.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(cbCateg1_ItemSelected);

            lvItems.FocusChange += new EventHandler <View.FocusChangeEventArgs>(lvItems_FocusChange);
            lvItems.AddHeaderView(context.LayoutInflater.Inflate(Resource.Layout.item_row_checkable_header, null));

            adapterItems = new CheckableItemsAdapter(activity, new ItemInfoList());
            adapterItems.ItemImageSelected += new CheckableItemsAdapter.ItemImageSelectedDelegate(ItemImageSelected);
            lvItems.Adapter = adapterItems;

            adapterItems.SingleItemSelectedEvent += () =>
            {
                _checkedItems = adapterItems.CheckedItemIds;

                Dismiss();
            };
            adapterItems.SingleItemFocusedEvent += (item) =>
            {
                TextView lblItemSelectedInfo = FindViewById <TextView>(Resource.Id.lblItemSelectedInfo);
                //ImageView imgItemSelected = FindViewById<ImageView>(Resource.Id.imgItemSelected);
                lblItemSelectedInfo.Text = item.ItemDesc;
                imgItemSelected.SetImageResource(Resource.Drawable.night);//todo
            };

            lvItems.Scroll += new EventHandler <AbsListView.ScrollEventArgs>((o, e) => {
                if (scrollLoading && e.TotalItemCount > previousTotal)
                {
                    scrollLoading = false;
                    previousTotal = e.TotalItemCount;
                    currentPage++;
                }

                if (!scrollLoading && (e.FirstVisibleItem + e.VisibleItemCount) + 10 >= e.TotalItemCount && e.TotalItemCount >= 10)
                {
//					((IScrollLoadble)lvItems.Adapter).LoadData(currentPage);
                    HeaderViewListAdapter adapter = (HeaderViewListAdapter)lvItems.Adapter;
                    IScrollLoadble origAdapter    = (IScrollLoadble)adapter.WrappedAdapter;
                    origAdapter.LoadData(currentPage);

                    scrollLoading = true;
                }
            });
        }