I have a C# console application. I want to execute a function every minute, for up to 1 hour. The function returns a bool value. If the function returns true, the timer should stop else it should keep executing every minute, for up to 1 hour. Below is my code I have written so far.
static void Main(string[] args)
{
    var timer = new System.Timers.Timer(60000);
    timer.Elapsed += new 
    System.Timers.ElapsedEventHandler(CheckEndProcessStatus);
    //if timer timed out, stop executing the function
}
private void CheckEndProcessStatus(object source, ElapsedEventArgs args)
{
    try
    {
        if (CheckFunction())
        {
            //stop timer
        }
    }
    catch(Exception ex)
    {
        throw;
    }
}
private bool CheckFunction()
{
    bool check = false;
    try
    {
        //some logic to set 'check' to true or false
    }
    catch (Exception ex)
    {
        throw;
    }
    return check;
}
I think I need some guidance on this to implement this. Please let me know if I can provide more details on this.