C
C#16mo 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
Sossenbinder16mo ago
Do you have some code to show?
Thommy
ThommyOP16mo ago
shure.. mom
SinFluxx
SinFluxx16mo ago
don't have to just much harder, if not impossible, for people to help without it 🙂
Thommy
ThommyOP16mo ago
Telemetry.JobDelivered += TelemetryJobDelivered; is public event EventHandler JobDelivered; in the Picture is the function and the Code from Telemetry
Thommy
ThommyOP16mo 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
Accord16mo 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.
Want results from more Discord servers?
Add your server