Calculate calc = new Calculate(1); //int count = 1;

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button>(Resource.Id.myButton);

            button.Click += delegate { button.Text = $"{calc.PostAdd(1)} clicks!"; }; // count++

            SharedButton mySharedButton = new SharedButton();

            mySharedButton.Init(0, 100, 200, 20, "My Shared Button", ButtonHandler);
            m_myButton.Click += delegate {
                mySharedButton.Click(m_myButton.GetX(), m_myButton.GetY());
            };
        }
예제 #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Perform any additional setup after loading the view, typically from a nib.
            Button.AccessibilityIdentifier = "myButton";
            Button.TouchUpInside          += delegate
            {
                var title = string.Format("{0} clicks!", calc.PostAdd(1)); //count++);
                Button.SetTitle(title, UIControlState.Normal);
            };

            SharedButton mySharedButton = new SharedButton();

            mySharedButton.Init(0, 100, 200, 20, "My Shared Button", ButtonHandler);
            m_myButton.TouchUpInside += delegate
            {
                mySharedButton.Click((float)m_myButton.Frame.X, (float)m_myButton.Frame.Y);
            };
        }