This commit is contained in:
kwai
2023-03-06 11:54:41 +08:00
parent cd20abd7fe
commit 152c6a8c22
5 changed files with 422 additions and 154 deletions

View File

@@ -34,39 +34,58 @@ namespace AIStudio.Wpf.Mind.ViewModels
#endregion
#region
public SimpleCommand AddRootCommand
{
get; private set;
}
private SimpleCommand _addParentCommand;
public SimpleCommand AddParentCommand
{
get; private set;
get
{
return this._addParentCommand ?? (this._addParentCommand = new SimpleCommand(MindLevelEnable, ExecuteAddParentCommand));
}
}
private SimpleCommand _addChildCommand;
public SimpleCommand AddChildCommand
{
get; private set;
get
{
return this._addChildCommand ?? (this._addChildCommand = new SimpleCommand(MindExecuteEnable, this.ExecuteAddChildCommand));
}
}
private SimpleCommand _addPeerCommand;
public SimpleCommand AddPeerCommand
{
get; private set;
get
{
return this._addPeerCommand ?? (this._addPeerCommand = new SimpleCommand(MindLevelEnable, this.ExecuteAddPeerCommand));
}
}
private SimpleCommand _deleteSelfCommand;
public SimpleCommand DeleteSelfCommand
{
get; private set;
get
{
return this._deleteSelfCommand ?? (this._deleteSelfCommand = new SimpleCommand(MindLevelEnable, ExecuteDeleteSelfCommand));
}
}
private SimpleCommand _moveForwardCommand;
public SimpleCommand MoveForwardCommand
{
get; private set;
get
{
return this._moveForwardCommand ?? (this._moveForwardCommand = new SimpleCommand(MindExecuteEnable, ExecuteMoveForwardCommand));
}
}
private SimpleCommand _moveBackCommand;
public SimpleCommand MoveBackCommand
{
get; private set;
get
{
return this._moveBackCommand ?? (this._moveBackCommand = new SimpleCommand(MindExecuteEnable, ExecuteMoveBackCommand));
}
}
private SimpleCommand _changeMindTypeCommand;
@@ -78,56 +97,81 @@ namespace AIStudio.Wpf.Mind.ViewModels
}
}
private SimpleCommand _changeMindThemeCommand;
public SimpleCommand ChangeMindThemeCommand
{
get; private set;
get
{
return this._changeMindThemeCommand ?? (this._changeMindThemeCommand = new SimpleCommand(MindExecuteEnable, this.ExecutedChangeMindThemeCommand));
}
}
public SimpleCommand ResetLayout
private SimpleCommand _resetLayoutCommand;
public SimpleCommand ResetLayoutCommand
{
get; private set;
get
{
return this._resetLayoutCommand ?? (this._resetLayoutCommand = new SimpleCommand(MindExecuteEnable, this.ExecutedResetLayoutCommand));
}
}
public SimpleCommand Expand2Level1
private SimpleCommand _expand2Level1Command;
public SimpleCommand Expand2Level1Command
{
get; private set;
get
{
return this._expand2Level1Command ?? (this._expand2Level1Command = new SimpleCommand(MindExecuteEnable, this.ExecutedExpand2Level1Command));
}
}
public SimpleCommand Expand2Level2
private SimpleCommand _expand2Level2Command;
public SimpleCommand Expand2Level2Command
{
get; private set;
get
{
return this._expand2Level2Command ?? (this._expand2Level2Command = new SimpleCommand(MindExecuteEnable, this.ExecutedExpand2Level2Command));
}
}
public SimpleCommand Expand2Level3
private SimpleCommand _expand2Level3Command;
public SimpleCommand Expand2Level3Command
{
get; private set;
get
{
return this._expand2Level3Command ?? (this._expand2Level3Command = new SimpleCommand(MindExecuteEnable, this.ExecutedExpand2Level3Command));
}
}
public SimpleCommand Expand2Level4
private SimpleCommand _expand2Level4Command;
public SimpleCommand Expand2Level4Command
{
get; private set;
get
{
return this._expand2Level4Command ?? (this._expand2Level4Command = new SimpleCommand(MindExecuteEnable, this.ExecutedExpand2Level4Command));
}
}
public SimpleCommand Expand2Level5
private SimpleCommand _expand2Level5Command;
public SimpleCommand Expand2Level5Command
{
get; private set;
get
{
return this._expand2Level5Command ?? (this._expand2Level5Command = new SimpleCommand(MindExecuteEnable, this.ExecutedExpand2Level5Command));
}
}
public SimpleCommand Expand2Level6
private SimpleCommand _expand2Level6Command;
public SimpleCommand Expand2Level6Command
{
get; private set;
get
{
return this._expand2Level6Command ?? (this._expand2Level6Command = new SimpleCommand(MindExecuteEnable, this.ExecutedExpand2Level6Command));
}
}
#endregion
public MindDiagramViewModel()
{
AddChildCommand = new SimpleCommand(MindExecuteEnable, ExecuteAddChildCommand);
AddParentCommand = new SimpleCommand(MindLevelEnable, ExecuteAddParentCommand);
AddPeerCommand = new SimpleCommand(MindLevelEnable, ExecuteAddPeerCommand);
DeleteSelfCommand = new SimpleCommand(MindLevelEnable, ExecuteDeleteSelfCommand);
MoveForwardCommand = new SimpleCommand(MindExecuteEnable, ExecuteMoveForwardCommand);
MoveBackCommand = new SimpleCommand(MindExecuteEnable, ExecuteMoveBackCommand);
MindNode level1node = new MindNode(this) { Left = 200, Top = 200, Text = "思维导图" };
level1node.InitLayout(true);
Items.Add(level1node);
@@ -151,16 +195,6 @@ namespace AIStudio.Wpf.Mind.ViewModels
}
#region
private void ExecutedChangeMindTypeCommand(object obj)
{
if (obj is MindType mindType)
{
Items.OfType<MindNode>().ToList().ForEach(item => { item.InitLayout(true); });
Items.OfType<MindNode>().ToList().ForEach(item => { item.InitConnectLayout(); });
RootItem?.LayoutUpdated();
}
}
public void ExecuteAddChildCommand(object parameter)
{
List<MindNode> items = new List<MindNode>();
@@ -393,6 +427,56 @@ namespace AIStudio.Wpf.Mind.ViewModels
}
}
private void ExecutedChangeMindTypeCommand(object obj)
{
if (obj is MindType mindType)
{
Items.OfType<MindNode>().ToList().ForEach(item => { item.InitLayout(true); });
Items.OfType<MindNode>().ToList().ForEach(item => { item.InitConnectLayout(); });
RootItem?.LayoutUpdated();
}
}
private void ExecutedChangeMindThemeCommand(object obj)
{
}
private void ExecutedResetLayoutCommand(object obj)
{
throw new NotImplementedException();
}
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
}