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

@@ -166,6 +166,12 @@
<MenuItem Header="天盘图" IsCheckable="True" IsChecked="{Binding MindType,Converter={dd:ConverterValueMapToBool Parameter='Celestial'}, ConverterParameter='Celestial'}" />
</controls:DropDownButton.Items>
</controls:DropDownButton>
<Button Style="{StaticResource FlatButtonStyle}" Grid.Row="0" Grid.Column="1" Command="{Binding AddChildCommand}">
<StackPanel Orientation="Horizontal">
<Path Width="12" Height="12" Stretch="Uniform" Fill="Black" Data="M992.9 500.1H355c-19.3 0-35 15.7-35 35V660H182V340.8h427.8c32 0 58-26 58-58V58c0-32-25.9-58-58-58H58C26 0 0 26 0 58v224.8c0 32 26 58 58 58h54V689c0 13.3 7.4 24.8 18.2 30.7 6.3 6.3 15.1 10.3 24.8 10.3h165v145.9c0 19.3 15.7 35 35 35h226c19.3 0 35-15.7 35-35s-15.7-35-35-35H390V570.1h567.9V611c0 19.3 15.7 35 35 35s35-15.7 35-35v-75.9c0-19.3-15.7-35-35-35zM70 70h527.8v200.8H70V70zM989 830h-89v-89c0-19.3-15.7-35-35-35s-35 15.7-35 35v89h-89c-19.3 0-35 15.7-35 35s15.7 35 35 35h89v89c0 19.3 15.7 35 35 35s35-15.7 35-35v-89h89c19.3 0 35-15.7 35-35s-15.7-35-35-35z"></Path>
<TextBlock>整理布局</TextBlock>
</StackPanel>
</Button>
</Grid>
</TabItem>
<TabItem Header="视图">

View File

@@ -58,5 +58,40 @@ namespace AIStudio.Wpf.Mind.ViewModels
{
get;
}
SimpleCommand ResetLayoutCommand
{
get;
}
SimpleCommand Expand2Level1Command
{
get;
}
SimpleCommand Expand2Level2Command
{
get;
}
SimpleCommand Expand2Level3Command
{
get;
}
SimpleCommand Expand2Level4Command
{
get;
}
SimpleCommand Expand2Level5Command
{
get;
}
SimpleCommand Expand2Level6Command
{
get;
}
}
}

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
}