Пример #1
0
        public override bool OnContextItemSelected(IMenuItem item)
        {
            AdapterContextMenuInfo info = (AdapterContextMenuInfo)item.MenuInfo;

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

            switch (item.ItemId)
            {
            case 1:     // Lagerbestand
                var storageDetails = new Intent(this, typeof(StorageItemQuantityActivity));
                storageDetails.PutExtra("ArticleId", selectedItem.ArticleId);

                this.SaveListState();
                this.StartActivityForResult(storageDetails, 20);

                return(true);

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

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

                return(true);

            default:
                return(base.OnContextItemSelected(item));
            }
        }
Пример #2
0
        private void ShowPictureAndDetails(int articleId, string title)
        {
            var headerView = FindViewById <TextView>  (Resource.Id.StorageItemQuantity_ArticleDetailHeader);
            var imageView  = FindViewById <ImageView> (Resource.Id.StorageItemQuantity_Image);
            var detailView = FindViewById <TextView>  (Resource.Id.StorageItemQuantity_ArticleDetail);

            if (articleId == 0)
            {
                headerView.Text = title;
                detailView.Text = "Details zum " + title;
                imageView.SetImageResource(Resource.Drawable.ic_add_a_photo_white_24dp);

                return;
            }
            try
            {
                if (StorageItemQuantityActivity.article == null)
                {
                    StorageItemQuantityActivity.article = Database.GetArticle(articleId);
                }

                if (StorageItemQuantityActivity.articleImage == null)
                {
                    StorageItemQuantityActivity.articleImage = Database.GetArticleImage(articleId, false);
                }

                Article article = StorageItemQuantityActivity.article;

                this.durableInfinity = article.DurableInfinity;

                ArticleListView articleView = new ArticleListView(article);

                headerView.Text = articleView.Heading;
                detailView.Text = articleView.SubHeading;
                if (!string.IsNullOrEmpty(articleView.Notes))
                {
                    detailView.Text += "\n";
                    detailView.Text += articleView.Notes;
                }

                this.ShowPicture(detailView, imageView);
            }
            catch (Exception ex)
            {
                TRACE(ex);

                imageView.SetImageResource(Resource.Drawable.baseline_error_outline_black_24);
                headerView.Text = null;
                detailView.Text = ex.Message + ex.StackTrace;
            }
        }
Пример #3
0
        private void OnOpenArticleDetails(object sender, AdapterView.ItemClickEventArgs e)
        {
            Java.Lang.Object itemObject = ((ListView)sender).GetItemAtPosition(e.Position);

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

            // Nur Artikelauswahl, keine Detailsbearbeitung
            if (this.selectArticleOnly)
            {
                Intent intent = new Intent();
                intent.PutExtra("Heading", item.Heading);
                intent.PutExtra("ArticleId", item.ArticleId);

                this.SetResult(Result.Ok, intent);

                this.OnBackPressed();
                return;
            }

            this.ShowArticleDetails(item.ArticleId, item.Heading);
        }