Not sure whether there is anything wrong with this piece of code. this was running fine, but now the MethodInvoker not invoking method.
void meterReader_OnMeterReadSuccessful(MeterData MeterData,List<MeterParameters> DownloadList)
{
if (this.InvokeRequired)
this.Invoke(new MethodInvoker(() =>
{
try
{
this.Cursor = Cursors.WaitCursor;
Task.Factory.StartNew(new Action(() =>
{
if (this.SaveMeterData.AddMeterData(MeterData, DownloadList)) this.OnDownloadSuccessful(this.SaveMeterData.MeterDataID);
else this.OnDataSaveFailed(this.SaveMeterData.MeterDataID);
}));
this.Cursor = Cursors.Default;
this.Close();
}
catch (Exception ex)
{ MessageBox.Show(ex.Message); }
}));
}
}
What could be the possible reason?