protected virtual void OnWindowGotFocus( object sender, EventArgs e )
{
if( Dispatcher.CurrentDispatcher != Application.Current.Dispatcher ) throw new InvalidOperationException( "This method should only be called by the Application Thread. Call OnWindowGotFocus to make sure the correct thread carries on." );
IWindowElement windowElement = sender as IWindowElement;
if( windowElement != null )
{
WindowElementData data = null;
if( _dic.TryGetValue( windowElement, out data ) )
{
_lastFocused = windowElement;
if( WindowGotFocus != null )
WindowGotFocus( sender, new WindowElementEventArgs( windowElement ) );
}
}
}