I'm trying to develop an application using C# wiforms. I want to execute void sendEmail(){}
function in a class only when internet connection is up. The method that I used is bool checkConnection(){}
function infinitely loops a while loop and sending ping requests to google.com. if the ping is successful, sendEmail(){}
function is called by the checkConnection()
function.
But i know this is not the best practice of doing this. I'm very confusing about custom events in C#. how to use custom events to accomplish this task. expecting an answer with simple explanation.
Thanks in advance