Alarm todo task function

    0

    0

    csc530

    The code above will cause the Action object to be executed at the given time.

    using System;
    
    /// Schedule the given action for the given time. From @steve Cherry -- https://stackoverflow.com/questions/1493203/alarm-clock-application-in-net
    public async void ScheduleAction ( Action action , DateTime ExecutionTime )
    {
      try
      {
        await Task.Delay ( ( int ) ExecutionTime.Subtract ( DateTime.Now ).TotalMilliseconds );
        action ( );
      }
      catch ( Exception )
      {
        // Something went wrong
      }
    }
    
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.