mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-14 21:46:37 +08:00
mind 工具栏
This commit is contained in:
@@ -273,57 +273,12 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _expand2Level1Command;
|
||||
public SimpleCommand Expand2Level1Command
|
||||
private SimpleCommand _expand2LevelCommand;
|
||||
public SimpleCommand Expand2LevelCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._expand2Level1Command ?? (this._expand2Level1Command = new SimpleCommand(ExecuteEnable, this.ExecutedExpand2Level1Command));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _expand2Level2Command;
|
||||
public SimpleCommand Expand2Level2Command
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._expand2Level2Command ?? (this._expand2Level2Command = new SimpleCommand(ExecuteEnable, this.ExecutedExpand2Level2Command));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _expand2Level3Command;
|
||||
public SimpleCommand Expand2Level3Command
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._expand2Level3Command ?? (this._expand2Level3Command = new SimpleCommand(ExecuteEnable, this.ExecutedExpand2Level3Command));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _expand2Level4Command;
|
||||
public SimpleCommand Expand2Level4Command
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._expand2Level4Command ?? (this._expand2Level4Command = new SimpleCommand(ExecuteEnable, this.ExecutedExpand2Level4Command));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _expand2Level5Command;
|
||||
public SimpleCommand Expand2Level5Command
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._expand2Level5Command ?? (this._expand2Level5Command = new SimpleCommand(ExecuteEnable, this.ExecutedExpand2Level5Command));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _expand2Level6Command;
|
||||
public SimpleCommand Expand2Level6Command
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._expand2Level6Command ?? (this._expand2Level6Command = new SimpleCommand(ExecuteEnable, this.ExecutedExpand2Level6Command));
|
||||
return this._expand2LevelCommand ?? (this._expand2LevelCommand = new SimpleCommand(ExecuteEnable, this.ExecutedExpand2LevelCommand));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -653,24 +608,41 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
SelectedItems.OfType<MindNode>().ToList().ForEach(p => {
|
||||
if (p.LinkInfo != null)
|
||||
{
|
||||
p.LinkInfo.Link = null; p.LinkInfo.Text = null;
|
||||
p.LinkInfo.Link = null;
|
||||
p.LinkInfo.Text = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void ExecuteAddImageCommand(object obj)
|
||||
{
|
||||
if (obj is object[] array && array.Length == 2)
|
||||
{
|
||||
SelectedItems.OfType<MindNode>().ToList().ForEach(p => {
|
||||
if (p.ImageInfo == null)
|
||||
p.ImageInfo = new ImageInfo();
|
||||
|
||||
p.ImageInfo.Url = array[0]?.ToString();
|
||||
p.ImageInfo.Text = array[1]?.ToString();
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecuteRemoveImageCommand(object obj)
|
||||
{
|
||||
|
||||
SelectedItems.OfType<MindNode>().ToList().ForEach(p => {
|
||||
if (p.ImageInfo != null)
|
||||
{
|
||||
p.ImageInfo.Url = null;
|
||||
p.ImageInfo.Text = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void ExecuteAddRemarkCommand(object obj)
|
||||
{
|
||||
SelectedItems.OfType<MindNode>().ToList().ForEach(p => p.Remark = "备注");
|
||||
SelectedItems.OfType<MindNode>().ToList().ForEach(p => p.Remark = obj?.ToString());
|
||||
}
|
||||
|
||||
private void ExecuteRemoveRemarkCommand(object obj)
|
||||
@@ -776,6 +748,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private MindNode FormatNode;
|
||||
private void ExecutedCopyThemeCommand(object parameter)
|
||||
{
|
||||
if (parameter is MindNode node)
|
||||
@@ -789,44 +762,68 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
|
||||
if (node != null)
|
||||
{
|
||||
|
||||
FormatNode = node;
|
||||
}
|
||||
}
|
||||
|
||||
private void ExecutedPasteThemeCommand(object parameter)
|
||||
{
|
||||
if (FormatNode != null)
|
||||
{
|
||||
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)
|
||||
{
|
||||
CopyHelper.CopyPropertyValue(FormatNode.ColorViewModel, node.ColorViewModel);
|
||||
CopyHelper.CopyPropertyValue(FormatNode.FontViewModel, node.FontViewModel);
|
||||
}
|
||||
RootItem.LayoutUpdated();
|
||||
},
|
||||
() => {
|
||||
//ToDo
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ExecutedExpand2Level1Command(object obj)
|
||||
private void ExecutedExpand2LevelCommand(object obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void ExecutedExpand2Level2Command(object obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void ExecutedExpand2Level3Command(object obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void ExecutedExpand2Level4Command(object obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void ExecutedExpand2Level5Command(object obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void ExecutedExpand2Level6Command(object obj)
|
||||
{
|
||||
|
||||
}
|
||||
int level = 0;
|
||||
int.TryParse(obj?.ToString(), out level);
|
||||
foreach (var item in Items.OfType<MindNode>())
|
||||
{
|
||||
if (item.NodeLevel == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (item.NodeLevel < level)
|
||||
{
|
||||
item.IsExpanded = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.IsExpanded = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
protected override void ExecutedResetLayoutCommand(object obj)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user