0
일부 데이터를 얻기 위해 스레드를 시작하는 C# 폼 응용 프로그램을 실행 중입니다. 이 스레드는 내부에 이벤트가 있습니다. 즉, 이벤트가 스레드에서 실행되고 동일한 스레드에 의해 캡처되어야합니다. 그러나 스레드의 이벤트가 발생하지 않는 것 같습니다. 모든 단서?백그라운드에서 실행 된 이벤트가 무시 됨
void PointCreated(object sender, IdEventArgs e) // a certain event that should fire and it doesn't
{
Console.WriteLine("Event Fired!");
}
public void onlinerun()
{
Console.WriteLine("run started"); // this is printed on console
while (true)
{
do_some_work();
//this work could result in the PointCreated event firing
}
}
WinForm 응용 프로그램에는 콘솔이 없습니다. 대신 Debug.WriteLine을 사용하여 VS2010 출력 창으로 이동하십시오. –
실제로 이벤트 이외의 것을 인쇄하고 있는데, 프로젝트 유형을 콘솔 응용 프로그램으로 선택했지만, 프로그램에서 나는 STAThread에 창을 실행했습니다. –
어떻게 이벤트를 실행하고 있습니까? –