I currently have 2 WinForms.
FormA creates an instance of FormB. I call the ShowDialog() method of FormB.
FormB defines public event Action<SomeClass, string> Analyze
When I click the ProcessEvent button of FormB I do the following:
Action<SomeClass, string> tempAction = Analyze;
if (tempAction != null)
{
tempAction.Invoke(instanceOfSomeClass, someString);
}
But the event is not invoked because tempAction is null.
Why would it be null?
I define events in the same way in FormA and they work fine.
EDIT:
I have a presenter class that subscribes to the event:
formBInstance.Analyze += StartAnalyze
you must sign for event. If there is no subsribers Analyze will be null