mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-16 22:46:36 +08:00
序列化bug修复,近期主要修复bug为主
This commit is contained in:
@@ -24,7 +24,10 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _mindType, value);
|
||||
if (!SetProperty(ref _mindType, value))
|
||||
{
|
||||
RaisePropertyChanged(nameof(MindType));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +40,10 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _mindTheme, value);
|
||||
if (!SetProperty(ref _mindTheme, value))
|
||||
{
|
||||
RaisePropertyChanged(nameof(MindTheme));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,15 +371,18 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
public override void Init(bool initNew)
|
||||
{
|
||||
if (Items.Count == 0)
|
||||
if (initNew)
|
||||
{
|
||||
AddRootItem();
|
||||
if (Items.Count == 0)
|
||||
{
|
||||
AddRootItem();
|
||||
}
|
||||
}
|
||||
ResetChildren(RootItems);
|
||||
RootItems?.ForEach(p => p.UpdatedLayout());
|
||||
base.Init();
|
||||
base.Init(initNew);
|
||||
}
|
||||
|
||||
private MindNode AddRootItem()
|
||||
@@ -437,11 +446,13 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
#endregion
|
||||
|
||||
#region 属性改变
|
||||
private bool isSelecting;
|
||||
protected override void Item_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
{
|
||||
base.Item_PropertyChanged(sender, e);
|
||||
if (e.PropertyName == "IsSelected")
|
||||
{
|
||||
isSelecting = true;
|
||||
if (e is ValuePropertyChangedEventArgs valuePropertyChangedEventArgs)
|
||||
{
|
||||
LinkInfo = new LinkInfo(MindSelectedItem?.LinkInfo);
|
||||
@@ -453,6 +464,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
MindTheme = MindSelectedItem.MindTheme;
|
||||
}
|
||||
}
|
||||
isSelecting = false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -1077,6 +1089,8 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
#region 改变模式,主题
|
||||
private void ExecutedChangeMindTypeCommand(object obj)
|
||||
{
|
||||
if (isSelecting) return;
|
||||
|
||||
var oldMindType = MindType;
|
||||
if (obj is MindType mindType && mindType != oldMindType)
|
||||
{
|
||||
@@ -1103,6 +1117,8 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
|
||||
private void ExecutedChangeMindThemeCommand(object obj)
|
||||
{
|
||||
if (isSelecting) return;
|
||||
|
||||
var oldmindTheme = MindTheme;
|
||||
if (obj is MindTheme mindTheme && mindTheme != oldmindTheme)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user