Files
aistudio-wpf-diagram/Extensions/AIStudio.Wpf.Mind/Helpers/MindThemeHelper.cs

705 lines
26 KiB
C#
Raw Normal View History

2023-03-11 22:27:23 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
2023-03-12 23:26:22 +08:00
using System.Xml.Linq;
2023-03-26 23:23:34 +08:00
using AIStudio.Wpf.DiagramDesigner;
2023-03-11 22:27:23 +08:00
using AIStudio.Wpf.DiagramDesigner.Geometrys;
2023-04-02 12:01:46 +08:00
using AIStudio.Wpf.Mind.Models;
2023-03-11 22:27:23 +08:00
using AIStudio.Wpf.Mind.ViewModels;
namespace AIStudio.Wpf.Mind.Helpers
{
public static class MindThemeHelper
{
2023-04-02 12:01:46 +08:00
static MindThemeHelper()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
MindThemeDictionary = new List<MindThemeModel>()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
SkyBlueTheme,
SkyBlueMiniTheme,
LiteratureGreenTheme,
LiteratureGreenMiniTheme,
BrainDeadPinkTheme,
BrainDeadPinkMiniTheme,
RomanticPurpleTheme,
RomanticPurpleMiniTheme,
FreshRedTheme,
FreshRedMiniTheme,
EarthyYellowTheme,
EarthyYellowMiniTheme,
CoolLightYellowTheme,
CoolLightYellowMiniTheme
2023-03-11 22:27:23 +08:00
};
}
2023-04-02 12:01:46 +08:00
public static MindThemeModel GetTheme(MindTheme theme)
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
return MindThemeDictionary.FirstOrDefault(p => p.Theme == theme) ?? SkyBlueTheme;
2023-03-11 22:27:23 +08:00
}
2023-04-02 12:01:46 +08:00
public static readonly List<MindThemeModel> MindThemeDictionary;
public static MindThemeModel SkyBlueTheme = new MindThemeModel()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
Theme = MindTheme.SkyBlue,
MindThemeLevel0 = new MindThemeModelItem()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
ItemWidth = 120,
ItemHeight = 40,
FillColor = Color.FromRgb(0x73, 0xa1, 0xbf),
LineColor = Color.FromRgb(0x73, 0xa1, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel1 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Color.FromRgb(0xee, 0xf3, 0xf6),
LineColor = Color.FromRgb(0x73, 0xa1, 0xbf),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel2 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Colors.Transparent,
LineColor = Color.FromRgb(0x73, 0xa1, 0xbf),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
public static MindThemeModel SkyBlueMiniTheme= new MindThemeModel()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
Theme = MindTheme.SkyBlueMini,
MindThemeLevel0 = new MindThemeModelItem()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
ItemWidth = 120,
ItemHeight = 40,
FillColor = Color.FromRgb(0x73, 0xa1, 0xbf),
LineColor = Color.FromRgb(0x73, 0xa1, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(10, 10),
},
MindThemeLevel1 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Color.FromRgb(0xee, 0xf3, 0xf6),
LineColor = Color.FromRgb(0x73, 0xa1, 0xbf),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(10, 10),
},
MindThemeLevel2 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Colors.Transparent,
LineColor = Color.FromRgb(0x73, 0xa1, 0xbf),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(10, 10),
}
};
public static MindThemeModel LiteratureGreenTheme = new MindThemeModel()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
Theme = MindTheme.LiteratureGreen,
MindThemeLevel0 = new MindThemeModelItem()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
ItemWidth = 120,
ItemHeight = 40,
FillColor = Color.FromRgb(0x73, 0xbf, 0x76),
LineColor = Color.FromRgb(0x73, 0xbf, 0x76),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel1 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Color.FromRgb(0xee, 0xf6, 0xee),
LineColor = Color.FromRgb(0x73, 0xbf, 0x76),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel2 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Colors.Transparent,
LineColor = Color.FromRgb(0x73, 0xbf, 0x76),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
public static MindThemeModel LiteratureGreenMiniTheme = new MindThemeModel()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
Theme = MindTheme.LiteratureGreenMini,
MindThemeLevel0 = new MindThemeModelItem()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
ItemWidth = 120,
ItemHeight = 40,
FillColor = Color.FromRgb(0x73, 0xbf, 0x76),
LineColor = Color.FromRgb(0x73, 0xbf, 0x76),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(10, 10),
},
MindThemeLevel1 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Color.FromRgb(0xee, 0xf6, 0xee),
LineColor = Color.FromRgb(0x73, 0xbf, 0x76),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(10, 10),
},
MindThemeLevel2 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Colors.Transparent,
LineColor = Color.FromRgb(0x73, 0xbf, 0x76),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(10, 10),
}
};
public static MindThemeModel BrainDeadPinkTheme = new MindThemeModel()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
Theme = MindTheme.BrainDeadPink,
MindThemeLevel0 = new MindThemeModelItem()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
ItemWidth = 120,
ItemHeight = 40,
FillColor = Color.FromRgb(0xbf, 0x73, 0x94),
LineColor = Color.FromRgb(0xbf, 0x73, 0x94),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel1 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Color.FromRgb(0xf6, 0xee, 0xf2),
LineColor = Color.FromRgb(0xbf, 0x73, 0x94),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel2 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Colors.Transparent,
LineColor = Color.FromRgb(0xbf, 0x73, 0x94),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
public static MindThemeModel BrainDeadPinkMiniTheme = new MindThemeModel()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
Theme = MindTheme.BrainDeadPinkMini,
MindThemeLevel0 = new MindThemeModelItem()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
ItemWidth = 120,
ItemHeight = 40,
FillColor = Color.FromRgb(0xbf, 0x73, 0x94),
LineColor = Color.FromRgb(0xbf, 0x73, 0x94),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(10, 10),
},
MindThemeLevel1 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Color.FromRgb(0xf6, 0xee, 0xf2),
LineColor = Color.FromRgb(0xbf, 0x73, 0x94),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(10, 10),
},
MindThemeLevel2 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Colors.Transparent,
LineColor = Color.FromRgb(0xbf, 0x73, 0x94),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(10, 10),
}
};
public static MindThemeModel RomanticPurpleTheme = new MindThemeModel()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
Theme = MindTheme.RomanticPurple,
MindThemeLevel0 = new MindThemeModelItem()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
ItemWidth = 120,
ItemHeight = 40,
FillColor = Color.FromRgb(0x7b, 0x73, 0xbf),
LineColor = Color.FromRgb(0x7b, 0x73, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel1 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Color.FromRgb(0xef, 0xee, 0xf6),
LineColor = Color.FromRgb(0x7b, 0x73, 0xbf),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel2 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Colors.Transparent,
LineColor = Color.FromRgb(0x7b, 0x73, 0xbf),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
public static MindThemeModel RomanticPurpleMiniTheme = new MindThemeModel()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
Theme = MindTheme.RomanticPurpleMini,
MindThemeLevel0 = new MindThemeModelItem()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
ItemWidth = 120,
ItemHeight = 40,
FillColor = Color.FromRgb(0x7b, 0x73, 0xbf),
LineColor = Color.FromRgb(0x7b, 0x73, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(10, 10),
},
MindThemeLevel1 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Color.FromRgb(0xef, 0xee, 0xf6),
LineColor = Color.FromRgb(0x7b, 0x73, 0xbf),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(10, 10),
},
MindThemeLevel2 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Colors.Transparent,
LineColor = Color.FromRgb(0x7b, 0x73, 0xbf),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(10, 10),
}
};
public static MindThemeModel FreshRedTheme = new MindThemeModel()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
Theme = MindTheme.FreshRed,
MindThemeLevel0 = new MindThemeModelItem()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
ItemWidth = 120,
ItemHeight = 40,
FillColor = Color.FromRgb(0xbf, 0x73, 0x73),
LineColor = Color.FromRgb(0xbf, 0x73, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel1 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Color.FromRgb(0xf6, 0xee, 0xee),
LineColor = Color.FromRgb(0xbf, 0x73, 0x73),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel2 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Colors.Transparent,
LineColor = Color.FromRgb(0xbf, 0x73, 0x73),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
public static MindThemeModel FreshRedMiniTheme = new MindThemeModel()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
Theme = MindTheme.FreshRedMini,
MindThemeLevel0 = new MindThemeModelItem()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
ItemWidth = 120,
ItemHeight = 40,
FillColor = Color.FromRgb(0xbf, 0x73, 0x73),
LineColor = Color.FromRgb(0xbf, 0x73, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(10, 10),
},
MindThemeLevel1 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Color.FromRgb(0xf6, 0xee, 0xee),
LineColor = Color.FromRgb(0xbf, 0x73, 0x73),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(10, 10),
},
MindThemeLevel2 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Colors.Transparent,
LineColor = Color.FromRgb(0xbf, 0x73, 0x73),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(10, 10),
}
};
public static MindThemeModel EarthyYellowTheme = new MindThemeModel()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
Theme = MindTheme.EarthyYellow,
MindThemeLevel0 = new MindThemeModelItem()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
ItemWidth = 120,
ItemHeight = 40,
FillColor = Color.FromRgb(0xbf, 0x93, 0x73),
LineColor = Color.FromRgb(0xbf, 0x93, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel1 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Color.FromRgb(0xf6, 0xf2, 0xee),
LineColor = Color.FromRgb(0xbf, 0x93, 0x73),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel2 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Colors.Transparent,
LineColor = Color.FromRgb(0xbf, 0x93, 0x73),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
public static MindThemeModel EarthyYellowMiniTheme= new MindThemeModel()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
Theme = MindTheme.EarthyYellowMini,
MindThemeLevel0 = new MindThemeModelItem()
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
ItemWidth = 120,
ItemHeight = 40,
FillColor = Color.FromRgb(0xbf, 0x93, 0x73),
LineColor = Color.FromRgb(0xbf, 0x93, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(10, 10),
},
MindThemeLevel1 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Color.FromRgb(0xf6, 0xf2, 0xee),
LineColor = Color.FromRgb(0xbf, 0x93, 0x73),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(10, 10),
},
MindThemeLevel2 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Colors.Transparent,
LineColor = Color.FromRgb(0xbf, 0x93, 0x73),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(10, 10),
}
};
public static MindThemeModel CoolLightYellowTheme = new MindThemeModel()
{
Theme = MindTheme.CoolLightYellow,
Dark = true,
MindThemeLevel0 = new MindThemeModelItem()
{
ItemWidth = 120,
ItemHeight = 40,
FillColor = Color.FromRgb(0xe9, 0xdf, 0x98),
LineColor = Color.FromRgb(0xe9, 0xdf, 0x98),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel1 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Color.FromRgb(0xa4, 0xc5, 0xc0),
LineColor = Color.FromRgb(0xa4, 0xc5, 0xc0),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel2 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Colors.White,
LineColor = Colors.White,
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
public static MindThemeModel CoolLightYellowMiniTheme = new MindThemeModel()
{
Theme = MindTheme.CoolLightYellowMini,
Dark = true,
MindThemeLevel0 = new MindThemeModelItem()
{
ItemWidth = 120,
ItemHeight = 40,
FillColor = Color.FromRgb(0xe9, 0xdf, 0x98),
LineColor = Color.FromRgb(0xe9, 0xdf, 0x98),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(10, 10),
},
MindThemeLevel1 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Color.FromRgb(0xa4, 0xc5, 0xc0),
LineColor = Color.FromRgb(0xa4, 0xc5, 0xc0),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(10, 10),
},
MindThemeLevel2 = new MindThemeModelItem()
{
ItemWidth = 100,
ItemHeight = 25,
FillColor = Colors.White,
LineColor = Colors.White,
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(10, 10),
}
};
2023-03-11 22:27:23 +08:00
2023-04-02 12:01:46 +08:00
public static void ThemeChange(MindNode mindNode, MindTheme mindTheme, bool initAppearance = false)
2023-03-11 22:27:23 +08:00
{
2023-04-02 12:01:46 +08:00
var mindThemeModel = GetTheme(mindTheme);
2023-03-11 22:27:23 +08:00
switch (mindNode.NodeLevel)
{
case 0:
2023-04-02 12:01:46 +08:00
{
if (initAppearance)
{
mindNode.ItemWidth = mindThemeModel.MindThemeLevel0.ItemWidth;
mindNode.ItemHeight = mindThemeModel.MindThemeLevel0.ItemHeight;
}
mindNode.ColorViewModel.FillColor.Color = mindThemeModel.MindThemeLevel0.FillColor;
mindNode.ColorViewModel.LineColor.Color = mindThemeModel.MindThemeLevel0.LineColor;
mindNode.FontViewModel.FontColor = mindThemeModel.MindThemeLevel0.FontColor;
mindNode.FontViewModel.FontSize = mindThemeModel.MindThemeLevel0.FontSize;
mindNode.Spacing = mindThemeModel.MindThemeLevel0.Spacing;
break;
}
case 1:
2023-03-11 22:27:23 +08:00
{
2023-03-26 23:23:34 +08:00
if (initAppearance)
{
mindNode.ItemWidth = mindThemeModel.MindThemeLevel1.ItemWidth;
mindNode.ItemHeight = mindThemeModel.MindThemeLevel1.ItemHeight;
}
2023-03-11 22:27:23 +08:00
mindNode.ColorViewModel.FillColor.Color = mindThemeModel.MindThemeLevel1.FillColor;
2023-03-19 23:26:14 +08:00
mindNode.ColorViewModel.LineColor.Color = mindThemeModel.MindThemeLevel1.LineColor;
2023-03-11 22:27:23 +08:00
mindNode.FontViewModel.FontColor = mindThemeModel.MindThemeLevel1.FontColor;
mindNode.FontViewModel.FontSize = mindThemeModel.MindThemeLevel1.FontSize;
mindNode.Spacing = mindThemeModel.MindThemeLevel1.Spacing;
break;
}
2023-04-02 12:01:46 +08:00
default:
2023-03-11 22:27:23 +08:00
{
2023-03-26 23:23:34 +08:00
if (initAppearance)
{
mindNode.ItemWidth = mindThemeModel.MindThemeLevel2.ItemWidth;
mindNode.ItemHeight = mindThemeModel.MindThemeLevel2.ItemHeight;
}
2023-03-11 22:27:23 +08:00
mindNode.ColorViewModel.FillColor.Color = mindThemeModel.MindThemeLevel2.FillColor;
2023-03-19 23:26:14 +08:00
mindNode.ColorViewModel.LineColor.Color = mindThemeModel.MindThemeLevel2.LineColor;
2023-03-11 22:27:23 +08:00
mindNode.FontViewModel.FontColor = mindThemeModel.MindThemeLevel2.FontColor;
mindNode.FontViewModel.FontSize = mindThemeModel.MindThemeLevel2.FontSize;
mindNode.Spacing = mindThemeModel.MindThemeLevel2.Spacing;
break;
}
}
}
2023-03-26 23:23:34 +08:00
2023-04-02 12:01:46 +08:00
public static MindThemeModel GetNodeTheme(MindNode mindNode)
2023-03-26 23:23:34 +08:00
{
MindThemeModel mindThemeModel = new MindThemeModel()
{
2023-04-02 12:01:46 +08:00
MindThemeLevel0 = new MindThemeModelItem()
2023-03-26 23:23:34 +08:00
{
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)
{
2023-04-02 12:01:46 +08:00
mindNode.ItemWidth = mindThemeModel.MindThemeLevel0.ItemWidth;
mindNode.ItemHeight = mindThemeModel.MindThemeLevel0.ItemHeight;
mindNode.ColorViewModel.FillColor.Color = mindThemeModel.MindThemeLevel0.FillColor;
mindNode.ColorViewModel.LineColor.Color = mindThemeModel.MindThemeLevel0.LineColor;
mindNode.FontViewModel.FontColor = mindThemeModel.MindThemeLevel0.FontColor;
mindNode.FontViewModel.FontSize = mindThemeModel.MindThemeLevel0.FontSize;
mindNode.Spacing = mindThemeModel.MindThemeLevel0.Spacing;
}
public static MindThemeModelItem GetNodeDefaultTheme(MindNode mindNode)
{
var defaultMindTheme = MindThemeDictionary.FirstOrDefault(p => p.Theme == mindNode.MindTheme) ?? SkyBlueTheme;
switch(mindNode.NodeLevel)
{
case 0: return defaultMindTheme.MindThemeLevel0;
case 1: return defaultMindTheme.MindThemeLevel1;
default: return defaultMindTheme.MindThemeLevel2;
}
2023-03-26 23:23:34 +08:00
}
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;
}
2023-03-11 22:27:23 +08:00
}
2023-04-02 12:01:46 +08:00
public class MindThemeModelItem
2023-03-11 22:27:23 +08:00
{
public double ItemWidth
{
get; set;
}
public double ItemHeight
{
get; set;
}
public Color FillColor
{
get; set;
}
2023-03-19 23:26:14 +08:00
public Color LineColor
{
get; set;
}
2023-03-11 22:27:23 +08:00
public Color FontColor
{
get; set;
}
public double FontSize
{
get; set;
}
public SizeBase Spacing
{
get; set;
}
}
public class MindThemeModel
{
2023-04-02 12:01:46 +08:00
public MindTheme Theme
2023-03-20 23:01:38 +08:00
{
get; set;
}
2023-03-12 23:26:22 +08:00
public string Name
{
2023-04-02 12:01:46 +08:00
get
{
return Theme.GetDescription();
}
2023-03-12 23:26:22 +08:00
}
2023-03-25 22:10:49 +08:00
public bool Dark
{
get; set;
}
2023-04-02 12:01:46 +08:00
public MindThemeModelItem MindThemeLevel0
2023-03-11 22:27:23 +08:00
{
get; set;
}
2023-04-02 12:01:46 +08:00
public MindThemeModelItem MindThemeLevel1
2023-03-11 22:27:23 +08:00
{
get; set;
}
2023-04-02 12:01:46 +08:00
public MindThemeModelItem MindThemeLevel2
2023-03-11 22:27:23 +08:00
{
get; set;
}
}
}