private void UpdateVisualStates(bool useTransitions)
{
string stateName;
if (IsOpen)
{
if (null != _openingStoryboard)
{
_openingStoryboardPlaying = true;
_openingStoryboardReleaseThreshold = DateTime.UtcNow.AddSeconds(0.3);
}
if (_rootVisual != null && _rootVisual.Orientation.IsPortrait())
{
if (_outerPanel != null)
{
_outerPanel.Orientation = Orientation.Vertical;
}
stateName = _reversed ? OpenReversedVisibilityStateName : OpenVisibilityStateName;
}
else
{
if (_outerPanel != null)
{
_outerPanel.Orientation = Orientation.Horizontal;
}
stateName = _reversed ? OpenLandscapeReversedVisibilityStateName : OpenLandscapeVisibilityStateName;
}
if (null != _backgroundResizeStoryboard)
{
_backgroundResizeStoryboard.Begin();
}
}
else
{
stateName = ClosedVisibilityStateName;
}
VisualStateManager.GoToState(this, stateName, useTransitions);
}