private void UnSubscribeFromEvents()
{
if (Application.Current != null)
Application.Current.Exit -= new ExitEventHandler(Application_Exit);
if (this.FloatingWindowHost != null)
{
this.FloatingWindowHost.SizeChanged -= new SizeChangedEventHandler(Host_SizeChanged);
this.FloatingWindowHost.ActiveWindowChanged -= new EventHandler<ActiveWindowChangedEventArgs>(ActiveWindowChanged);
}
this.RemoveHandler(UIElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(FloatingWindow_MouseLeftButtonDown));
}