Skip to content

Commit

Permalink
🐛 tabItems
Browse files Browse the repository at this point in the history
  • Loading branch information
AigioL committed Mar 16, 2024
1 parent 28f9dde commit 8a091ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ internal bool SetStartDefaultPageName()
if (NavigationService.Instance.CurrnetPage != null)
return false;

var mw2 = IViewModelManager.Instance.MainWindow2;
if (mw2 == null)
return false;

Type? pageType = null;
if (!string.IsNullOrEmpty(UISettings.StartDefaultPageName.Value))
{
var tabItems = IViewModelManager.Instance.MainWindow2?.TabItems;
var tabItems = mw2?.TabItems;
if (tabItems == null)
return false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ namespace BD.WTTS.Services.Implementation;
internal sealed class ViewModelManager : ReactiveObject, IViewModelManager
{
bool disposedValue;
Dictionary<Type, byte[]> viewModelDataCaches = new();
Dictionary<Type, ViewModelBase> viewModelCaches = new();
ConcurrentDictionary<Type, byte[]> viewModelDataCaches = new();
ConcurrentDictionary<Type, ViewModelBase> viewModelCaches = new();

/// <summary>
/// 获取为当前主窗口提供的数据
Expand Down Expand Up @@ -69,7 +69,8 @@ public void Dispose(ViewModelBase viewModel)
var vmType = viewModel.GetType();
var value = Serializable.SMP2(vmType, viewModel);
viewModelDataCaches[vmType] = value;
viewModelCaches.Remove(vmType);
viewModelDataCaches[vmType] = value;
viewModelCaches.TryRemove(vmType, out var _);
}

void Dispose(bool disposing)
Expand Down

0 comments on commit 8a091ce

Please sign in to comment.