public override bool OnContextItemSelected(IMenuItem item)
        {
            AdapterContextMenuInfo info = (AdapterContextMenuInfo)item.MenuInfo;

            ListView            listView     = FindViewById <ListView>(Resource.Id.StorageItemView);
            StorageItemListView selectedItem = Tools.Cast <StorageItemListView>(listView.Adapter.GetItem(info.Position));

            switch (item.ItemId)
            {
            case 1:     // Artikelangabe
                this.OnOpenArticleDetails(selectedItem.ArticleId);
                return(true);

            case 2:     // Auf Einkaufsliste
                AddToShoppingListDialog.ShowDialog(
                    this,
                    selectedItem.ArticleId,
                    null, null,
                    this.RefreshStorageItemList);

                return(true);

            default:
                return(base.OnContextItemSelected(item));
            }
        }
Esempio n. 2
0
        public override bool OnContextItemSelected(IMenuItem item)
        {
            AdapterContextMenuInfo info = (AdapterContextMenuInfo)item.MenuInfo;

            ListView            listView     = FindViewById <ListView>(Resource.Id.StorageItemView);
            StorageItemListView selectedItem = Tools.Cast <StorageItemListView>(listView.Adapter.GetItem(info.Position));

            switch (item.ItemId)
            {
            case 1:     // Artikelangabe
                this.OnOpenArticleDetails(selectedItem.ArticleId);
                return(true);

            case 2:     // Auf Einkaufszettel
                this.AddToShoppingListAutomatically(selectedItem.ArticleId);

                this.SaveListState();
                this.ShowStorageItemList(this.lastSearchText);
                this.RestoreListState();

                return(true);

            default:
                return(base.OnContextItemSelected(item));
            }
        }
        private void OnOpenArticleStorageItemQuentity(object sender, AdapterView.ItemClickEventArgs e)
        {
            Java.Lang.Object itemObject = ((ListView)sender).GetItemAtPosition(e.Position);

            StorageItemListView item = Tools.Cast <StorageItemListView>(itemObject);

            StorageItemQuantityActivity.Reload();   // Artikel neu laden

            var storageItemQuantity = new Intent(this, typeof(StorageItemQuantityActivity));

            storageItemQuantity.PutExtra("Heading", item.Heading);
            storageItemQuantity.PutExtra("ArticleId", item.ArticleId);
            this.StartActivityForResult(storageItemQuantity, StorageItemQuantityId);

            ListView listView = FindViewById <ListView>(Resource.Id.StorageItemView);

            this.listViewState = listView.OnSaveInstanceState();
        }