Skip to content

Instantly share code, notes, and snippets.

@longtth
Created December 29, 2017 04:56
Show Gist options
  • Save longtth/0e2ac508adea4fa379a03f5eef02711b to your computer and use it in GitHub Desktop.
Save longtth/0e2ac508adea4fa379a03f5eef02711b to your computer and use it in GitHub Desktop.
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