Created
December 29, 2017 04:56
-
-
Save longtth/0e2ac508adea4fa379a03f5eef02711b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
namespace TagGocNhin | |
{ | |
enum State | |
{ | |
Stop, Playing, Paused | |
} | |
public partial class TagGocNhin : Form | |
{ | |
State s; | |
public TagGocNhin() | |
{ | |
InitializeComponent(); | |
} | |
private void btnPlay_Click(object sender, EventArgs e) | |
{ | |
if (s == State.Stop) | |
{ | |
s = State.Playing; | |
btnPlay.Text = "Playing"; | |
} | |
if (s == State.Playing) | |
{ | |
s = State.Paused; | |
btnPlay.Text = "Click to play.."; | |
} | |
MessageBox.Show(s.ToString()); | |
} | |
private void TagGocNhin_KeyPress(object sender, KeyPressEventArgs e) | |
{ | |
if (e.Handled && e.KeyChar == (char)Keys.Space ) | |
{ | |
btnPlay.PerformClick(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment