public virtual void Unregister( IWindowElement windowElement )
{
if( Dispatcher.CurrentDispatcher != Application.Current.Dispatcher ) throw new InvalidOperationException( "This method should only be called by the Application Thread." );
if( windowElement == null )
throw new InvalidOperationException( "The window element holder must hold a valid, non null reference to a window element." );
WindowElementData data = null;
if( _dic.TryGetValue( windowElement, out data ) )
{
data.Window.GotFocus -= OnWindowGotFocusInternal;
data.Window.Minimized -= OnWindowMinimizedInternal;
data.Window.Restored -= OnWindowRestoredInternal;
data.Window.LocationChanged -= OnWindowLocationChangedInternal;
data.Window.SizeChanged -= OnWindowSizeChangedInternal;
_dic.Remove( windowElement );
if( Unregistered != null )
Unregistered( this, new WindowElementEventArgs( windowElement ) );
}
}