. Net language APP development platform -- scycler Learning Log: How to quickly implement the Timer timing function, scyclertimer

Source: Internet
Author: User

. Net language APP development platform -- scycler Learning Log: How to quickly implement the Timer timing function, scyclertimer

Smobiler is a development platform that uses the. Net language to develop apps in the VS environment. It may be more convenient than Xamarin.

 

1. Target Style

The following operations are required to achieve the effect:

1. Drag a Timer control, a TextBox Control, a Button control, a label control, and an Image control from the "scycler Components" on the toolbar to the form interface.

2. Tick event of the Timer control
VB:    Private Sub timer1_Tick(sender As Object, e As EventArgs) Handles timer1.Tick       Me.TextBox1.Text = (Convert.ToInt32(Me.textBox1.Text.ToString()) - 1).ToString()   End Sub
C#:   private void timer1_Tick(object sender, EventArgs e)   {       this.textBox1.Text =(Convert.ToInt32(this.textBox1.Text.ToString()) -1).ToString();          }

Note: Call the Timer control

3. TextChanged event of TextBox
VB:   Private Sub textBox1_TextChanged(sender As Object, e As EventArgs) Handles textBox1.TextChanged        If Me.textBox1.Text = "0" Then           timer1.Stop()       Else           timer1.Start()       End If   End Sub
C#:   private void textBox1_TextChanged(object sender, EventArgs e)   {        if(this.textBox1.Text =="0")       {           timer1.Stop();       }       else       {           timer1.Start();       }   }

Note: Determine whether to start or stop the timer based on the conditions.

4. Click events of the Button control
VB:   Private Sub button1_Click(sender As Object, e As EventArgs) Handles button1.Click        Me.textBox1.Text = "60"   End Sub
C#:   private void button1_Click(object sender, EventArgs e)   {        this.textBox1.Text ="60";         }
5. Modify the attribute a. Interval of the Timer control.

Interval for triggering a Tick event, in seconds. The default value is 1, indicating that the interval is 1 second;

Ii. Mobile phone effect display

The following figure shows the effect after the button is pressed:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.