public virtual void SetShelvingState(
ISystemContext context,
bool shelved,
bool oneShot,
double shelvingTime)
{
if (this.ShelvingState == null)
{
return;
}
if (m_unshelveTimer != null)
{
m_unshelveTimer.Dispose();
m_unshelveTimer = null;
}
if (!shelved)
{
if (this.SuppressedState == null || !this.SuppressedState.Id.Value)
{
SuppressedOrShelved.Value = false;
}
this.ShelvingState.CauseProcessingCompleted(context, Methods.ShelvedStateMachineType_Unshelve);
}
else
{
SuppressedOrShelved.Value = true;
m_oneShot = oneShot;
m_unshelveTime = DateTime.MinValue;
if (oneShot)
{
this.ShelvingState.CauseProcessingCompleted(context, Methods.ShelvedStateMachineType_OneShotShelve);
}
else
{
if (shelvingTime > 0)
{
m_unshelveTime = DateTime.UtcNow.AddMilliseconds(shelvingTime);
m_unshelveTimer = new Timer(OnTimerExpired, context, (int)shelvingTime, Timeout.Infinite);
}
this.ShelvingState.CauseProcessingCompleted(context, Methods.ShelvedStateMachineType_TimedShelve);
}
}
UpdateEffectiveState(context);
}
#endregion