private void DetatchWindow()
{
Debug.WriteLine("ChromeWorker detatched");
_resizeGrip = null;
if (_borderWindow != null)
{
var toFoxus = _borderWindow.Owner;
_borderWindow.Owner = null;
_borderWindow.Close();
_borderWindow = null;
// hack to not let owner window move to background for some reason
if (toFoxus != null) { toFoxus.Activate(); }
}
if (_contentWindow != null)
{
_contentWindow.Closed -= _contentWindow_Closed;
_contentWindow.ContentRendered -= _contentWindow_ContentRendered;
_contentWindow.SourceInitialized -= window_SourceInitialized;
_contentWindow = null;
}
}