自分のクラスを開始したいのですが、機能していないようです。
私のクラスは:
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 も発生しません。このクラスを今すぐ実行するにはどうすればよいですか?