大量更新
This commit is contained in:
@@ -5,6 +5,8 @@ using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
|
||||
using Autodesk.Revit.DB;
|
||||
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
using Microsoft.Win32;
|
||||
@@ -124,7 +126,36 @@ public static class WinDialogHelper
|
||||
dialog.SetFilter(title, extensions);
|
||||
return dialog.ShowDialog() == true ? dialog.FileName : null;
|
||||
}
|
||||
public static void UpdateViewDisplay(Autodesk.Revit.UI.PreviewControl _currentPreviewControl, System.Windows.Controls.Grid PreviewContainer, Document _backgroundDoc, View view, ViewDetailLevel detailLevel, DisplayStyle displayStyle)
|
||||
{
|
||||
if (_backgroundDoc == null || view == null) return;
|
||||
|
||||
_backgroundDoc.Invoke(
|
||||
ts =>
|
||||
{
|
||||
try
|
||||
{
|
||||
view.DetailLevel = detailLevel;
|
||||
view.DisplayStyle = displayStyle;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
});
|
||||
|
||||
// 2. 销毁旧控件
|
||||
if (_currentPreviewControl != null)
|
||||
{
|
||||
PreviewContainer.Children.Clear();
|
||||
_currentPreviewControl.Dispose();
|
||||
_currentPreviewControl = null;
|
||||
}
|
||||
|
||||
// 3. 创建新控件并加入 UI
|
||||
_currentPreviewControl = new Autodesk.Revit.UI.PreviewControl(_backgroundDoc, view.Id);
|
||||
PreviewContainer.Children.Add(_currentPreviewControl);
|
||||
}
|
||||
///// <summary>
|
||||
///// 单选文件夹路径
|
||||
///// </summary>
|
||||
|
||||
Reference in New Issue
Block a user