调整代码
This commit is contained in:
@@ -74,7 +74,7 @@ public static class WinDialogAssist
|
||||
/// 打开或在现有目录并选中相应文件
|
||||
/// </summary>
|
||||
/// <param name="fileFullName"></param>
|
||||
static public void OpenFolderAndSelectFile(string fileFullName)
|
||||
public static void OpenFolderAndSelectFile(string fileFullName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(fileFullName))
|
||||
throw new ArgumentNullException(nameof(fileFullName));
|
||||
@@ -201,17 +201,17 @@ public static class WinDialogAssist
|
||||
AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve;
|
||||
}
|
||||
|
||||
private static Dictionary<Type, Window> _windows = [];
|
||||
public static void ShowOrActivate<TWindow, TViewModel>(params object[] viewModelParams)
|
||||
where TWindow : Window, new()
|
||||
private static readonly Dictionary<Type, Window> _windows = [];
|
||||
public static void ShowOrActivate<TView, TViewModel>(params object[] viewModelParams)
|
||||
where TView : Window,new()
|
||||
where TViewModel : class
|
||||
{
|
||||
var windowType = typeof(TWindow);
|
||||
var windowType = typeof(TView);
|
||||
if (!_windows.ContainsKey(windowType) || _windows[windowType] == null)
|
||||
{
|
||||
//CloseAllWindowsExcept(windowType);
|
||||
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
|
||||
_windows[windowType] = new TWindow();
|
||||
_windows[windowType] = new TView();
|
||||
_windows[windowType].Closed += WindowClosed;
|
||||
_windows[windowType].Closed += (_, _) => _windows[windowType] = null;
|
||||
if (_windows[windowType].DataContext == null || !(_windows[windowType].DataContext is TViewModel))
|
||||
|
||||
Reference in New Issue
Block a user