diff --git a/AIStudio.Wpf.DiagramApp/ViewModels/MindViewModel.cs b/AIStudio.Wpf.DiagramApp/ViewModels/MindViewModel.cs index d465066..345a35e 100644 --- a/AIStudio.Wpf.DiagramApp/ViewModels/MindViewModel.cs +++ b/AIStudio.Wpf.DiagramApp/ViewModels/MindViewModel.cs @@ -13,6 +13,7 @@ using AIStudio.Wpf.DiagramDesigner; using AIStudio.Wpf.Mind.ViewModels; using AIStudio.Wpf.Mind; using AIStudio.Wpf.DiagramDesigner.Additionals; +using AIStudio.Wpf.Mind.Helpers; namespace AIStudio.Wpf.Flowchart { @@ -65,7 +66,26 @@ namespace AIStudio.Wpf.Flowchart { foreach (var vm in DiagramViewModels.OfType()) { - vm.MindType = MindType; ; + vm.MindType = MindType; + } + } + } + } + + private MindThemeModel _mindThemeModel = MindThemeHelper.GetTheme("天空蓝"); + public MindThemeModel MindThemeModel + { + get + { + return _mindThemeModel; + } + set + { + if (SetProperty(ref _mindThemeModel, value)) + { + foreach (var vm in DiagramViewModels.OfType()) + { + vm.MindThemeModel = MindThemeHelper.GetTheme(MindThemeModel?.Name); } } } @@ -106,7 +126,7 @@ namespace AIStudio.Wpf.Flowchart protected override DiagramViewModel GetDiagramViewModel(string name, DiagramType diagramType) { - var viewmodel = new MindDiagramViewModel() { Name = name ?? NewNameHelper.GetNewName(DiagramViewModels.Select(p => p.Name), "页-"), DiagramType = diagramType, MindType = MindType }; + var viewmodel = new MindDiagramViewModel() { Name = name ?? NewNameHelper.GetNewName(DiagramViewModels.Select(p => p.Name), "页-"), DiagramType = diagramType, MindType = MindType, MindThemeModel = MindThemeHelper.GetTheme(MindThemeModel?.Name) }; viewmodel.Init(); return viewmodel; diff --git a/AIStudio.Wpf.DiagramApp/Views/MainWindow.xaml b/AIStudio.Wpf.DiagramApp/Views/MainWindow.xaml index 1c9cf65..c87d708 100644 --- a/AIStudio.Wpf.DiagramApp/Views/MainWindow.xaml +++ b/AIStudio.Wpf.DiagramApp/Views/MainWindow.xaml @@ -96,22 +96,22 @@ @@ -2184,20 +2184,20 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + 2) { - var diagram = values[0] as FrameworkElement; - var zoomValue = (double)values[1]; - var pageunit = (PageUnit)values[2]; - var unit = Unit.Cm; - if (pageunit > PageUnit.km) + try { - unit = Unit.Inch; - } - Vector vector = System.Windows.Media.VisualTreeHelper.GetOffset(diagram); - if (parameter?.ToString() == "Y") - { - var value = 0 - (unit == Unit.Cm? ScreenHelper.WidthToCm(vector.Y - 20) : ScreenHelper.WidthToInch(vector.Y - 20))/ zoomValue; - return value; - } - else - { - var value = 0 - (unit == Unit.Cm ? ScreenHelper.WidthToCm(vector.X - 20) : ScreenHelper.WidthToInch(vector.X - 20)) / zoomValue; - return value; + var diagram = values[0] as FrameworkElement; + var zoomValue = (double)values[1]; + var pageunit = (PageUnit)values[2]; + var unit = Unit.Cm; + if (pageunit > PageUnit.km) + { + unit = Unit.Inch; + } + Vector vector = System.Windows.Media.VisualTreeHelper.GetOffset(diagram); + + if (parameter?.ToString() == "Y") + { + var value = 0 - (unit == Unit.Cm ? ScreenHelper.WidthToCm(vector.Y - 20) : ScreenHelper.WidthToInch(vector.Y - 20)) / zoomValue; + return value; + } + else + { + var value = 0 - (unit == Unit.Cm ? ScreenHelper.WidthToCm(vector.X - 20) : ScreenHelper.WidthToInch(vector.X - 20)) / zoomValue; + return value; + } } + catch { } } return 0; } diff --git a/AIStudio.Wpf.Mind/Controls/ToolBoxControl.xaml b/AIStudio.Wpf.Mind/Controls/ToolBoxControl.xaml index ccbef40..3547bc8 100644 --- a/AIStudio.Wpf.Mind/Controls/ToolBoxControl.xaml +++ b/AIStudio.Wpf.Mind/Controls/ToolBoxControl.xaml @@ -468,20 +468,20 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/AIStudio.Wpf.Mind/Helpers/MindThemeHelper.cs b/AIStudio.Wpf.Mind/Helpers/MindThemeHelper.cs index 7fa924c..ef4bccf 100644 --- a/AIStudio.Wpf.Mind/Helpers/MindThemeHelper.cs +++ b/AIStudio.Wpf.Mind/Helpers/MindThemeHelper.cs @@ -16,20 +16,20 @@ namespace AIStudio.Wpf.Mind.Helpers { switch (theme) { - case "SkyBlue": return GetSkyBlueTheme(); - case "SkyBlueMini": return GetSkyBlueMiniTheme(); - case "LiteratureGreen": return GetLiteratureGreenTheme(); - case "LiteratureGreenMini": return GetLiteratureGreenMiniTheme(); - case "BrainDeadPink": return GetBrainDeadPinkTheme(); - case "BrainDeadPinkMini": return GetBrainDeadPinkMiniTheme(); - case "RomanticPurple": return GetRomanticPurpleTheme(); - case "RomanticPurpleMini": return GetRomanticPurpleMiniTheme(); - case "FreshRed": return GetFreshRedTheme(); - case "FreshRedMini": return GetFreshRedMiniTheme(); - case "EarthyYellow": return GetEarthyYellowTheme(); - case "EarthyYellowMini": return GetEarthyYellowMiniTheme(); - case "CoolLightYellow": return GetCoolLightYellowTheme(); - case "CoolLightYellowMini": return GetCoolLightYellowMiniTheme(); + case "天空蓝": return GetSkyBlueTheme(); + case "紧凑蓝": return GetSkyBlueMiniTheme(); + case "文艺绿": return GetLiteratureGreenTheme(); + case "紧凑绿": return GetLiteratureGreenMiniTheme(); + case "脑残粉": return GetBrainDeadPinkTheme(); + case "紧凑粉": return GetBrainDeadPinkMiniTheme(); + case "浪漫紫": return GetRomanticPurpleTheme(); + case "紧凑紫": return GetRomanticPurpleMiniTheme(); + case "清新红": return GetFreshRedTheme(); + case "紧凑红": return GetFreshRedMiniTheme(); + case "泥土黄": return GetEarthyYellowTheme(); + case "紧凑黄": return GetEarthyYellowMiniTheme(); + case "冷光黄": return GetCoolLightYellowTheme(); + case "紧凑冷": return GetCoolLightYellowMiniTheme(); default: return GetSkyBlueTheme(); } } @@ -39,6 +39,7 @@ namespace AIStudio.Wpf.Mind.Helpers return new MindThemeModel() { Name = "天空蓝", + Key = "SkyBlue", MindThemeLevel1 = new MindTheme() { ItemWidth = 110, @@ -76,6 +77,7 @@ namespace AIStudio.Wpf.Mind.Helpers return new MindThemeModel() { Name = "紧凑蓝", + Key = "SkyBlueMini", MindThemeLevel1 = new MindTheme() { ItemWidth = 110, @@ -113,6 +115,7 @@ namespace AIStudio.Wpf.Mind.Helpers return new MindThemeModel() { Name = "文艺绿", + Key = "LiteratureGreen", MindThemeLevel1 = new MindTheme() { ItemWidth = 110, @@ -150,6 +153,7 @@ namespace AIStudio.Wpf.Mind.Helpers return new MindThemeModel() { Name = "紧凑绿", + Key = "LiteratureGreenMini", MindThemeLevel1 = new MindTheme() { ItemWidth = 110, @@ -187,6 +191,7 @@ namespace AIStudio.Wpf.Mind.Helpers return new MindThemeModel() { Name = "脑残粉", + Key = "BrainDeadPink", MindThemeLevel1 = new MindTheme() { ItemWidth = 110, @@ -224,6 +229,7 @@ namespace AIStudio.Wpf.Mind.Helpers return new MindThemeModel() { Name = "紧凑粉", + Key = "BrainDeadPinkMini", MindThemeLevel1 = new MindTheme() { ItemWidth = 110, @@ -261,6 +267,7 @@ namespace AIStudio.Wpf.Mind.Helpers return new MindThemeModel() { Name = "浪漫紫", + Key = "RomanticPurple", MindThemeLevel1 = new MindTheme() { ItemWidth = 110, @@ -298,6 +305,7 @@ namespace AIStudio.Wpf.Mind.Helpers return new MindThemeModel() { Name = "紧凑紫", + Key = "RomanticPurpleMini", MindThemeLevel1 = new MindTheme() { ItemWidth = 110, @@ -335,6 +343,7 @@ namespace AIStudio.Wpf.Mind.Helpers return new MindThemeModel() { Name = "清新红", + Key = "FreshRed", MindThemeLevel1 = new MindTheme() { ItemWidth = 110, @@ -372,6 +381,7 @@ namespace AIStudio.Wpf.Mind.Helpers return new MindThemeModel() { Name = "紧凑红", + Key = "FreshRedMini", MindThemeLevel1 = new MindTheme() { ItemWidth = 110, @@ -409,6 +419,7 @@ namespace AIStudio.Wpf.Mind.Helpers return new MindThemeModel() { Name = "泥土黄", + Key = "EarthyYellow", MindThemeLevel1 = new MindTheme() { ItemWidth = 110, @@ -446,6 +457,7 @@ namespace AIStudio.Wpf.Mind.Helpers return new MindThemeModel() { Name = "紧凑黄", + Key = "EarthyYellowMini", MindThemeLevel1 = new MindTheme() { ItemWidth = 110, @@ -483,6 +495,7 @@ namespace AIStudio.Wpf.Mind.Helpers return new MindThemeModel() { Name = "冷光黄", + Key = "CoolLightYellow", MindThemeLevel1 = new MindTheme() { ItemWidth = 110, @@ -520,6 +533,7 @@ namespace AIStudio.Wpf.Mind.Helpers return new MindThemeModel() { Name = "紧凑黄", + Key = "CoolLightYellowMini", MindThemeLevel1 = new MindTheme() { ItemWidth = 110, @@ -628,6 +642,10 @@ namespace AIStudio.Wpf.Mind.Helpers public class MindThemeModel { + public string Key + { + get; set; + } public string Name { get; set; diff --git a/AIStudio.Wpf.Mind/ViewModels/MindDiagramViewModel.cs b/AIStudio.Wpf.Mind/ViewModels/MindDiagramViewModel.cs index 2a2134f..fe21138 100644 --- a/AIStudio.Wpf.Mind/ViewModels/MindDiagramViewModel.cs +++ b/AIStudio.Wpf.Mind/ViewModels/MindDiagramViewModel.cs @@ -26,7 +26,7 @@ namespace AIStudio.Wpf.Mind.ViewModels } } - private MindThemeModel _mindThemeModel = MindThemeHelper.GetTheme("SkyBlue"); + private MindThemeModel _mindThemeModel = MindThemeHelper.GetTheme("天空蓝"); public MindThemeModel MindThemeModel { get diff --git a/AIStudio.Wpf.Mind/ViewModels/MindNode.cs b/AIStudio.Wpf.Mind/ViewModels/MindNode.cs index 7646853..8f3f3bd 100644 --- a/AIStudio.Wpf.Mind/ViewModels/MindNode.cs +++ b/AIStudio.Wpf.Mind/ViewModels/MindNode.cs @@ -152,7 +152,7 @@ namespace AIStudio.Wpf.Mind.ViewModels { get { - return (Root as IMindDiagramViewModel)?.MindThemeModel ?? MindThemeHelper.GetTheme("SkyBlue"); + return (Root as IMindDiagramViewModel)?.MindThemeModel ?? MindThemeHelper.GetTheme("天空蓝"); } }