示例#1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            System.AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
            {
                System.Console.WriteLine($"unhandled exception {sender}");
            };

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            var peopleEntry            = FindViewById <EditText>(Resource.Id.peopleEntry);
            var calculate              = FindViewById <Button>(Resource.Id.calculateButton);
            var pizzaCount             = FindViewById <TextView>(Resource.Id.pizzaCountLabel);
            var callButton             = FindViewById <Button>(Resource.Id.callButton);
            var phoneDialer            = new PhoneDialer(this);
            var pizzaCalculatorService = new PizzaCalculatorService(phoneDialer);

            calculate.Click += delegate
            {
                pizzaCount.Text = pizzaCalculatorService.Calculate(peopleEntry.Text);
            };
            callButton.Click += delegate
            {
                pizzaCalculatorService.CallPizzaParlor();
            };
        }
示例#2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            var dialer = new PhoneDialer(this);
            var pizzaCalculatorService = new PizzaCalculatorService(dialer);

            // Perform any additional setup after loading the view, typically from a nib.
            CalculateButton.TouchUpInside += delegate
            {
                PizzaCountLabel.Text = pizzaCalculatorService.Calculate(PeopleEntry.Text);
                PeopleEntry.ResignFirstResponder();
            };
            CallButton.TouchUpInside += delegate
            {
                pizzaCalculatorService.CallPizzaParlor();
            };



            ////Original button content
            //Button.AccessibilityIdentifier = "myButton";
            //Button.TouchUpInside += delegate
            //{
            //    var title = string.Format("{0} clicks!", count++);
            //    Button.SetTitle(title, UIControlState.Normal);
            //};
        }
示例#3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            var dialer = new PhoneDialer(this);
            var pizzaCalculatorService = new PizzaCalculatorService(dialer);

            // Perform any additional setup after loading the view, typically from a nib.
            CalculateButton.TouchUpInside += delegate
            {
                PizzaCountLabel.Text = pizzaCalculatorService.Calculate(PeopleEntry.Text);
                PeopleEntry.ResignFirstResponder();
            };
            CallButton.TouchUpInside += delegate
            {
                pizzaCalculatorService.CallPizzaParlor();
            };
        }
示例#4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            var peopleEntry            = FindViewById <EditText>(Resource.Id.peopleEntry);
            var calculate              = FindViewById <Button>(Resource.Id.calculateButton);
            var pizzaCount             = FindViewById <TextView>(Resource.Id.pizzaCountLabel);
            var callButton             = FindViewById <Button>(Resource.Id.callButton);
            var phoneDialer            = new PhoneDialer(this);
            var pizzaCalculatorService = new PizzaCalculatorService(phoneDialer);

            calculate.Click += delegate
            {
                pizzaCount.Text = pizzaCalculatorService.Calculate(peopleEntry.Text);
            };

            callButton.Click += delegate
            {
                pizzaCalculatorService.CallPizzaParlor();
            };
        }