hey guys I get this exception when my application closes. CustomerReadySub is an event that I have subscribed to.
The error happens on this line
fTypeLabel.Invoke(new MethodInvoker(fuelTypeChosen));
public void CustomerReadySub(object sender, CustomerReadyEventArgs fuel)
{
// code to handle the event
string CustReady = null;
//checks what fuel is chosen and then activates the pump
fuelType = fuel.SelectedFuel.ToString();
if (!String.IsNullOrEmpty(fuelType))
{
fTypeLabel.Invoke(new MethodInvoker(fuelTypeChosen));
if (fuelType == "Unleaded") //checks fuel type and displays price accordingly
{
pplText.Invoke(new MethodInvoker(petrol));
}
else
{
pplText.Invoke(new MethodInvoker(diesel));
}
CustReady = "READY";
WCFPump.sendReady(CustReady);
}
while (WCFPump.getOK() == 0) { /*do nothing*/} //used to loop around until OK is retrieved
if (pumpID == WCFPump.getOK())
{
CustGen.ActivatePump();
}
}
private void fuelTypeChosen()
{
fTypeLabel.Text = fuelType;
}
I am not really sure what is causing the problem.