mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-05-04 06:51:28 +08:00
mind多个根节点的时候,切换模式的修复
This commit is contained in:
@@ -2171,17 +2171,12 @@
|
|||||||
<Fluent:SplitButton.LargeIcon>
|
<Fluent:SplitButton.LargeIcon>
|
||||||
<iconPacks:PackIconRemixIcon Kind="MindMap" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
<iconPacks:PackIconRemixIcon Kind="MindMap" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
</Fluent:SplitButton.LargeIcon>
|
</Fluent:SplitButton.LargeIcon>
|
||||||
<ListBox x:Name="mindtype" Width="140" dd:EnumHelper.Enum="{x:Type dd:MindType}" SelectedItem="{Binding PageViewModel.DiagramViewModel.MindType,Mode=OneWay}">
|
<ListBox x:Name="mindtype" Width="140" dd:EnumHelper.Enum="{x:Type dd:MindType}" SelectedItem="{Binding PageViewModel.DiagramViewModel.MindType}">
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding .,Converter={StaticResource EnumDescriptionConverter}}" />
|
<TextBlock Text="{Binding .,Converter={StaticResource EnumDescriptionConverter}}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
<i:Interaction.Triggers>
|
|
||||||
<i:EventTrigger EventName="SelectionChanged">
|
|
||||||
<i:InvokeCommandAction Command="{Binding PageViewModel.DiagramViewModel.ChangeMindTypeCommand}" CommandParameter="{Binding ElementName=mindtype,Path=SelectedItem}"/>
|
|
||||||
</i:EventTrigger>
|
|
||||||
</i:Interaction.Triggers>
|
|
||||||
</ListBox>
|
</ListBox>
|
||||||
<Fluent:SplitButton.ToolTip>
|
<Fluent:SplitButton.ToolTip>
|
||||||
<Fluent:ScreenTip Title="MindType"
|
<Fluent:ScreenTip Title="MindType"
|
||||||
@@ -2193,7 +2188,7 @@
|
|||||||
<Fluent:SplitButton.LargeIcon>
|
<Fluent:SplitButton.LargeIcon>
|
||||||
<iconPacks:PackIconUnicons Kind="Palette" Foreground="{Binding PageViewModel.DiagramViewModel.MindTheme,Converter={StaticResource MindThemeFillBrushConverter}}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
<iconPacks:PackIconUnicons Kind="Palette" Foreground="{Binding PageViewModel.DiagramViewModel.MindTheme,Converter={StaticResource MindThemeFillBrushConverter}}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||||
</Fluent:SplitButton.LargeIcon>
|
</Fluent:SplitButton.LargeIcon>
|
||||||
<ListBox x:Name="mindtheme" dd:EnumHelper.Enum="{x:Type dd:MindTheme}" SelectedItem="{Binding PageViewModel.DiagramViewModel.MindTheme,Mode=OneWay}">
|
<ListBox x:Name="mindtheme" dd:EnumHelper.Enum="{x:Type dd:MindTheme}" SelectedItem="{Binding PageViewModel.DiagramViewModel.MindTheme}">
|
||||||
<ListBox.ItemsPanel>
|
<ListBox.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<UniformGrid Columns="2"/>
|
<UniformGrid Columns="2"/>
|
||||||
@@ -2206,11 +2201,6 @@
|
|||||||
</Border>
|
</Border>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
<i:Interaction.Triggers>
|
|
||||||
<i:EventTrigger EventName="SelectionChanged">
|
|
||||||
<i:InvokeCommandAction Command="{Binding PageViewModel.DiagramViewModel.ChangeMindThemeCommand}" CommandParameter="{Binding ElementName=mindtheme,Path=SelectedItem}"/>
|
|
||||||
</i:EventTrigger>
|
|
||||||
</i:Interaction.Triggers>
|
|
||||||
</ListBox>
|
</ListBox>
|
||||||
<Fluent:SplitButton.ToolTip>
|
<Fluent:SplitButton.ToolTip>
|
||||||
<Fluent:ScreenTip Title="Theme"
|
<Fluent:ScreenTip Title="Theme"
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ namespace AIStudio.Wpf.DiagramDesigner.Demo.ViewModels
|
|||||||
{
|
{
|
||||||
this.ItemWidth = 150;
|
this.ItemWidth = 150;
|
||||||
this.ItemHeight = 80;
|
this.ItemHeight = 80;
|
||||||
connectors.Add(new FullyCreatedConnectorInfo(this, ConnectorOrientation.Top));
|
AddConnector(new FullyCreatedConnectorInfo(this, ConnectorOrientation.Top));
|
||||||
connectors.Add(new FullyCreatedConnectorInfo(this, ConnectorOrientation.Bottom));
|
AddConnector(new FullyCreatedConnectorInfo(this, ConnectorOrientation.Bottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadDesignerItemViewModel(SelectableItemBase designerbase)
|
protected override void LoadDesignerItemViewModel(SelectableItemBase designerbase)
|
||||||
|
|||||||
@@ -207,7 +207,7 @@
|
|||||||
|
|
||||||
<ControlTemplate x:Key="ConnectorDecoratorTemplate"
|
<ControlTemplate x:Key="ConnectorDecoratorTemplate"
|
||||||
TargetType="{x:Type Control}">
|
TargetType="{x:Type Control}">
|
||||||
<Grid Margin="-5">
|
<Grid Margin="{Binding ConnectorMargin}">
|
||||||
<dd:Connector
|
<dd:Connector
|
||||||
Content="{Binding LeftConnector}"
|
Content="{Binding LeftConnector}"
|
||||||
Cursor="Cross"
|
Cursor="Cross"
|
||||||
|
|||||||
@@ -40,10 +40,10 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
|
|
||||||
protected override void InitNew()
|
protected override void InitNew()
|
||||||
{
|
{
|
||||||
connectors.Add(new FullyCreatedConnectorInfo(this.Root, this, ConnectorOrientation.Top));
|
AddConnector(new FullyCreatedConnectorInfo(this.Root, this, ConnectorOrientation.Top));
|
||||||
connectors.Add(new FullyCreatedConnectorInfo(this.Root, this, ConnectorOrientation.Bottom));
|
AddConnector(new FullyCreatedConnectorInfo(this.Root, this, ConnectorOrientation.Bottom));
|
||||||
connectors.Add(new FullyCreatedConnectorInfo(this.Root, this, ConnectorOrientation.Left));
|
AddConnector(new FullyCreatedConnectorInfo(this.Root, this, ConnectorOrientation.Left));
|
||||||
connectors.Add(new FullyCreatedConnectorInfo(this.Root, this, ConnectorOrientation.Right));
|
AddConnector(new FullyCreatedConnectorInfo(this.Root, this, ConnectorOrientation.Right));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadDesignerItemViewModel(SelectableItemBase designerbase)
|
protected override void LoadDesignerItemViewModel(SelectableItemBase designerbase)
|
||||||
@@ -265,6 +265,19 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private double _connectorMargin = -4;
|
||||||
|
public double ConnectorMargin
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _connectorMargin;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SetProperty(ref _connectorMargin, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool _showConnectors = false;
|
private bool _showConnectors = false;
|
||||||
public bool ShowConnectors
|
public bool ShowConnectors
|
||||||
{
|
{
|
||||||
@@ -573,6 +586,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
if (!connectors.Contains(connector))
|
if (!connectors.Contains(connector))
|
||||||
{
|
{
|
||||||
connectors.Add(connector);
|
connectors.Add(connector);
|
||||||
|
ConnectorMargin = 0 - connector.ConnectorWidth / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1050,10 +1050,12 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
{
|
{
|
||||||
Mediator.Instance.Register(this);
|
Mediator.Instance.Register(this);
|
||||||
Items.CollectionChanged += Items_CollectionChanged;
|
Items.CollectionChanged += Items_CollectionChanged;
|
||||||
var zoomValueChangedSubscription = WhenPropertyChanged.Where(o => o.ToString() == nameof(ZoomValue)).Throttle(TimeSpan.FromMilliseconds(100)).Subscribe(OnZoomValueChanged);//Sample
|
|
||||||
|
|
||||||
|
var zoomValueChangedSubscription = WhenPropertyChanged.Where(o => o.ToString() == nameof(ZoomValue)).Throttle(TimeSpan.FromMilliseconds(100)).Subscribe(OnZoomValueChanged);//Sample
|
||||||
|
this.PropertyChanged += DiagramViewModel_PropertyChanged;
|
||||||
BuildMenuOptions();
|
BuildMenuOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DiagramViewModel(DiagramItem diagramItem) : this()
|
public DiagramViewModel(DiagramItem diagramItem) : this()
|
||||||
{
|
{
|
||||||
DiagramType = diagramItem.DiagramType;
|
DiagramType = diagramItem.DiagramType;
|
||||||
@@ -1161,6 +1163,11 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 属性改变
|
#region 属性改变
|
||||||
|
protected virtual void DiagramViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void Items_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
|
private void Items_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.OldItems != null)
|
if (e.OldItems != null)
|
||||||
|
|||||||
@@ -416,20 +416,15 @@
|
|||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="外观" Height="30" Width="50">
|
<TabItem Header="外观" Height="30" Width="50">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<ComboBox x:Name="mindtype" dd:EnumHelper.Enum="{x:Type models:MindType}" SelectedItem="{Binding MindType, Mode=OneWay}" Style="{StaticResource FlatComboBoxStyle}">
|
<ComboBox x:Name="mindtype" dd:EnumHelper.Enum="{x:Type models:MindType}" SelectedItem="{Binding MindType}" Style="{StaticResource FlatComboBoxStyle}">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding .,Converter={StaticResource EnumDescriptionConverter}}" VerticalAlignment="Center" />
|
<TextBlock Text="{Binding .,Converter={StaticResource EnumDescriptionConverter}}" VerticalAlignment="Center" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ComboBox.ItemTemplate>
|
</ComboBox.ItemTemplate>
|
||||||
<i:Interaction.Triggers>
|
|
||||||
<i:EventTrigger EventName="SelectionChanged">
|
|
||||||
<i:InvokeCommandAction Command="{Binding ChangeMindTypeCommand}" CommandParameter="{Binding ElementName=mindtype,Path=SelectedItem}"/>
|
|
||||||
</i:EventTrigger>
|
|
||||||
</i:Interaction.Triggers>
|
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<Line Margin="2,0" X1="0" Y1="0" X2="0" Y2="100" StrokeDashArray="1" Stroke="Gray" StrokeThickness="1"></Line>
|
<Line Margin="2,0" X1="0" Y1="0" X2="0" Y2="100" StrokeDashArray="1" Stroke="Gray" StrokeThickness="1"></Line>
|
||||||
<ComboBox x:Name="mindtheme" dd:EnumHelper.Enum="{x:Type models:MindTheme}" SelectedItem="{Binding MindTheme, Mode=OneWay}" Style="{StaticResource FlatComboBox2ColumnStyle}">
|
<ComboBox x:Name="mindtheme" dd:EnumHelper.Enum="{x:Type models:MindTheme}" SelectedItem="{Binding MindTheme}" Style="{StaticResource FlatComboBox2ColumnStyle}">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Border CornerRadius="3" Background="{Binding .,Converter={StaticResource MindThemeFillBrushConverter}}" Padding="5">
|
<Border CornerRadius="3" Background="{Binding .,Converter={StaticResource MindThemeFillBrushConverter}}" Padding="5">
|
||||||
@@ -437,11 +432,6 @@
|
|||||||
</Border>
|
</Border>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ComboBox.ItemTemplate>
|
</ComboBox.ItemTemplate>
|
||||||
<i:Interaction.Triggers>
|
|
||||||
<i:EventTrigger EventName="SelectionChanged">
|
|
||||||
<i:InvokeCommandAction Command="{Binding ChangeMindThemeCommand}" CommandParameter="{Binding ElementName=mindtheme,Path=SelectedItem}"/>
|
|
||||||
</i:EventTrigger>
|
|
||||||
</i:Interaction.Triggers>
|
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<Line Margin="2,0" X1="0" Y1="0" X2="0" Y2="100" StrokeDashArray="1" Stroke="Gray" StrokeThickness="1"></Line>
|
<Line Margin="2,0" X1="0" Y1="0" X2="0" Y2="100" StrokeDashArray="1" Stroke="Gray" StrokeThickness="1"></Line>
|
||||||
<Button Style="{StaticResource FlatButtonStyle}" Command="{Binding ResetLayoutCommand}">
|
<Button Style="{StaticResource FlatButtonStyle}" Command="{Binding ResetLayoutCommand}">
|
||||||
|
|||||||
@@ -109,14 +109,6 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
}
|
}
|
||||||
ICommand ChangeMindTypeCommand
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
}
|
|
||||||
ICommand ChangeMindThemeCommand
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
}
|
|
||||||
ICommand ClearThemeCommand
|
ICommand ClearThemeCommand
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
|
|||||||
@@ -24,10 +24,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!SetProperty(ref _mindType, value))
|
SetProperty(ref _mindType, value);
|
||||||
{
|
|
||||||
RaisePropertyChanged(nameof(MindType));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,10 +37,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!SetProperty(ref _mindTheme, value))
|
SetProperty(ref _mindTheme, value);
|
||||||
{
|
|
||||||
RaisePropertyChanged(nameof(MindTheme));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,24 +304,6 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICommand _changeMindTypeCommand;
|
|
||||||
public ICommand ChangeMindTypeCommand
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return this._changeMindTypeCommand ?? (this._changeMindTypeCommand = new SimpleCommand(ExecuteEnable, this.ExecutedChangeMindTypeCommand));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ICommand _changeMindThemeCommand;
|
|
||||||
public ICommand ChangeMindThemeCommand
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return this._changeMindThemeCommand ?? (this._changeMindThemeCommand = new SimpleCommand(ExecuteEnable, this.ExecutedChangeMindThemeCommand));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ICommand _clearThemeCommand;
|
private ICommand _clearThemeCommand;
|
||||||
public ICommand ClearThemeCommand
|
public ICommand ClearThemeCommand
|
||||||
{
|
{
|
||||||
@@ -446,25 +422,40 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 属性改变
|
#region 属性改变
|
||||||
private bool isSelecting;
|
protected override void DiagramViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
base.DiagramViewModel_PropertyChanged(sender, e);
|
||||||
|
if (e.PropertyName == nameof(MindType))
|
||||||
|
{
|
||||||
|
if (e is ValuePropertyChangedEventArgs valuePropertyChangedEventArgs)
|
||||||
|
{
|
||||||
|
ChangeMindType((MindType)valuePropertyChangedEventArgs.OldValue, (MindType)valuePropertyChangedEventArgs.NewValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (e.PropertyName == nameof(MindTheme))
|
||||||
|
{
|
||||||
|
if (e is ValuePropertyChangedEventArgs valuePropertyChangedEventArgs)
|
||||||
|
{
|
||||||
|
ChangeMindTheme((MindTheme)valuePropertyChangedEventArgs.OldValue, (MindTheme)valuePropertyChangedEventArgs.NewValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Item_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
protected override void Item_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
base.Item_PropertyChanged(sender, e);
|
base.Item_PropertyChanged(sender, e);
|
||||||
if (e.PropertyName == "IsSelected")
|
if (e.PropertyName == "IsSelected")
|
||||||
{
|
{
|
||||||
isSelecting = true;
|
|
||||||
if (e is ValuePropertyChangedEventArgs valuePropertyChangedEventArgs)
|
if (e is ValuePropertyChangedEventArgs valuePropertyChangedEventArgs)
|
||||||
{
|
{
|
||||||
LinkInfo = new LinkInfo(MindSelectedItem?.LinkInfo);
|
LinkInfo = new LinkInfo(MindSelectedItem?.LinkInfo);
|
||||||
ImageInfo = new ImageInfo(MindSelectedItem?.ImageInfo);
|
ImageInfo = new ImageInfo(MindSelectedItem?.ImageInfo);
|
||||||
Remark = MindSelectedItem?.Remark;
|
Remark = MindSelectedItem?.Remark;
|
||||||
if (MindSelectedItem != null)
|
_mindType = MindSelectedItem?.MindType ?? RootItems.FirstOrDefault()?.MindType ?? MindType.Mind;
|
||||||
{
|
_mindTheme = MindSelectedItem?.MindTheme ?? RootItems.FirstOrDefault()?.MindTheme ?? MindTheme.SkyBlue;
|
||||||
MindType = MindSelectedItem.MindType;
|
RaisePropertyChanged(nameof(MindType));
|
||||||
MindTheme = MindSelectedItem.MindTheme;
|
RaisePropertyChanged(nameof(MindTheme));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
isSelecting = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -711,8 +702,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
{
|
{
|
||||||
List<MindNode> newitems = new List<MindNode>();
|
List<MindNode> newitems = new List<MindNode>();
|
||||||
DoCommandManager.DoNewCommand(this.ToString(),
|
DoCommandManager.DoNewCommand(this.ToString(),
|
||||||
() =>
|
() => {
|
||||||
{
|
|
||||||
var content = window.ContentString;
|
var content = window.ContentString;
|
||||||
var lines = content.Split(new string[] { "\n", "\r" }, StringSplitOptions.RemoveEmptyEntries);
|
var lines = content.Split(new string[] { "\n", "\r" }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
MindNode lastnode = node;
|
MindNode lastnode = node;
|
||||||
@@ -1087,76 +1077,79 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 改变模式,主题
|
#region 改变模式,主题
|
||||||
private void ExecutedChangeMindTypeCommand(object obj)
|
private void ChangeMindType(MindType oldMindType, MindType newMindType)
|
||||||
{
|
{
|
||||||
if (isSelecting) return;
|
List<MindNode> roots;
|
||||||
|
if (RootItems.Count == 1)//只有一个的时候
|
||||||
var oldMindType = MindType;
|
|
||||||
if (obj is MindType mindType && mindType != oldMindType)
|
|
||||||
{
|
{
|
||||||
var roots = MindSelectedItems.Select(p => p.RootNode).Distinct().ToList();
|
roots = RootItems.ToList();
|
||||||
if (roots.Count > 0)
|
}
|
||||||
{
|
else
|
||||||
DoCommandManager.DoNewCommand(this.ToString(),
|
{
|
||||||
() => {
|
roots = MindSelectedItems.Select(p => p.RootNode).Distinct().ToList();
|
||||||
roots.ForEach(p => p.MindType = mindType);
|
}
|
||||||
Items.OfType<MindNode>().ToList().ForEach(item => { item.InitLayout(true); });
|
|
||||||
Items.OfType<MindNode>().ToList().ForEach(item => { item.InitConnectionLayout(); });
|
if (roots.Count > 0)
|
||||||
roots.ForEach(p => p.UpdatedLayout());
|
{
|
||||||
},
|
DoCommandManager.DoNewCommand(this.ToString(),
|
||||||
() => {
|
() => {
|
||||||
roots.ForEach(p => p.MindType = oldMindType);
|
roots.ForEach(p => p.MindType = newMindType);
|
||||||
Items.OfType<MindNode>().ToList().ForEach(item => { item.InitLayout(true); });
|
roots.SelectMany(p => p.GetChildren(true)).ToList().ForEach(item => { item.InitLayout(true); });
|
||||||
Items.OfType<MindNode>().ToList().ForEach(item => { item.InitConnectionLayout(); });
|
roots.SelectMany(p => p.GetChildren(true)).ToList().ForEach(item => { item.InitConnectionLayout(); });
|
||||||
roots.ForEach(p => p.UpdatedLayout());
|
roots.ForEach(p => p.UpdatedLayout());
|
||||||
});
|
},
|
||||||
}
|
() => {
|
||||||
|
roots.ForEach(p => p.MindType = oldMindType);
|
||||||
|
roots.SelectMany(p => p.GetChildren(true)).ToList().ForEach(item => { item.InitLayout(true); });
|
||||||
|
roots.SelectMany(p => p.GetChildren(true)).ToList().ForEach(item => { item.InitConnectionLayout(); });
|
||||||
|
roots.ForEach(p => p.UpdatedLayout());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ChangeMindTheme(MindTheme oldMindTheme, MindTheme newMindTheme)
|
||||||
private void ExecutedChangeMindThemeCommand(object obj)
|
|
||||||
{
|
{
|
||||||
if (isSelecting) return;
|
List<MindNode> roots;
|
||||||
|
if (RootItems.Count == 1)//只有一个的时候
|
||||||
var oldmindTheme = MindTheme;
|
|
||||||
if (obj is MindTheme mindTheme && mindTheme != oldmindTheme)
|
|
||||||
{
|
{
|
||||||
var roots = MindSelectedItems.Select(p => p.RootNode).Distinct().ToList();
|
roots = RootItems.ToList();
|
||||||
if (roots.Count > 0)
|
}
|
||||||
{
|
else
|
||||||
DoCommandManager.DoNewCommand(this.ToString(),
|
{
|
||||||
() => {
|
roots = MindSelectedItems.Select(p => p.RootNode).Distinct().ToList();
|
||||||
var mindThemeModel = MindThemeHelper.GetTheme(mindTheme);
|
}
|
||||||
if (mindThemeModel?.Dark == true)
|
|
||||||
{
|
if (roots.Count > 0)
|
||||||
PageBackground = Colors.Black;
|
{
|
||||||
}
|
DoCommandManager.DoNewCommand(this.ToString(),
|
||||||
else
|
() => {
|
||||||
{
|
var mindThemeModel = MindThemeHelper.GetTheme(newMindTheme);
|
||||||
PageBackground = Colors.White;
|
if (mindThemeModel?.Dark == true)
|
||||||
}
|
{
|
||||||
MindTheme = mindTheme;
|
PageBackground = Colors.Black;
|
||||||
roots.ForEach(p => p.MindTheme = MindTheme);
|
}
|
||||||
roots.SelectMany(p => p.GetChildren(true)).ToList().ForEach(item => { item.ThemeChange(); });
|
else
|
||||||
roots.ForEach(p => p.UpdatedLayout());
|
{
|
||||||
},
|
PageBackground = Colors.White;
|
||||||
() => {
|
}
|
||||||
var mindThemeModel = MindThemeHelper.GetTheme(oldmindTheme);
|
roots.ForEach(p => p.MindTheme = newMindTheme);
|
||||||
if (mindThemeModel?.Dark == true)
|
roots.SelectMany(p => p.GetChildren(true)).ToList().ForEach(item => { item.ThemeChange(); });
|
||||||
{
|
roots.ForEach(p => p.UpdatedLayout());
|
||||||
PageBackground = Colors.Black;
|
},
|
||||||
}
|
() => {
|
||||||
else
|
var mindThemeModel = MindThemeHelper.GetTheme(oldMindTheme);
|
||||||
{
|
if (mindThemeModel?.Dark == true)
|
||||||
PageBackground = Colors.White;
|
{
|
||||||
}
|
PageBackground = Colors.Black;
|
||||||
MindTheme = oldmindTheme;
|
}
|
||||||
roots.ForEach(p => p.MindTheme = MindTheme);
|
else
|
||||||
roots.SelectMany(p => p.GetChildren(true)).ToList().ForEach(item => { item.ThemeChange(); });
|
{
|
||||||
roots.ForEach(p => p.UpdatedLayout());
|
PageBackground = Colors.White;
|
||||||
});
|
}
|
||||||
}
|
roots.ForEach(p => p.MindTheme = oldMindTheme);
|
||||||
|
roots.SelectMany(p => p.GetChildren(true)).ToList().ForEach(item => { item.ThemeChange(); });
|
||||||
|
roots.ForEach(p => p.UpdatedLayout());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
EnabledForConnection = false;
|
EnabledForConnection = false;
|
||||||
AlwayForResized = true;
|
AlwayForResized = true;
|
||||||
CustomText = true;
|
CustomText = true;
|
||||||
|
IsInnerConnector = true;
|
||||||
|
|
||||||
AddChildCommand = (Root as IMindDiagramViewModel)?.AddChildCommand;
|
AddChildCommand = (Root as IMindDiagramViewModel)?.AddChildCommand;
|
||||||
AddParentCommand = (Root as IMindDiagramViewModel)?.AddParentCommand;
|
AddParentCommand = (Root as IMindDiagramViewModel)?.AddParentCommand;
|
||||||
@@ -101,7 +102,6 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
MindLayout = layout != null ? (System.Activator.CreateInstance(layout) as IMindLayout) : new MindLayout();
|
MindLayout = layout != null ? (System.Activator.CreateInstance(layout) as IMindLayout) : new MindLayout();
|
||||||
|
|
||||||
this.PropertyChanged -= this.Item_PropertyChanged;
|
this.PropertyChanged -= this.Item_PropertyChanged;
|
||||||
IsInnerConnector = true;
|
|
||||||
MindLayout.Appearance(this, MindTheme, initAppearance);
|
MindLayout.Appearance(this, MindTheme, initAppearance);
|
||||||
this.PropertyChanged += this.Item_PropertyChanged;
|
this.PropertyChanged += this.Item_PropertyChanged;
|
||||||
}
|
}
|
||||||
@@ -348,6 +348,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
}
|
}
|
||||||
|
|
||||||
private string _remark;
|
private string _remark;
|
||||||
|
[Browsable(true)]
|
||||||
public string Remark
|
public string Remark
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|||||||
Reference in New Issue
Block a user