This commit is contained in:
艾竹
2023-03-26 23:23:34 +08:00
parent 90e94a7ec0
commit 43b5d82fae
31 changed files with 1692 additions and 518 deletions

View File

@@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using System.Xml.Linq;
using AIStudio.Wpf.DiagramDesigner;
using AIStudio.Wpf.DiagramDesigner.Geometrys;
using AIStudio.Wpf.Mind.ViewModels;
@@ -569,14 +570,17 @@ namespace AIStudio.Wpf.Mind.Helpers
};
}
public static void ThemeChange(MindNode mindNode, MindThemeModel mindThemeModel)
public static void ThemeChange(MindNode mindNode, MindThemeModel mindThemeModel, bool initAppearance = false)
{
switch (mindNode.NodeLevel)
{
case 0:
{
mindNode.ItemWidth = mindThemeModel.MindThemeLevel1.ItemWidth;
mindNode.ItemHeight = mindThemeModel.MindThemeLevel1.ItemHeight;
if (initAppearance)
{
mindNode.ItemWidth = mindThemeModel.MindThemeLevel1.ItemWidth;
mindNode.ItemHeight = mindThemeModel.MindThemeLevel1.ItemHeight;
}
mindNode.ColorViewModel.FillColor.Color = mindThemeModel.MindThemeLevel1.FillColor;
mindNode.ColorViewModel.LineColor.Color = mindThemeModel.MindThemeLevel1.LineColor;
mindNode.FontViewModel.FontColor = mindThemeModel.MindThemeLevel1.FontColor;
@@ -586,8 +590,11 @@ namespace AIStudio.Wpf.Mind.Helpers
}
case 1:
{
mindNode.ItemWidth = mindThemeModel.MindThemeLevel2.ItemWidth;
mindNode.ItemHeight = mindThemeModel.MindThemeLevel2.ItemHeight;
if (initAppearance)
{
mindNode.ItemWidth = mindThemeModel.MindThemeLevel2.ItemWidth;
mindNode.ItemHeight = mindThemeModel.MindThemeLevel2.ItemHeight;
}
mindNode.ColorViewModel.FillColor.Color = mindThemeModel.MindThemeLevel2.FillColor;
mindNode.ColorViewModel.LineColor.Color = mindThemeModel.MindThemeLevel2.LineColor;
mindNode.FontViewModel.FontColor = mindThemeModel.MindThemeLevel2.FontColor;
@@ -597,8 +604,11 @@ namespace AIStudio.Wpf.Mind.Helpers
}
default:
{
mindNode.ItemWidth = mindThemeModel.MindThemeLevel3.ItemWidth;
mindNode.ItemHeight = mindThemeModel.MindThemeLevel3.ItemHeight;
if (initAppearance)
{
mindNode.ItemWidth = mindThemeModel.MindThemeLevel3.ItemWidth;
mindNode.ItemHeight = mindThemeModel.MindThemeLevel3.ItemHeight;
}
mindNode.ColorViewModel.FillColor.Color = mindThemeModel.MindThemeLevel3.FillColor;
mindNode.ColorViewModel.LineColor.Color = mindThemeModel.MindThemeLevel3.LineColor;
mindNode.FontViewModel.FontColor = mindThemeModel.MindThemeLevel3.FontColor;
@@ -608,6 +618,49 @@ namespace AIStudio.Wpf.Mind.Helpers
}
}
}
public static MindThemeModel GetThemeModel(MindNode mindNode)
{
MindThemeModel mindThemeModel = new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = mindNode.ItemWidth,
ItemHeight = mindNode.ItemHeight,
FillColor = mindNode.ColorViewModel.FillColor.Color,
LineColor = mindNode.ColorViewModel.LineColor.Color,
FontColor = mindNode.FontViewModel.FontColor,
FontSize = mindNode.FontViewModel.FontSize,
Spacing = mindNode.Spacing,
},
};
return mindThemeModel;
}
public static void SetThemeModel(MindNode mindNode, MindThemeModel mindThemeModel)
{
mindNode.ItemWidth = mindThemeModel.MindThemeLevel1.ItemWidth;
mindNode.ItemHeight = mindThemeModel.MindThemeLevel1.ItemHeight;
mindNode.ColorViewModel.FillColor.Color = mindThemeModel.MindThemeLevel1.FillColor;
mindNode.ColorViewModel.LineColor.Color = mindThemeModel.MindThemeLevel1.LineColor;
mindNode.FontViewModel.FontColor = mindThemeModel.MindThemeLevel1.FontColor;
mindNode.FontViewModel.FontSize = mindThemeModel.MindThemeLevel1.FontSize;
mindNode.Spacing = mindThemeModel.MindThemeLevel1.Spacing;
}
public static IColorViewModel GetColorViewModel(MindNode mindNode)
{
ColorViewModel colorViewModel = new ColorViewModel();
CopyHelper.CopyPropertyValue(mindNode.ColorViewModel, colorViewModel);
return colorViewModel;
}
public static IFontViewModel GetFontViewModel(MindNode mindNode)
{
FontViewModel fontViewModel = new FontViewModel();
CopyHelper.CopyPropertyValue(mindNode.FontViewModel, fontViewModel);
return fontViewModel;
}
}
public class MindTheme