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

@@ -26,7 +26,7 @@ namespace AIStudio.Wpf.Mind.Helpers
{
if (initAppearance)
{
MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
MindThemeHelper.ThemeChange(mindNode, mindThemeModel, initAppearance);
mindNode.ClearConnectors();
var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.5, YRatio = 1 };
@@ -42,7 +42,7 @@ namespace AIStudio.Wpf.Mind.Helpers
{
if (initAppearance)
{
MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
MindThemeHelper.ThemeChange(mindNode, mindThemeModel, initAppearance);
mindNode.ClearConnectors();
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Top, true) { XRatio = 0.5, YRatio = 0 };
@@ -59,7 +59,7 @@ namespace AIStudio.Wpf.Mind.Helpers
{
if (initAppearance)
{
MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
MindThemeHelper.ThemeChange(mindNode, mindThemeModel, initAppearance);
mindNode.ClearConnectors();
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
@@ -80,6 +80,9 @@ namespace AIStudio.Wpf.Mind.Helpers
public ConnectionViewModel GetOrSetConnectionViewModel(MindNode source, MindNode sink, ConnectionViewModel connector = null)
{
if (source == null || sink == null)
return null;
if (connector == null)
{
connector = new ConnectionViewModel(source.Root, source.FirstConnector, sink.FirstConnector, DrawMode.ConnectingLineStraight, RouterMode.RouterOrthogonal);

View File

@@ -30,7 +30,7 @@ namespace AIStudio.Wpf.Mind.Helpers
{
if (initAppearance)
{
MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
MindThemeHelper.ThemeChange(mindNode, mindThemeModel, initAppearance);
mindNode.ClearConnectors();
var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 0.5 };
@@ -45,7 +45,7 @@ namespace AIStudio.Wpf.Mind.Helpers
{
if (initAppearance)
{
MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
MindThemeHelper.ThemeChange(mindNode, mindThemeModel, initAppearance);
mindNode.ClearConnectors();
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.BottomLeft, true) { XRatio = 0, YRatio = 1 };
@@ -63,7 +63,7 @@ namespace AIStudio.Wpf.Mind.Helpers
{
if (initAppearance)
{
MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
MindThemeHelper.ThemeChange(mindNode, mindThemeModel, initAppearance);
mindNode.ClearConnectors();
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
@@ -88,6 +88,9 @@ namespace AIStudio.Wpf.Mind.Helpers
public ConnectionViewModel GetOrSetConnectionViewModel(MindNode source, MindNode sink, ConnectionViewModel connector = null)
{
if (source == null || sink == null)
return null;
DrawMode drawMode;
RouterMode routerMode;
if (source.NodeLevel == 0)

View File

@@ -26,7 +26,7 @@ namespace AIStudio.Wpf.Mind.Helpers
{
if (initAppearance)
{
MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
MindThemeHelper.ThemeChange(mindNode, mindThemeModel, initAppearance);
mindNode.ClearConnectors();
var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.None, true) { XRatio = 0.5, YRatio = 0.5 };
@@ -41,7 +41,7 @@ namespace AIStudio.Wpf.Mind.Helpers
{
if (initAppearance)
{
MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
MindThemeHelper.ThemeChange(mindNode, mindThemeModel, initAppearance);
mindNode.ClearConnectors();
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
@@ -58,7 +58,7 @@ namespace AIStudio.Wpf.Mind.Helpers
{
if (initAppearance)
{
MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
MindThemeHelper.ThemeChange(mindNode, mindThemeModel, initAppearance);
mindNode.ClearConnectors();
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 1 };
@@ -78,6 +78,9 @@ namespace AIStudio.Wpf.Mind.Helpers
}
public ConnectionViewModel GetOrSetConnectionViewModel(MindNode source, MindNode sink, ConnectionViewModel connector = null)
{
if (source == null || sink == null)
return null;
if (connector == null)
{
connector = new ConnectionViewModel(source.Root, source.FirstConnector, sink.FirstConnector, DrawMode.ConnectingLineSmooth, RouterMode.RouterNormal);

View File

@@ -26,7 +26,7 @@ namespace AIStudio.Wpf.Mind.Helpers
{
if (initAppearance)
{
MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
MindThemeHelper.ThemeChange(mindNode, mindThemeModel, initAppearance);
mindNode.ClearConnectors();
var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.None, true) { XRatio = 0.5, YRatio = 0.5 };
@@ -41,7 +41,7 @@ namespace AIStudio.Wpf.Mind.Helpers
{
if (initAppearance)
{
MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
MindThemeHelper.ThemeChange(mindNode, mindThemeModel, initAppearance);
mindNode.ClearConnectors();
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
@@ -58,7 +58,7 @@ namespace AIStudio.Wpf.Mind.Helpers
{
if (initAppearance)
{
MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
MindThemeHelper.ThemeChange(mindNode, mindThemeModel, initAppearance);
mindNode.ClearConnectors();
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 1 };
@@ -79,6 +79,9 @@ namespace AIStudio.Wpf.Mind.Helpers
public ConnectionViewModel GetOrSetConnectionViewModel(MindNode source, MindNode sink, ConnectionViewModel connector = null)
{
if (source == null || sink == null)
return null;
if (connector == null)
{
connector = new ConnectionViewModel(source.Root, source.FirstConnector, sink.FirstConnector, DrawMode.ConnectingLineSmooth, RouterMode.RouterNormal);

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

View File

@@ -26,7 +26,7 @@ namespace AIStudio.Wpf.Mind.Helpers
{
if (initAppearance)
{
MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
MindThemeHelper.ThemeChange(mindNode, mindThemeModel, initAppearance);
mindNode.ClearConnectors();
var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.5, YRatio = 1 };
@@ -41,7 +41,7 @@ namespace AIStudio.Wpf.Mind.Helpers
{
if (initAppearance)
{
MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
MindThemeHelper.ThemeChange(mindNode, mindThemeModel, initAppearance);
mindNode.ClearConnectors();
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Top, true) { XRatio = 0.5, YRatio = 0 };
@@ -59,7 +59,7 @@ namespace AIStudio.Wpf.Mind.Helpers
{
if (initAppearance)
{
MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
MindThemeHelper.ThemeChange(mindNode, mindThemeModel, initAppearance);
mindNode.ClearConnectors();
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Top, true) { XRatio = 0.5, YRatio = 0 };
@@ -80,6 +80,9 @@ namespace AIStudio.Wpf.Mind.Helpers
public ConnectionViewModel GetOrSetConnectionViewModel(MindNode source, MindNode sink, ConnectionViewModel connector = null)
{
if (source == null || sink == null)
return null;
if (connector == null)
{
connector = new ConnectionViewModel(source.Root, source.FirstConnector, sink.FirstConnector, DrawMode.ConnectingLineStraight, RouterMode.RouterOrthogonal);