public bool IsEnabled()
 {
     if (m_controllerState != null)
     {
         return(m_controllerState.IsActive());
     }
     return(false);
 }
Example #2
0
    // Use a cancellation token or m_controllerState.IsEnabled
    protected async void LoopAction(CancellationToken token)
    {
        int delay;

        while (m_controllerState.IsActive() && !token.IsCancellationRequested)
        {
            if (CanUseAction(m_manager, m_controllerState))
            {
                delay = UseAction(m_manager, m_controllerState);
            }
            else
            {
                delay = DelayAction(m_manager, m_controllerState);
            }
            await Task.Delay(delay);
        }
    }