예제 #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);
        }
예제 #2
0
            void Init()
            {
//				AddSubview(dollarText = new NumberEntryViewConponent{
//					Column = 0,
//					ColumnSpan = 3,
//					LabelText = "Dollar Amount",
//
//				});
//				dollarText.Textview.NewValue = (s) => {
//
//				};
                this.TintColor        = Color.Red;
                AddSubview(twentyFive = new TintedButton {
                    Title = "25%",
                    Font  = UIFont.BoldSystemFontOfSize(20),
                    //BackgroundColor = UIColor.White.ColorWithAlpha(.1f),
//					BorderWidth = 1,
                    Tapped = (b) => {
                        PercentChange(.25f);
                    },
                }, 0, 1, 0, 1);

                AddSubview(fifty = new TintedButton()
                {
                    Title = "50%",
                    Font  = UIFont.BoldSystemFontOfSize(20),
                    //BackgroundColor = UIColor.White.ColorWithAlpha(.1f),
//					BorderWidth = 1,
                    Tapped = (b) => {
                        PercentChange(.5f);
                    },
                }, 1, 1, 0, 1);

                AddSubview(dollar = new TintedButton()
                {
                    Title = "$1",
                    Font  = UIFont.BoldSystemFontOfSize(20),
                    //BackgroundColor = UIColor.White.ColorWithAlpha(.1f),
//					BorderWidth = 1,
                    Tapped = (b) => {
                        DollarChanged(Price - 1);
                    },
                }, 2, 1, 0, 1);
            }