添加项目

This commit is contained in:
GG Z
2026-01-01 10:02:59 +08:00
parent 1fd8d2ced7
commit 4df4ce1e6a
105 changed files with 4437 additions and 570 deletions

View File

@@ -15,7 +15,7 @@ using ShrlAlgoToolkit.Core.Assists;
namespace ShrlAlgoToolkit.RevitAddins.Assists;
public static class WinDialogHelper
public static class WinDialogAssist
{
/// <summary>
/// 对话框过滤器
@@ -274,7 +274,22 @@ public static class WinDialogHelper
AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve;
}
public static void ShowDialog<TWindow, TViewModel>(params object[] viewModelParams)
where TWindow : Window, new()
where TViewModel : class
{
var window = new TWindow();
if (viewModelParams.Length == 0)
{
window.DataContext = Activator.CreateInstance(typeof(TViewModel));
}
else
{
window.DataContext = Activator.CreateInstance(typeof(TViewModel), viewModelParams);
}
_ = new WindowInteropHelper(window) { Owner = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle };
window.ShowDialog();
}
private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
StackFrame[] frames = new StackTrace().GetFrames();