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; } }
private void AttachWindow(Window window) { Debug.WriteLine("ChromeWorker attached."); _contentWindow = window; _borderWindow = new LegacyBorderWindow(window); _contentWindow.Closed += _contentWindow_Closed; _contentWindow.ContentRendered += _contentWindow_ContentRendered; var hwnd = new WindowInteropHelper(_contentWindow).Handle; if (hwnd == IntPtr.Zero) { _contentWindow.SourceInitialized += window_SourceInitialized; } else { InitReal(hwnd); } }