我希望我自己的课程开始,但它似乎不起作用。
我的班级是:
namespace Ts3_Movearound
{
class TS3_Connector
{
public class ccmove : EventArgs
{
public ccmove(int clid, int cid)
{
this.clid = clid;
this.cid = cid;
}
public int clid;
public int cid;
}
public event EventHandler runningHandle;
public event EventHandler stoppedHandle;
public event EventHandler RequestMove;
bool running = true;
public Main()
{
using (QueryRunner queryRunner = new QueryRunner(new SyncTcpDispatcher("127.0.0.1", 25639))) // host and port
{
this.runningHandle(this, new EventArgs());
while (running == true)
{
this.RequestMove(this, new EventArgs());
System.Threading.Thread.Sleep(1000);
}
this.stoppedHandle(this, new EventArgs());
}
Console.ReadLine();
}
}
}
我这样称呼它:
private void button1_Click(object sender, EventArgs e)
{
TS3_Connector conn = new TS3_Connector();
conn.runningHandle += new EventHandler(started);
conn.stoppedHandle += new EventHandler(stopped);
}
但似乎班级永远不会正确开始。runningEvent 永远不会被触发,stopped 和 Request 也是如此。我现在如何运行这个课程?