private static void DoWork(Microsoft.Office.Interop.Excel.Application app, IntPtr hwnd) { DaxStudioWindow win = new DaxStudioWindow(app); // var hwndHelper = new System.Windows.Interop.WindowInteropHelper(win); // hwndHelper.Owner = hwnd; win.Show(); win.Closed += (sender1, e1) => win.Dispatcher.InvokeShutdown(); System.Windows.Threading.Dispatcher.Run(); }