Example #1
0
        private void ListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            ListView listView = sender as ListView;

            Java.Lang.Object itemObject = listView.GetItemAtPosition(e.Position);
            ShoppingListView item       = Tools.Cast <ShoppingListView>(itemObject);

            string removeText    = Resources.GetString(Resource.String.ShoppingList_Remove);
            string toStorage     = Resources.GetString(Resource.String.ShoppingList_ToStorage);
            string articleDetail = Resources.GetString(Resource.String.ShoppingList_Artikelangaben);
            string gekauft       = Resources.GetString(Resource.String.ShoppingList_Gekauft);

            string[] actions = { "+10", "+1", "-1", "-10", removeText, toStorage, articleDetail, gekauft };

            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.SetTitle(item.Heading);
            builder.SetItems(actions, (sender2, args) =>
            {
                switch (args.Which)
                {
                case 0:     // +10
                    Database.AddToShoppingList(item.ArticleId, 10);
                    this.ShowShoppingList();
                    break;

                case 1:     // +1
                    Database.AddToShoppingList(item.ArticleId, 1);
                    this.ShowShoppingList();
                    break;

                case 2:     // -1
                    Database.AddToShoppingList(item.ArticleId, -1);
                    this.ShowShoppingList();
                    break;

                case 3:     // -10
                    Database.AddToShoppingList(item.ArticleId, -10);
                    this.ShowShoppingList();
                    break;

                case 4:     // Entfernen (gekauft)
                    Database.RemoveFromShoppingList(item.ArticleId);
                    this.LoadSupermarketList();
                    this.ShowShoppingList();
                    break;

                case 5:     // Ins Lagerbestand
                    var storageDetails = new Intent(this, typeof(StorageItemQuantityActivity));
                    storageDetails.PutExtra("ArticleId", item.ArticleId);
                    storageDetails.PutExtra("EditMode", true);
                    this.StartActivityForResult(storageDetails, EditStorageQuantity);
                    break;

                case 6:     // Artikelangaben...
                    var articleDetails = new Intent(this, typeof(ArticleDetailsActivity));
                    articleDetails.PutExtra("ArticleId", item.ArticleId);
                    this.StartActivityForResult(articleDetails, EditArticle);

                    break;

                case 7:     // Als 'Gekauft' markieren
                    Database.SetShoppingItemBought(item.ArticleId, true);
                    this.ShowShoppingList();

                    break;
                }

                return;
            });
            builder.Show();
        }
Example #2
0
 public ShoppingListViewEventArgs(ShoppingListView view)
 {
     this.ShoppingListView = view;
 }