mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-01 22:56:35 +08:00
可以切换主题
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
using AIStudio.Wpf.DiagramDesigner;
|
||||
using AIStudio.Wpf.Mind.Helpers;
|
||||
|
||||
namespace AIStudio.Wpf.Mind.ViewModels
|
||||
{
|
||||
@@ -25,6 +26,18 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private MindThemeModel _mindThemeModel = MindThemeHelper.GetTheme("SkyBlue");
|
||||
public MindThemeModel MindThemeModel
|
||||
{
|
||||
get
|
||||
{
|
||||
return _mindThemeModel;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _mindThemeModel, value);
|
||||
}
|
||||
}
|
||||
public MindNode RootItem
|
||||
{
|
||||
get
|
||||
@@ -53,12 +66,12 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _addPeerCommand;
|
||||
public SimpleCommand AddPeerCommand
|
||||
private SimpleCommand _AddPearCommand;
|
||||
public SimpleCommand AddPearCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._addPeerCommand ?? (this._addPeerCommand = new SimpleCommand(MindLevelEnable, this.ExecuteAddPeerCommand));
|
||||
return this._AddPearCommand ?? (this._AddPearCommand = new SimpleCommand(MindLevelEnable, this.ExecuteAddPearCommand));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,6 +102,42 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _selectBrotherCommand;
|
||||
public SimpleCommand SelectBrotherCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._selectBrotherCommand ?? (this._selectBrotherCommand = new SimpleCommand(MindLevelEnable, ExecuteSelectBrotherCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _selectPearCommand;
|
||||
public SimpleCommand SelectPearCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._selectPearCommand ?? (this._selectPearCommand = new SimpleCommand(MindLevelEnable, ExecuteSelectPearCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _selectRouteCommand;
|
||||
public SimpleCommand SelectRouteCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._selectRouteCommand ?? (this._selectRouteCommand = new SimpleCommand(MindLevelEnable, ExecuteSelectRouteCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _selectChildCommand;
|
||||
public SimpleCommand SelectChildCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._selectChildCommand ?? (this._selectChildCommand = new SimpleCommand(MindLevelEnable, ExecuteSelectChildCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _addLinkCommand;
|
||||
public SimpleCommand AddLinkCommand
|
||||
{
|
||||
@@ -175,7 +224,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._changeMindTypeCommand ?? (this._changeMindTypeCommand = new SimpleCommand(MindExecuteEnable, this.ExecutedChangeMindTypeCommand));
|
||||
return this._changeMindTypeCommand ?? (this._changeMindTypeCommand = new SimpleCommand(ExecuteEnable, this.ExecutedChangeMindTypeCommand));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +233,34 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._changeMindThemeCommand ?? (this._changeMindThemeCommand = new SimpleCommand(MindExecuteEnable, this.ExecutedChangeMindThemeCommand));
|
||||
return this._changeMindThemeCommand ?? (this._changeMindThemeCommand = new SimpleCommand(ExecuteEnable, this.ExecutedChangeMindThemeCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _clearThemeCommand;
|
||||
public SimpleCommand ClearThemeCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._clearThemeCommand ?? (this._clearThemeCommand = new SimpleCommand(ExecuteEnable, this.ExecutedClearThemeCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _copyThemeCommand;
|
||||
public SimpleCommand CopyThemeCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._copyThemeCommand ?? (this._copyThemeCommand = new SimpleCommand(ExecuteEnable, this.ExecutedCopyThemeCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _pasteThemeCommand;
|
||||
public SimpleCommand PasteThemeCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._pasteThemeCommand ?? (this._pasteThemeCommand = new SimpleCommand(ExecuteEnable, this.ExecutedPasteThemeCommand));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +269,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._expand2Level1Command ?? (this._expand2Level1Command = new SimpleCommand(MindExecuteEnable, this.ExecutedExpand2Level1Command));
|
||||
return this._expand2Level1Command ?? (this._expand2Level1Command = new SimpleCommand(ExecuteEnable, this.ExecutedExpand2Level1Command));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +278,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._expand2Level2Command ?? (this._expand2Level2Command = new SimpleCommand(MindExecuteEnable, this.ExecutedExpand2Level2Command));
|
||||
return this._expand2Level2Command ?? (this._expand2Level2Command = new SimpleCommand(ExecuteEnable, this.ExecutedExpand2Level2Command));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,7 +287,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._expand2Level3Command ?? (this._expand2Level3Command = new SimpleCommand(MindExecuteEnable, this.ExecutedExpand2Level3Command));
|
||||
return this._expand2Level3Command ?? (this._expand2Level3Command = new SimpleCommand(ExecuteEnable, this.ExecutedExpand2Level3Command));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,7 +296,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._expand2Level4Command ?? (this._expand2Level4Command = new SimpleCommand(MindExecuteEnable, this.ExecutedExpand2Level4Command));
|
||||
return this._expand2Level4Command ?? (this._expand2Level4Command = new SimpleCommand(ExecuteEnable, this.ExecutedExpand2Level4Command));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +305,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._expand2Level5Command ?? (this._expand2Level5Command = new SimpleCommand(MindExecuteEnable, this.ExecutedExpand2Level5Command));
|
||||
return this._expand2Level5Command ?? (this._expand2Level5Command = new SimpleCommand(ExecuteEnable, this.ExecutedExpand2Level5Command));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,7 +314,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._expand2Level6Command ?? (this._expand2Level6Command = new SimpleCommand(MindExecuteEnable, this.ExecutedExpand2Level6Command));
|
||||
return this._expand2Level6Command ?? (this._expand2Level6Command = new SimpleCommand(ExecuteEnable, this.ExecutedExpand2Level6Command));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -370,7 +446,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public void ExecuteAddPeerCommand(object parameter)
|
||||
public void ExecuteAddPearCommand(object parameter)
|
||||
{
|
||||
List<MindNode> items = new List<MindNode>();
|
||||
if (parameter is MindNode pear)
|
||||
@@ -539,52 +615,52 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
|
||||
private void ExecuteAddLinkCommand(object obj)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
private void ExecuteRemoveLinkCommand(object obj)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
private void ExecuteAddImageCommand(object obj)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
private void ExecuteRemoveImageCommand(object obj)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
private void ExecuteAddRemarkCommand(object obj)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
private void ExecuteRemoveRemarkCommand(object obj)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
private void ExecuteAddPriorityCommand(object obj)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
private void ExecuteAddRatioCommand(object obj)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
private void ExecuteAddTagCommand(object obj)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
private void ExecuteRemoveTagCommand(object obj)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
private void ExecutedChangeMindTypeCommand(object obj)
|
||||
@@ -599,44 +675,106 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
|
||||
private void ExecutedChangeMindThemeCommand(object obj)
|
||||
{
|
||||
|
||||
if (obj is string mindThemeModel)
|
||||
{
|
||||
MindThemeModel = MindThemeHelper.GetTheme(mindThemeModel);
|
||||
if (mindThemeModel.StartsWith("CoolLightYellow"))
|
||||
{
|
||||
PageBackground = Colors.Black;
|
||||
}
|
||||
else
|
||||
{
|
||||
PageBackground = Colors.White;
|
||||
}
|
||||
Items.OfType<MindNode>().ToList().ForEach(item => { item.ThemeChange(); });
|
||||
RootItem?.LayoutUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecutedClearThemeCommand(object parameter)
|
||||
{
|
||||
List<MindNode> nodes = new List<MindNode>();
|
||||
if (parameter is MindNode node1)
|
||||
{
|
||||
nodes.Add(node1);
|
||||
}
|
||||
else if (parameter is IEnumerable<MindNode> para)
|
||||
{
|
||||
nodes.AddRange(para);
|
||||
}
|
||||
else
|
||||
{
|
||||
nodes.AddRange(SelectedItems.OfType<MindNode>());
|
||||
}
|
||||
|
||||
if (nodes.Any())
|
||||
{
|
||||
DoCommandManager.DoNewCommand(this.ToString(),
|
||||
() => {
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
node.ThemeChange();
|
||||
}
|
||||
RootItem.LayoutUpdated();
|
||||
},
|
||||
() => {
|
||||
//ToDo
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecutedCopyThemeCommand(object parameter)
|
||||
{
|
||||
if (parameter is MindNode node)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
node = SelectedItem as MindNode;
|
||||
}
|
||||
|
||||
if (node != null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecutedPasteThemeCommand(object parameter)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void ExecutedExpand2Level1Command(object obj)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
private void ExecutedExpand2Level2Command(object obj)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
private void ExecutedExpand2Level3Command(object obj)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
private void ExecutedExpand2Level4Command(object obj)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
private void ExecutedExpand2Level5Command(object obj)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
|
||||
private void ExecutedExpand2Level6Command(object obj)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
#endregion
|
||||
protected override void ExecutedInitLayoutCommand(object obj)
|
||||
{
|
||||
|
||||
}
|
||||
protected override void ExecutedResetLayoutCommand(object obj)
|
||||
{
|
||||
foreach (var item in Items.OfType<MindNode>())
|
||||
|
||||
Reference in New Issue
Block a user