N
Norbert
Hi
I have an App with two threads, one for the GUI and one for network
communications.
No I have code like that:
private void Server_ServerStoppedMeasurement(object sender, int
timestamp, double drivabilityResult)
{
// workaround because InvokeRequired isn't supportet by the
..net CF
if (this != sender)
{
this.BeginInvoke(new
MesStoppedByServerNotify(Server_ServerStoppedMeasurementHandler),
this,timestamp, drivabilityResult);
}
}
private void Server_ServerStoppedMeasurementHandler(object
sender, int timestamp, double Result)
{
Form_Result form_result = new Form_Result();
form_result.DriveScore = Result;
form_result.Duration = timestamp;
form_result.ShowDialog();
form_result.Close();
this.button_startstop.MainText =
Properties.Resources.StartStop_Start;
}
This handler gets called, whenever the UDP Server gets a
ServerStoppedMeasurement message.
So far so good, my problem is, that sometimes i get 2 ServerStopp
messages
-> so it happens that the result screen is shown 2 times!!!!
How does BeginInvoke work? I thougt this is more like a PostMessage in
the old MFC Times? why can 2 methodes be called in only one thread?
Norbert
I have an App with two threads, one for the GUI and one for network
communications.
No I have code like that:
private void Server_ServerStoppedMeasurement(object sender, int
timestamp, double drivabilityResult)
{
// workaround because InvokeRequired isn't supportet by the
..net CF
if (this != sender)
{
this.BeginInvoke(new
MesStoppedByServerNotify(Server_ServerStoppedMeasurementHandler),
this,timestamp, drivabilityResult);
}
}
private void Server_ServerStoppedMeasurementHandler(object
sender, int timestamp, double Result)
{
Form_Result form_result = new Form_Result();
form_result.DriveScore = Result;
form_result.Duration = timestamp;
form_result.ShowDialog();
form_result.Close();
this.button_startstop.MainText =
Properties.Resources.StartStop_Start;
}
This handler gets called, whenever the UDP Server gets a
ServerStoppedMeasurement message.
So far so good, my problem is, that sometimes i get 2 ServerStopp
messages
-> so it happens that the result screen is shown 2 times!!!!
How does BeginInvoke work? I thougt this is more like a PostMessage in
the old MFC Times? why can 2 methodes be called in only one thread?
Norbert