调整代码

This commit is contained in:
GG Z
2026-02-22 20:03:42 +08:00
parent 2ad3d0fde0
commit 7e2d5be3cd
258 changed files with 2916 additions and 5013 deletions

View File

@@ -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))