void OnWindowMoved( object sender, WindowElementLocationEventArgs e )
{
Debug.Assert( Dispatcher.CurrentDispatcher == Application.Current.Dispatcher, "This method should only be called by the Application Thread." );
//avoids bind during a resize
if( !_resizeMoveLock && !_pointerDownLock )
{
if( _tester.CanTest )
{
ISpatialBinding binding = WindowBinder.GetBinding( e.Window );
IDictionary<IWindowElement, Rect> rect = WindowManager.WindowElements.ToDictionary( x => x, y => WindowManager.GetClientArea( y ) );
IBinding result = _tester.Test( binding, rect, AttractionRadius );
if( result != null )
{
_bindResult = WindowBinder.PreviewBind( result.Target, result.Origin, result.Position );
}
else
{
if( _tester.LastResult != null )
{
WindowBinder.PreviewUnbind( _tester.LastResult.Target, _tester.LastResult.Origin );
_bindResult = null;
}
}
}
}
_resizeMoveLock = false;
}