C
C#2y ago
Thommy

❔ Event Fired only 2. Time?

I have a small problem. I have a normal event handler that triggers an event. However, he only does this every 2nd time. The event is triggered, works, the next time it is triggered it doesn't work. With the 3rd it works again etc. I thought about resetting the event. Can someone tell me if or how to solve this?
6 Replies
Sossenbinder
Sossenbinder2y ago
Do you have some code to show?
Thommy
ThommyOP2y ago
shure.. mom
SinFluxx
SinFluxx2y ago
don't have to just much harder, if not impossible, for people to help without it 🙂
Thommy
ThommyOP2y ago
Telemetry.JobDelivered += TelemetryJobDelivered; is public event EventHandler JobDelivered; in the Picture is the function and the Code from Telemetry
Thommy
ThommyOP2y ago
if (delivered != sCSTelemetry.SpecialEventsValues.JobDelivered)
{
delivered = sCSTelemetry.SpecialEventsValues.JobDelivered;
if (delivered)
{
if (!flag)
{
this.Data?.Invoke(sCSTelemetry, newTimestamp: true);
flag = true;
}

this.JobDelivered?.Invoke(this, new EventArgs());
}
}
if (delivered != sCSTelemetry.SpecialEventsValues.JobDelivered)
{
delivered = sCSTelemetry.SpecialEventsValues.JobDelivered;
if (delivered)
{
if (!flag)
{
this.Data?.Invoke(sCSTelemetry, newTimestamp: true);
flag = true;
}

this.JobDelivered?.Invoke(this, new EventArgs());
}
}
Events:
Telemetry = new SCSSdkTelemetry();
Telemetry.Data += Telemetry_Data;
Telemetry.JobStarted += TelemetryOnJobStarted;
Telemetry.JobCancelled += TelemetryJobCancelled;
Telemetry.JobDelivered += TelemetryJobDelivered;
Telemetry.Fined += TelemetryFined;
Telemetry.Tollgate += TelemetryTollgate;
Telemetry.Ferry += TelemetryFerry;
Telemetry.Train += TelemetryTrain;
Telemetry.RefuelPayed += TelemetryRefuelPayed;
Telemetry.RefuelEnd += TelemetryRefuelEnd;
Telemetry = new SCSSdkTelemetry();
Telemetry.Data += Telemetry_Data;
Telemetry.JobStarted += TelemetryOnJobStarted;
Telemetry.JobCancelled += TelemetryJobCancelled;
Telemetry.JobDelivered += TelemetryJobDelivered;
Telemetry.Fined += TelemetryFined;
Telemetry.Tollgate += TelemetryTollgate;
Telemetry.Ferry += TelemetryFerry;
Telemetry.Train += TelemetryTrain;
Telemetry.RefuelPayed += TelemetryRefuelPayed;
Telemetry.RefuelEnd += TelemetryRefuelEnd;
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?