using System;
using System.Threading.Tasks;
namespace MediaBrowser.Common.ScheduledTasks
{
    /// 
    /// Class StartupTaskTrigger
    /// 
    public class StartupTrigger : ITaskTrigger
    {
        /// 
        /// Stars waiting for the trigger action
        /// 
        /// if set to true [is application startup].
        public async void Start(bool isApplicationStartup)
        {
            if (isApplicationStartup)
            {
                await Task.Delay(3000).ConfigureAwait(false);
                OnTriggered();
            }
        }
        /// 
        /// Stops waiting for the trigger action
        /// 
        public void Stop()
        {
        }
        /// 
        /// Occurs when [triggered].
        /// 
        public event EventHandler Triggered;
        /// 
        /// Called when [triggered].
        /// 
        private void OnTriggered()
        {
            if (Triggered != null)
            {
                Triggered(this, EventArgs.Empty);
            }
        }
    }
}