添加项目
This commit is contained in:
@@ -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();
|
||||
Reference in New Issue
Block a user