public static PlayThread GetInstance() { if (instance == null) { instance = new PlayThread(); } return(instance); }
protected void playButton_Click(object sender, EventArgs e) { PlayThread pt = PlayThread.GetInstance(); pt.SetOwner(this); ThreadStart ts = new ThreadStart(pt.RunPlayThread); Thread playThread = new Thread(ts); playThread.Start(); Thread.Sleep(2000); playThread.Abort(); }