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); //}; }
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(); }; }
public override void ViewDidLoad() { base.ViewDidLoad(); var PizzaCalculatorService = new PizzaCalculatorService(); // Perform any additional setup after loading the view, typically from a nib. CalculateButton.TouchUpInside += delegate { PizzaCountLabel.Text = PizzaCalculatorService.Calculate(PeopleEntry.Text); PeopleEntry.ResignFirstResponder(); }; }
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 PizzaCalculatorService = new PizzaCalculatorService(); calculate.Click += delegate { pizzaCount.Text = PizzaCalculatorService.Calculate(peopleEntry.Text); }; }