WPF窗口在revit界面前的方法

 UIApplication uiApp = commandData.Application;
            Autodesk.Revit.ApplicationServices.Application app = commandData.Application.ActiveUIDocument.Application.Application;
            Document doc = commandData.Application.ActiveUIDocument.Document;
            OnekeyPlotView dialog = new OnekeyPlotView(doc);
            System.Windows.Interop.WindowInteropHelper mainUI = new System.Windows.Interop.WindowInteropHelper(dialog);
            mainUI.Owner = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
            dialog.ShowDialog();
            return Result.Succeeded;System.Windows.Interop.WindowInteropHelper mainUI = new System.Windows.Interop.WindowInteropHelper(dialog);
            mainUI.Owner = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
            dialog.ShowDialog();
            return Result.Succeeded;

经发现,REVIT2019上运行WPF模态窗口,窗口弹出其他对话框后,主窗口会退出模态界面,直接被REVIT覆盖,上面两行代码能够解决此问题。

你可能感兴趣的:(REVIT二次开发之交互)