Ejemplo n.º 1
0
        /// <summary>
        ///		Invoked when the activity is first created.
        /// </summary>
        /// <param name="bundle">Saved instance state</param>
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            counter = new TrialCounter();

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

            // Sets button's click event.
            var button = FindViewById <Button>(Resource.Id.myButton);

            button.Click += (sender, e) => {
                counter.CountUp();
                button.Text = $"{counter.Count} times tapped.";
            };
        }
Ejemplo n.º 2
0
        /// <summary>
        ///		Invoked when the activity is first created.
        /// </summary>
        /// <param name="bundle">Saved instance state</param>
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            counter = new TrialCounter();

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

            SetAmbientEnabled();

            // Sets button's click event.
            var textView    = FindViewById <TextView>(Resource.Id.myTextView);
            var imageButton = FindViewById <ImageButton>(Resource.Id.myImageButton);

            imageButton.Click += (sender, e) => {
                counter.CountUp();
                textView.Text = $"{counter.Count} times tapped.";
            };
        }