protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); // 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 btnStart = FindViewById<Button> (Resource.Id.btnStart); Button btnStop = FindViewById<Button> (Resource.Id.btnStop); Button btnReset = FindViewById<Button> (Resource.Id.btnReset); TextView lblDisplay = FindViewById<TextView> (Resource.Id.lblDisplay); btnStart.Enabled = true; btnStop.Enabled = false; btnStart.Click += delegate { btnStart.Enabled = false; btnStop.Enabled = true; timer.Start(); }; btnStop.Click += delegate { btnStart.Enabled = true; btnStop.Enabled = false; timer.Stop(); lblDisplay.Text = MyTimerLogic.GetCurrentTickCount(); }; btnReset.Click += delegate { MyTimerLogic.SetTickElapsed(); lblDisplay.Text = MyTimerLogic.GetCurrentTickCount(); }; timer.Elapsed += delegate { MyTimerLogic.SetTickElapsed(); RunOnUiThread(delegate { lblDisplay.Text = MyTimerLogic.GetCurrentTickCount(); }); } }; }
public void timer_tick() { MyTimer.SetTickElapsed(); lblDisplay.Text = MyTimer.GetCurrentTickCount(); }
public void timer_tick() { //Do stuff here MyTimerLogic.SetTickElapsed(); lblDisplay.Text = MyTimerLogic.GetCurrentTickCount(); }