protected virtual void OnIsBusyChanged( DependencyPropertyChangedEventArgs e )
{
if( IsBusy )
{
if( DisplayAfter.Equals( TimeSpan.Zero ) )
{
// Go visible now
IsContentVisible = true;
}
else
{
// Set a timer to go visible
_displayAfterTimer.Interval = DisplayAfter;
_displayAfterTimer.Start();
}
}
else
{
// No longer visible
_displayAfterTimer.Stop();
IsContentVisible = false;
if( this.FocusAfterBusy != null )
{
this.FocusAfterBusy.Dispatcher.BeginInvoke( DispatcherPriority.Input, new Action( () =>
{
this.FocusAfterBusy.Focus();
this.FocusAfterBusy = null;
}
) );
}
}
ChangeVisualState( true );
}