Ejemplo n.º 1
0
        public InvoiceLineCell() : base(Key)
        {
            AutoAddSubview(Description = new UILabel {
                Text = "Description",
            }, 4
                           );

            AutoAddSubview(Price = new UILabel {
                Text = "Price", TextAlignment = UITextAlignment.Center
            }, 2);
            AutoAddSubview(Discount = new UIBorderedButton()
            {
                Title  = "0",
                Tapped = (b) => {
                    if (popup != null)
                    {
                        popup.Dispose();
                    }

                    var d = new DiscountViewController(line.Price)
                    {
                        DollarChanged = (dollar) => {
                            popup.Dismiss(true);
                            Line.Discount = dollar;
                        }
                    };

                    popup             = new UIPopoverController(d);
                    popup.DidDismiss += (object sender, EventArgs e) => {
                        line.Discount = 0;
                        d.Dispose();
                        popup.Dispose();
                        popup = null;
                    };
                    popup.PresentFromRect(Discount.Bounds, Discount, UIPopoverArrowDirection.Any, true);
                }
            }, 2);

            AutoAddSubview(TransTypeButton = new UIBorderedButton {
                Title = "S", TintColor = Color.LightBlue
            });
            TransTypeButton.TouchUpInside += (sender, e) => {
                var sheet = new SimpleActionSheet();
                var types = Database.Main.Table <TransactionType>().ToList();
                types.ForEach(x => sheet.Add(x.Description, Color.LightBlue, () => Line.TransType = x));
                sheet.ShowFrom(TransTypeButton.Bounds, TransTypeButton, true);
            };
            AddSubview(Total = new UILabel {
                Text = "Total", TextAlignment = UITextAlignment.Center
            }, 9, columnspan: 2);
        }
Ejemplo n.º 2
0
        public InvoiceLineCell()
            : base(Key)
        {
            AutoAddSubview (Description = new UILabel {
                Text = "Description",
            }, 4
            );

            AutoAddSubview (Price = new UILabel{ Text = "Price",TextAlignment = UITextAlignment.Center },2);
            AutoAddSubview (Discount = new UIBorderedButton () {
                Title = "0",
                Tapped = (b) =>{

                    if(popup != null)
                        popup.Dispose();

                    var d = new DiscountViewController(line.Price){
                        DollarChanged = (dollar) =>{
                            popup.Dismiss(true);
                            Line.Discount = dollar;
                        }
                    };

                    popup = new UIPopoverController(d);
                    popup.DidDismiss += (object sender, EventArgs e) => {
                        line.Discount = 0;
                        d.Dispose();
                        popup.Dispose();
                        popup = null;
                    };
                    popup.PresentFromRect(Discount.Bounds,Discount, UIPopoverArrowDirection.Any,true);
                }},2);

            AutoAddSubview (TransTypeButton = new UIBorderedButton{ Title = "S" ,TintColor = Color.LightBlue});
            TransTypeButton.TouchUpInside += (sender, e) => {
                var sheet = new SimpleActionSheet();
                var types = Database.Main.Table<TransactionType>().ToList();
                types.ForEach(x=> sheet.Add(x.Description,Color.LightBlue,()=> Line.TransType = x));
                sheet.ShowFrom(TransTypeButton.Bounds,TransTypeButton,true);
            };
            AddSubview (Total = new UILabel{ Text = "Total",TextAlignment = UITextAlignment.Center },9,columnspan:2);
        }