可以切换主题

This commit is contained in:
艾竹
2023-03-11 22:27:23 +08:00
parent 84f413320f
commit fb7858fe74
22 changed files with 1061 additions and 208 deletions

View File

@@ -63,16 +63,16 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
} }
} }
private PageViewModel _diagramsViewModel; private PageViewModel _pageViewModel;
public PageViewModel PageViewModel public PageViewModel PageViewModel
{ {
get get
{ {
return _diagramsViewModel; return _pageViewModel;
} }
set set
{ {
SetProperty(ref _diagramsViewModel, value); SetProperty(ref _pageViewModel, value);
} }
} }

View File

@@ -26,7 +26,7 @@ namespace AIStudio.Wpf.Flowchart
{ {
foreach (var vm in DiagramViewModels) foreach (var vm in DiagramViewModels)
{ {
vm.InitLayoutCommand.Execute(null); vm.Init();
} }
} }

View File

@@ -163,7 +163,7 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
{ {
_service.SelectedItems = DiagramViewModel?.SelectedItems; _service.SelectedItems = DiagramViewModel?.SelectedItems;
_service.SelectedItem = DiagramViewModel?.SelectedItems?.FirstOrDefault(); _service.SelectedItem = DiagramViewModel?.SelectedItem;
} }
var property = sender.GetType().GetProperty(e.PropertyName); var property = sender.GetType().GetProperty(e.PropertyName);

View File

@@ -114,13 +114,13 @@ namespace AIStudio.Wpf.DiagramDesigner
} }
} }
private DrawModeViewModel _drawModeViewModel; private IDrawModeViewModel _drawModeViewModel;
public IDrawModeViewModel DrawModeViewModel public IDrawModeViewModel DrawModeViewModel
{ {
get { return _drawModeViewModel; } get { return _drawModeViewModel; }
} }
private QuickThemeViewModel _quickThemeViewModel; private IQuickThemeViewModel _quickThemeViewModel;
public IQuickThemeViewModel QuickThemeViewModel public IQuickThemeViewModel QuickThemeViewModel
{ {
get { return _quickThemeViewModel; } get { return _quickThemeViewModel; }

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Text; using System.Text;
namespace AIStudio.Wpf.DiagramDesigner namespace AIStudio.Wpf.DiagramDesigner
@@ -34,5 +35,6 @@ namespace AIStudio.Wpf.DiagramDesigner
{ {
get; set; get; set;
} }
event PropertyChangedEventHandler PropertyChanged;
} }
} }

View File

@@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Text; using System.Text;
namespace AIStudio.Wpf.DiagramDesigner namespace AIStudio.Wpf.DiagramDesigner
@@ -8,5 +9,7 @@ namespace AIStudio.Wpf.DiagramDesigner
{ {
QuickTheme[] QuickThemes { get; } QuickTheme[] QuickThemes { get; }
QuickTheme QuickTheme { get; set; } QuickTheme QuickTheme { get; set; }
event PropertyChangedEventHandler PropertyChanged;
} }
} }

View File

@@ -739,7 +739,7 @@ namespace AIStudio.Wpf.DiagramDesigner
} }
private SimpleCommand _selectAllCommand; private SimpleCommand _selectAllCommand;
public SimpleCommand SelectAllCommand public virtual SimpleCommand SelectAllCommand
{ {
get get
{ {
@@ -747,6 +747,15 @@ namespace AIStudio.Wpf.DiagramDesigner
} }
} }
private SimpleCommand _selectInverseCommand;
public virtual SimpleCommand SelectInverseCommand
{
get
{
return this._selectInverseCommand ?? (this._selectInverseCommand = new SimpleCommand(ExecuteEnable, ExecuteSelectInverseCommand));
}
}
private SimpleCommand _selectItemCommand; private SimpleCommand _selectItemCommand;
public SimpleCommand SelectItemCommand public SimpleCommand SelectItemCommand
{ {
@@ -936,15 +945,6 @@ namespace AIStudio.Wpf.DiagramDesigner
} }
} }
private SimpleCommand _initLayoutCommand;
public SimpleCommand InitLayoutCommand
{
get
{
return this._initLayoutCommand ?? (this._initLayoutCommand = new SimpleCommand(ExecuteEnable, this.ExecutedInitLayoutCommand));
}
}
private SimpleCommand _resetLayoutCommand; private SimpleCommand _resetLayoutCommand;
public SimpleCommand ResetLayoutCommand public SimpleCommand ResetLayoutCommand
{ {
@@ -1061,12 +1061,6 @@ namespace AIStudio.Wpf.DiagramDesigner
} }
#endregion #endregion
protected virtual void ExecutedInitLayoutCommand(object obj)
{
throw new NotImplementedException();
}
protected virtual void ExecutedResetLayoutCommand(object obj) protected virtual void ExecutedResetLayoutCommand(object obj)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
@@ -1096,9 +1090,13 @@ namespace AIStudio.Wpf.DiagramDesigner
private void Item_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) private void Item_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{ {
RaisePropertyChanged(sender, e.PropertyName); RaisePropertyChanged(sender, e.PropertyName);
if (e.PropertyName == "IsSelected")
{
RaisePropertyChanged(nameof(SelectedItem));
}
//连续改变需要特殊处理不单独触发属性改变ReDo //连续改变需要特殊处理不单独触发属性改变ReDo
if (sender is DesignerItemViewModelBase designer) if (sender is DesignerItemViewModelBase designer)
{ {
if (designer.BeginDo) return; if (designer.BeginDo) return;
} }
@@ -1308,6 +1306,18 @@ namespace AIStudio.Wpf.DiagramDesigner
} }
} }
private void ExecuteSelectInverseCommand(object parameter)
{
foreach (var item in SelectedItems)
{
item.IsSelected = false;
}
foreach (var item in Items.Except(SelectedItems))
{
item.IsSelected = true;
}
}
public void ExecuteSelectItemCommand(object parameter) public void ExecuteSelectItemCommand(object parameter)
{ {
if (parameter is ISelectable selectable) if (parameter is ISelectable selectable)
@@ -2099,6 +2109,29 @@ namespace AIStudio.Wpf.DiagramDesigner
Delete(parameter); Delete(parameter);
} }
protected void ExecuteSelectBrotherCommand(object parameter)
{
}
protected void ExecuteSelectPearCommand(object parameter)
{
}
protected void ExecuteSelectRouteCommand(object parameter)
{
}
protected void ExecuteSelectChildCommand(object parameter)
{
}
protected virtual bool Delete(object parameter) protected virtual bool Delete(object parameter)
{ {
List<SelectableDesignerItemViewModelBase> itemsToRemove; List<SelectableDesignerItemViewModelBase> itemsToRemove;

View File

@@ -108,6 +108,10 @@ namespace AIStudio.Wpf.DiagramDesigner
{ {
get; get;
} }
SimpleCommand SelectInverseCommand
{
get;
}
SimpleCommand SelectItemCommand SimpleCommand SelectItemCommand
{ {
get; get;
@@ -194,10 +198,6 @@ namespace AIStudio.Wpf.DiagramDesigner
{ {
get; get;
} }
SimpleCommand InitLayoutCommand
{
get;
}
SimpleCommand ResetLayoutCommand SimpleCommand ResetLayoutCommand
{ {

View File

@@ -40,6 +40,7 @@ namespace AIStudio.Wpf.Mind.Controls
_diagramViewModel.GridMarginSize = new Size(0, 0); _diagramViewModel.GridMarginSize = new Size(0, 0);
_diagramViewModel.PageSizeType = PageSizeType.Custom; _diagramViewModel.PageSizeType = PageSizeType.Custom;
_diagramViewModel.PageSize = new SizeBase(1000d, 1000d); _diagramViewModel.PageSize = new SizeBase(1000d, 1000d);
_diagramViewModel.ShowGrid= false;
_diagramViewModel.DefaultZoomBox = true; _diagramViewModel.DefaultZoomBox = true;
_diagramViewModel.PropertyChanged += DiagramViewModel_PropertyChanged; _diagramViewModel.PropertyChanged += DiagramViewModel_PropertyChanged;

View File

@@ -11,6 +11,7 @@
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Styles/Button.xaml" /> <ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Styles/Button.xaml" />
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Styles/ToggleButton.xaml" />
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Controls/DropDownButton.xaml" /> <ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Controls/DropDownButton.xaml" />
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>
@@ -66,7 +67,7 @@
<TextBlock>插入上级主题</TextBlock> <TextBlock>插入上级主题</TextBlock>
</StackPanel> </StackPanel>
</Button> </Button>
<Button Style="{StaticResource FlatButtonStyle}" Command="{Binding AddPeerCommand}"> <Button Style="{StaticResource FlatButtonStyle}" Command="{Binding AddPearCommand}">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<Path Width="12" Height="12" Stretch="Uniform" Fill="Black" Data="M651.8 775.5h-20.3v-527h178V305c0 19.3 15.7 35 35 35s35-15.7 35-35v-91.5c0-19.3-15.7-35-35-35h-248c-19.3 0-35 15.7-35 35V477H340.8V236.1c0-32-26-58-58-58H58c-32 0-58 26-58 58v551.8c0 32 26 58 58 58h224.8c32 0 58-26 58-58V547h220.7v263.5c0 19.3 15.7 35 35 35h55.3c19.3 0 35-15.7 35-35s-15.7-35-35-35z m-381 0.4H70V248.1h200.8v527.8zM990 651.5h-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> <Path Width="12" Height="12" Stretch="Uniform" Fill="Black" Data="M651.8 775.5h-20.3v-527h178V305c0 19.3 15.7 35 35 35s35-15.7 35-35v-91.5c0-19.3-15.7-35-35-35h-248c-19.3 0-35 15.7-35 35V477H340.8V236.1c0-32-26-58-58-58H58c-32 0-58 26-58 58v551.8c0 32 26 58 58 58h224.8c32 0 58-26 58-58V547h220.7v263.5c0 19.3 15.7 35 35 35h55.3c19.3 0 35-15.7 35-35s-15.7-35-35-35z m-381 0.4H70V248.1h200.8v527.8zM990 651.5h-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> <TextBlock>插入同级主题</TextBlock>
@@ -382,7 +383,7 @@
<Line Grid.Column="1" X1="0" Y1="0" X2="0" Y2="100" StrokeDashArray="1" Stroke="Gray" StrokeThickness="1"></Line> <Line Grid.Column="1" X1="0" Y1="0" X2="0" Y2="100" StrokeDashArray="1" Stroke="Gray" StrokeThickness="1"></Line>
<controls:DropDownButton Grid.Column="2"> <controls:DropDownButton Grid.Column="2">
<controls:DropDownButton.Content> <controls:DropDownButton.Content>
<StackPanel> <StackPanel>
<TextBlock>主题</TextBlock> <TextBlock>主题</TextBlock>
</StackPanel> </StackPanel>
</controls:DropDownButton.Content> </controls:DropDownButton.Content>
@@ -394,22 +395,22 @@
<controls:DropDownButton.Items> <controls:DropDownButton.Items>
<MenuItem Header="天空蓝" Background="#73a1bf" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="SkyBlue"/> <MenuItem Header="天空蓝" Background="#73a1bf" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="SkyBlue"/>
<MenuItem Header="紧凑蓝" Background="#73a1bf" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="SkyBlueMini"/> <MenuItem Header="紧凑蓝" Background="#73a1bf" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="SkyBlueMini"/>
<MenuItem Header="文艺绿" Background="#73bf76" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="SkyBlue"/> <MenuItem Header="文艺绿" Background="#73bf76" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="LiteratureGreen"/>
<MenuItem Header="紧凑绿" Background="#73bf76" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="SkyBlueMini"/> <MenuItem Header="紧凑绿" Background="#73bf76" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="LiteratureGreenMini"/>
<MenuItem Header="脑残粉" Background="#bf7394" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="SkyBlue"/> <MenuItem Header="脑残粉" Background="#bf7394" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="BrainDeadPink"/>
<MenuItem Header="紧凑粉" Background="#bf7394" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="SkyBlueMini"/> <MenuItem Header="紧凑粉" Background="#bf7394" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="BrainDeadPinkMini"/>
<MenuItem Header="浪漫紫" Background="#7b73bf" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="SkyBlue"/> <MenuItem Header="浪漫紫" Background="#7b73bf" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="RomanticPurple"/>
<MenuItem Header="紧凑紫" Background="#7b73bf" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="SkyBlueMini"/> <MenuItem Header="紧凑紫" Background="#7b73bf" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="RomanticPurpleMini"/>
<MenuItem Header="清新红" Background="#bf7373" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="SkyBlue"/> <MenuItem Header="清新红" Background="#bf7373" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="FreshRed"/>
<MenuItem Header="紧凑红" Background="#bf7373" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="SkyBlueMini"/> <MenuItem Header="紧凑红" Background="#bf7373" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="FreshRedMini"/>
<MenuItem Header="泥土黄" Background="#bf9373" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="SkyBlue"/> <MenuItem Header="泥土黄" Background="#bf9373" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="EarthyYellow"/>
<MenuItem Header="紧凑黄" Background="#bf9373" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="SkyBlueMini"/> <MenuItem Header="紧凑黄" Background="#bf9373" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="EarthyYellowMini"/>
<MenuItem Header="冷光黄" Background="#e9df98" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="SkyBlue"/> <MenuItem Header="冷光黄" Background="#e9df98" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="CoolLightYellow"/>
<MenuItem Header="紧凑黄" Background="#e9df98" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="SkyBlueMini"/> <MenuItem Header="紧凑黄" Background="#e9df98" Margin="1.5" Command="{Binding ChangeMindThemeCommand}" CommandParameter="CoolLightYellowMini"/>
</controls:DropDownButton.Items> </controls:DropDownButton.Items>
</controls:DropDownButton> </controls:DropDownButton>
<Line Grid.Column="3" X1="0" Y1="0" X2="0" Y2="100" StrokeDashArray="1" Stroke="Gray" StrokeThickness="1"></Line> <Line Grid.Column="3" X1="0" Y1="0" X2="0" Y2="100" StrokeDashArray="1" Stroke="Gray" StrokeThickness="1"></Line>
<Button Style="{StaticResource FlatButtonStyle}" Grid.Column="4" Command="{Binding AddChildCommand}"> <Button Style="{StaticResource FlatButtonStyle}" Grid.Column="4" Command="{Binding ResetLayoutCommand}">
<StackPanel> <StackPanel>
<Path Width="18" Height="18" Stretch="Uniform" Fill="Black" Data="M358.4 0a102.4 102.4 0 0 1 102.4 102.4v819.2a102.4 102.4 0 0 1-102.4 102.4H102.4a102.4 102.4 0 0 1-102.4-102.4V102.4a102.4 102.4 0 0 1 102.4-102.4h256z m0 76.8H102.4a25.6 25.6 0 0 0-25.1904 20.992L76.8 102.4v819.2a25.6 25.6 0 0 0 20.992 25.1904L102.4 947.2h256a25.6 25.6 0 0 0 25.1904-20.992L384 921.6V102.4a25.6 25.6 0 0 0-20.992-25.1904L358.4 76.8z m268.288 547.84a38.4 38.4 0 0 1 50.1248-1.8432l4.1472 3.8912a38.4 38.4 0 0 1 1.8432 50.1248L630.272 742.4h333.7216l4.6592 0.3584c16.7936 2.56 29.696 18.5856 29.696 38.0416 0 21.1968-15.36 38.4-34.3552 38.4h-333.6704l52.4288 65.6384 3.2256 4.6592a38.4 38.4 0 0 1-63.232 43.3152l-102.4-128-3.328-4.9152a38.4 38.4 0 0 1 3.328-43.0592l102.4-128zM921.6 0a102.4 102.4 0 0 1 102.4 102.4v256a102.4 102.4 0 0 1-102.4 102.4h-256a102.4 102.4 0 0 1-102.4-102.4V102.4a102.4 102.4 0 0 1 102.4-102.4h256z m0 76.8h-256a25.6 25.6 0 0 0-25.1904 20.992L640 102.4v256a25.6 25.6 0 0 0 20.992 25.1904L665.6 384h256a25.6 25.6 0 0 0 25.1904-20.992L947.2 358.4V102.4a25.6 25.6 0 0 0-20.992-25.1904L921.6 76.8z"></Path> <Path Width="18" Height="18" Stretch="Uniform" Fill="Black" Data="M358.4 0a102.4 102.4 0 0 1 102.4 102.4v819.2a102.4 102.4 0 0 1-102.4 102.4H102.4a102.4 102.4 0 0 1-102.4-102.4V102.4a102.4 102.4 0 0 1 102.4-102.4h256z m0 76.8H102.4a25.6 25.6 0 0 0-25.1904 20.992L76.8 102.4v819.2a25.6 25.6 0 0 0 20.992 25.1904L102.4 947.2h256a25.6 25.6 0 0 0 25.1904-20.992L384 921.6V102.4a25.6 25.6 0 0 0-20.992-25.1904L358.4 76.8z m268.288 547.84a38.4 38.4 0 0 1 50.1248-1.8432l4.1472 3.8912a38.4 38.4 0 0 1 1.8432 50.1248L630.272 742.4h333.7216l4.6592 0.3584c16.7936 2.56 29.696 18.5856 29.696 38.0416 0 21.1968-15.36 38.4-34.3552 38.4h-333.6704l52.4288 65.6384 3.2256 4.6592a38.4 38.4 0 0 1-63.232 43.3152l-102.4-128-3.328-4.9152a38.4 38.4 0 0 1 3.328-43.0592l102.4-128zM921.6 0a102.4 102.4 0 0 1 102.4 102.4v256a102.4 102.4 0 0 1-102.4 102.4h-256a102.4 102.4 0 0 1-102.4-102.4V102.4a102.4 102.4 0 0 1 102.4-102.4h256z m0 76.8h-256a25.6 25.6 0 0 0-25.1904 20.992L640 102.4v256a25.6 25.6 0 0 0 20.992 25.1904L665.6 384h256a25.6 25.6 0 0 0 25.1904-20.992L947.2 358.4V102.4a25.6 25.6 0 0 0-20.992-25.1904L921.6 76.8z"></Path>
<TextBlock>整理布局</TextBlock> <TextBlock>整理布局</TextBlock>
@@ -445,7 +446,7 @@
</Button> </Button>
</Grid> </Grid>
<Line Grid.Column="7" X1="0" Y1="0" X2="0" Y2="100" StrokeDashArray="1" Stroke="Gray" StrokeThickness="1"></Line> <Line Grid.Column="7" X1="0" Y1="0" X2="0" Y2="100" StrokeDashArray="1" Stroke="Gray" StrokeThickness="1"></Line>
<Grid Grid.Column="8"> <Grid Grid.Column="8" DataContext="{Binding SelectedItem.FontViewModel}">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition/> <RowDefinition/>
<RowDefinition/> <RowDefinition/>
@@ -465,7 +466,7 @@
FontFamily="{Binding}" /> FontFamily="{Binding}" />
</DataTemplate> </DataTemplate>
</ComboBox.ItemTemplate> </ComboBox.ItemTemplate>
</ComboBox> </ComboBox>
<ComboBox x:Name="comboBoxFontSize" <ComboBox x:Name="comboBoxFontSize"
Width="49" Width="49"
HorizontalAlignment="Left" HorizontalAlignment="Left"
@@ -482,11 +483,13 @@
</ComboBox> </ComboBox>
</StackPanel> </StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal"> <StackPanel Grid.Row="1" Orientation="Horizontal">
<ToggleButton x:Name="buttonBold" <ToggleButton x:Name="buttonBold" Style="{StaticResource FlatToggleButtonStyle}" Width="18" Height="18"
IsChecked="{Binding FontWeight,Converter={dd:ConverterValueMapToBool Parameter='Regular'}, ConverterParameter='Bold'}"> IsChecked="{Binding FontWeight,Converter={dd:ConverterValueMapToBool Parameter='Regular'}, ConverterParameter='Bold'}">
</ToggleButton> <Path Stretch="Uniform" Margin="2" Fill="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton}, Path=Foreground}" Data="M214 80Q266 80 299 107 331 134 331 176 331 201 320 222 308 243 291 251L291 253Q319 262 336 284 352 306 352 335 352 377 321 405 290 432 242 432L64 432 64 80 214 80ZM218 224Q239 224 253 211 267 198 267 180 267 164 254 154 240 144 218 144L128 144 128 224 218 224ZM236 368Q258 368 273 357 288 345 288 328 288 309 274 299 259 288 236 288L128 288 128 368 236 368Z"></Path>
<ToggleButton x:Name="buttonItalic" </ToggleButton>
<ToggleButton x:Name="buttonItalic" Style="{StaticResource FlatToggleButtonStyle}" Width="18" Height="18"
IsChecked="{Binding FontStyle,Converter={dd:ConverterValueMapToBool Parameter='Normal'}, ConverterParameter='Italic'}"> IsChecked="{Binding FontStyle,Converter={dd:ConverterValueMapToBool Parameter='Normal'}, ConverterParameter='Italic'}">
<Path Stretch="Uniform" Margin="2" Fill="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton}, Path=Foreground}" Data="M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"></Path>
</ToggleButton> </ToggleButton>
</StackPanel> </StackPanel>
</Grid> </Grid>
@@ -532,12 +535,13 @@
</StackPanel> </StackPanel>
</controls:DropDownButton.Content> </controls:DropDownButton.Content>
<controls:DropDownButton.Items> <controls:DropDownButton.Items>
<MenuItem Header="选" IsCheckable="True" Command="{Binding Expand2Level1Command}" /> <MenuItem Header="选" IsCheckable="True" Command="{Binding SelectAllCommand}" />
<MenuItem Header="选择兄弟节点" IsCheckable="True" Command="{Binding Expand2Level2Command}" /> <MenuItem Header="选" IsCheckable="True" Command="{Binding SelectInverseCommand}" />
<MenuItem Header="选择同级节点" IsCheckable="True" Command="{Binding Expand2Level3Command}" /> <MenuItem Header="选择兄弟节点" IsCheckable="True" Command="{Binding SelectBrotherCommand}" />
<MenuItem Header="选择路径" IsCheckable="True" Command="{Binding Expand2Level4Command}" /> <MenuItem Header="选择同级节点" IsCheckable="True" Command="{Binding SelectPearCommand}" />
<MenuItem Header="选择子树" IsCheckable="True" Command="{Binding Expand2Level5Command}" /> <MenuItem Header="选择路径" IsCheckable="True" Command="{Binding SelectRouteCommand}" />
</controls:DropDownButton.Items> <MenuItem Header="选择子树" IsCheckable="True" Command="{Binding SelectChildCommand}" />
</controls:DropDownButton.Items>
</controls:DropDownButton> </controls:DropDownButton>
<Button Style="{StaticResource FlatButtonStyle}" Grid.Column="3" Command="{Binding AddChildCommand}"> <Button Style="{StaticResource FlatButtonStyle}" Grid.Column="3" Command="{Binding AddChildCommand}">
<StackPanel> <StackPanel>

View File

@@ -13,7 +13,12 @@ namespace AIStudio.Wpf.Mind.Helpers
{ {
public class DirectoryLayout : IMindLayout public class DirectoryLayout : IMindLayout
{ {
public void Appearance(MindNode mindNode, bool initAppearance) public void Appearance(MindNode mindNode)
{
Appearance(mindNode, null, false);
}
public void Appearance(MindNode mindNode, MindThemeModel mindThemeModel, bool initAppearance)
{ {
switch (mindNode.NodeLevel) switch (mindNode.NodeLevel)
{ {
@@ -21,18 +26,13 @@ namespace AIStudio.Wpf.Mind.Helpers
{ {
if (initAppearance) if (initAppearance)
{ {
mindNode.ItemWidth = 110; MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
mindNode.ItemHeight = 40;
mindNode.ClearConnectors();
mindNode.ClearConnectors();
var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.5, YRatio = 1 }; var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.5, YRatio = 1 };
mindNode.AddConnector(port); mindNode.AddConnector(port);
mindNode.ColorViewModel.FillColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
mindNode.FontViewModel.FontColor = Colors.White;
mindNode.FontViewModel.FontSize = 15;
} }
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None; mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall; mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
mindNode.ConnectorOrientation = ConnectorOrientation.None; mindNode.ConnectorOrientation = ConnectorOrientation.None;
@@ -42,15 +42,13 @@ namespace AIStudio.Wpf.Mind.Helpers
{ {
if (initAppearance) if (initAppearance)
{ {
mindNode.ItemWidth = 80; MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
mindNode.ItemHeight = 25;
mindNode.ClearConnectors(); mindNode.ClearConnectors();
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Top, true) { XRatio = 0.5, YRatio = 0 }; var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Top, true) { XRatio = 0.5, YRatio = 0 };
mindNode.AddConnector(port1); mindNode.AddConnector(port1);
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.25, YRatio = 1 }; var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.25, YRatio = 1 };
mindNode.AddConnector(port2); mindNode.AddConnector(port2);
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
} }
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None; mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall; mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
@@ -61,10 +59,9 @@ namespace AIStudio.Wpf.Mind.Helpers
{ {
if (initAppearance) if (initAppearance)
{ {
mindNode.ItemWidth = 80; MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
mindNode.ItemHeight = 25;
mindNode.ClearConnectors();
mindNode.ClearConnectors();
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 }; var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
mindNode.AddConnector(port1); mindNode.AddConnector(port1);
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.25, YRatio = 1 }; var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.25, YRatio = 1 };
@@ -72,8 +69,6 @@ namespace AIStudio.Wpf.Mind.Helpers
mindNode.CornerRadius = new System.Windows.CornerRadius(0); mindNode.CornerRadius = new System.Windows.CornerRadius(0);
mindNode.BorderThickness = new System.Windows.Thickness(0, 0, 0, 0); mindNode.BorderThickness = new System.Windows.Thickness(0, 0, 0, 0);
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
} }
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None; mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall; mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
@@ -81,7 +76,7 @@ namespace AIStudio.Wpf.Mind.Helpers
break; break;
} }
} }
} }
public ConnectionViewModel GetOrSetConnectionViewModel(MindNode source, MindNode sink, ConnectionViewModel connector = null) public ConnectionViewModel GetOrSetConnectionViewModel(MindNode source, MindNode sink, ConnectionViewModel connector = null)
{ {

View File

@@ -13,7 +13,12 @@ namespace AIStudio.Wpf.Mind.Helpers
{ {
public class FishBoneLayout : IMindLayout public class FishBoneLayout : IMindLayout
{ {
public void Appearance(MindNode mindNode, bool initAppearance) public void Appearance(MindNode mindNode)
{
Appearance(mindNode, null, false);
}
public void Appearance(MindNode mindNode, MindThemeModel mindThemeModel, bool initAppearance)
{ {
if (mindNode == null) return; if (mindNode == null) return;
@@ -25,18 +30,11 @@ namespace AIStudio.Wpf.Mind.Helpers
{ {
if (initAppearance) if (initAppearance)
{ {
mindNode.ItemWidth = 110; MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
mindNode.ItemHeight = 40;
mindNode.ClearConnectors();
mindNode.ClearConnectors();
var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 0.5 }; var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 0.5 };
mindNode.AddConnector(port); mindNode.AddConnector(port);
mindNode.ColorViewModel.FillColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
mindNode.FontViewModel.FontColor = Colors.White;
mindNode.FontViewModel.FontSize = 15;
mindNode.Spacing = new SizeBase(50, 15);
} }
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None; mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall; mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
@@ -47,17 +45,13 @@ namespace AIStudio.Wpf.Mind.Helpers
{ {
if (initAppearance) if (initAppearance)
{ {
mindNode.ItemWidth = 80; MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
mindNode.ItemHeight = 25;
mindNode.ClearConnectors();
mindNode.ClearConnectors();
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.BottomLeft, true) { XRatio = 0, YRatio = 1 }; var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.BottomLeft, true) { XRatio = 0, YRatio = 1 };
mindNode.AddConnector(port1); mindNode.AddConnector(port1);
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.TopLeft, true) { XRatio = 0, YRatio = 0 }; var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.TopLeft, true) { XRatio = 0, YRatio = 0 };
mindNode.AddConnector(port2); mindNode.AddConnector(port2);
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
} }
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None; mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
@@ -69,10 +63,9 @@ namespace AIStudio.Wpf.Mind.Helpers
{ {
if (initAppearance) if (initAppearance)
{ {
mindNode.ItemWidth = 80; MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
mindNode.ItemHeight = 25;
mindNode.ClearConnectors();
mindNode.ClearConnectors();
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 }; var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
mindNode.AddConnector(port1); mindNode.AddConnector(port1);
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.25, YRatio = 1 }; var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.25, YRatio = 1 };
@@ -81,10 +74,7 @@ namespace AIStudio.Wpf.Mind.Helpers
mindNode.AddConnector(port3); mindNode.AddConnector(port3);
mindNode.CornerRadius = new System.Windows.CornerRadius(0); mindNode.CornerRadius = new System.Windows.CornerRadius(0);
mindNode.BorderThickness = new System.Windows.Thickness(0, 0, 0, 0); mindNode.BorderThickness = new System.Windows.Thickness(0, 0, 0, 0);
mindNode.ColorViewModel.FillColor.Color = Colors.Transparent;
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
} }
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None; mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall; mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Windows.Media;
using AIStudio.Wpf.DiagramDesigner; using AIStudio.Wpf.DiagramDesigner;
using AIStudio.Wpf.Mind.ViewModels; using AIStudio.Wpf.Mind.ViewModels;
@@ -8,7 +9,8 @@ namespace AIStudio.Wpf.Mind.Helpers
{ {
public interface IMindLayout public interface IMindLayout
{ {
void Appearance(MindNode mindNode, bool initAppearance); void Appearance(MindNode mindNode);
void Appearance(MindNode mindNode, MindThemeModel mindThemeModel, bool initAppearance);
ConnectionViewModel GetOrSetConnectionViewModel(MindNode source, MindNode sink, ConnectionViewModel connector = null); ConnectionViewModel GetOrSetConnectionViewModel(MindNode source, MindNode sink, ConnectionViewModel connector = null);
void LayoutUpdated(MindNode mindNode); void LayoutUpdated(MindNode mindNode);

View File

@@ -13,7 +13,12 @@ namespace AIStudio.Wpf.Mind.Helpers
{ {
public class LogicalLayout : IMindLayout public class LogicalLayout : IMindLayout
{ {
public void Appearance(MindNode mindNode, bool initAppearance) public void Appearance(MindNode mindNode)
{
Appearance(mindNode, null, false);
}
public void Appearance(MindNode mindNode, MindThemeModel mindThemeModel, bool initAppearance)
{ {
switch (mindNode.NodeLevel) switch (mindNode.NodeLevel)
{ {
@@ -21,18 +26,11 @@ namespace AIStudio.Wpf.Mind.Helpers
{ {
if (initAppearance) if (initAppearance)
{ {
mindNode.ItemWidth = 110; MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
mindNode.ItemHeight = 40;
mindNode.ClearConnectors();
mindNode.ClearConnectors();
var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.None, true) { XRatio = 0.5, YRatio = 0.5 }; var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.None, true) { XRatio = 0.5, YRatio = 0.5 };
mindNode.AddConnector(port); mindNode.AddConnector(port);
mindNode.ColorViewModel.FillColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
mindNode.FontViewModel.FontColor = Colors.White;
mindNode.FontViewModel.FontSize = 15;
mindNode.Spacing = new SizeBase(50, 15);
} }
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.Circle; mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.Circle;
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall; mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
@@ -43,15 +41,13 @@ namespace AIStudio.Wpf.Mind.Helpers
{ {
if (initAppearance) if (initAppearance)
{ {
mindNode.ItemWidth = 80; MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
mindNode.ItemHeight = 25;
mindNode.ClearConnectors(); mindNode.ClearConnectors();
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 }; var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
mindNode.AddConnector(port1); mindNode.AddConnector(port1);
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 0.5 }; var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 0.5 };
mindNode.AddConnector(port2); mindNode.AddConnector(port2);
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
} }
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None; mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall; mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
@@ -62,10 +58,9 @@ namespace AIStudio.Wpf.Mind.Helpers
{ {
if (initAppearance) if (initAppearance)
{ {
mindNode.ItemWidth = 80; MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
mindNode.ItemHeight = 25;
mindNode.ClearConnectors();
mindNode.ClearConnectors();
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 1 }; var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 1 };
mindNode.AddConnector(port1); mindNode.AddConnector(port1);
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 1 }; var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 1 };
@@ -73,8 +68,6 @@ namespace AIStudio.Wpf.Mind.Helpers
mindNode.CornerRadius = new System.Windows.CornerRadius(0); mindNode.CornerRadius = new System.Windows.CornerRadius(0);
mindNode.BorderThickness = new System.Windows.Thickness(0, 0, 0, 1); mindNode.BorderThickness = new System.Windows.Thickness(0, 0, 0, 1);
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
} }
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None; mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall; mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;

View File

@@ -13,7 +13,12 @@ namespace AIStudio.Wpf.Mind.Helpers
{ {
public class MindLayout : IMindLayout public class MindLayout : IMindLayout
{ {
public void Appearance(MindNode mindNode, bool initAppearance) public void Appearance(MindNode mindNode)
{
Appearance(mindNode, null, false);
}
public void Appearance(MindNode mindNode, MindThemeModel mindThemeModel, bool initAppearance)
{ {
switch (mindNode.NodeLevel) switch (mindNode.NodeLevel)
{ {
@@ -21,18 +26,11 @@ namespace AIStudio.Wpf.Mind.Helpers
{ {
if (initAppearance) if (initAppearance)
{ {
mindNode.ItemWidth = 110; MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
mindNode.ItemHeight = 40;
mindNode.ClearConnectors(); mindNode.ClearConnectors();
var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.None, true) { XRatio = 0.5, YRatio = 0.5 }; var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.None, true) { XRatio = 0.5, YRatio = 0.5 };
mindNode.AddConnector(port); mindNode.AddConnector(port);
mindNode.ColorViewModel.FillColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
mindNode.FontViewModel.FontColor = Colors.White;
mindNode.FontViewModel.FontSize = 15;
mindNode.Spacing = new SizeBase(50, 15);
} }
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.Circle; mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.Circle;
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall; mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
@@ -43,15 +41,13 @@ namespace AIStudio.Wpf.Mind.Helpers
{ {
if (initAppearance) if (initAppearance)
{ {
mindNode.ItemWidth = 80; MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
mindNode.ItemHeight = 25;
mindNode.ClearConnectors(); mindNode.ClearConnectors();
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 }; var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 0.5 };
mindNode.AddConnector(port1); mindNode.AddConnector(port1);
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 0.5 }; var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 0.5 };
mindNode.AddConnector(port2); mindNode.AddConnector(port2);
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
} }
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None; mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall; mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
@@ -62,10 +58,9 @@ namespace AIStudio.Wpf.Mind.Helpers
{ {
if (initAppearance) if (initAppearance)
{ {
mindNode.ItemWidth = 80; MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
mindNode.ItemHeight = 25;
mindNode.ClearConnectors();
mindNode.ClearConnectors();
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 1 }; var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Left, true) { XRatio = 0, YRatio = 1 };
mindNode.AddConnector(port1); mindNode.AddConnector(port1);
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 1 }; var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Right, true) { XRatio = 1, YRatio = 1 };
@@ -73,8 +68,6 @@ namespace AIStudio.Wpf.Mind.Helpers
mindNode.CornerRadius = new System.Windows.CornerRadius(0); mindNode.CornerRadius = new System.Windows.CornerRadius(0);
mindNode.BorderThickness = new System.Windows.Thickness(0, 0, 0, 1); mindNode.BorderThickness = new System.Windows.Thickness(0, 0, 0, 1);
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
} }
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None; mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall; mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;

View File

@@ -0,0 +1,583 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using AIStudio.Wpf.DiagramDesigner.Geometrys;
using AIStudio.Wpf.Mind.ViewModels;
namespace AIStudio.Wpf.Mind.Helpers
{
public static class MindThemeHelper
{
public static MindThemeModel GetTheme(string theme)
{
switch (theme)
{
case "SkyBlue": return GetSkyBlueTheme();
case "SkyBlueMini": return GetSkyBlueMiniTheme();
case "LiteratureGreen": return GetLiteratureGreenTheme();
case "LiteratureGreenMini": return GetLiteratureGreenMiniTheme();
case "BrainDeadPink": return GetBrainDeadPinkTheme();
case "BrainDeadPinkMini": return GetBrainDeadPinkMiniTheme();
case "RomanticPurple": return GetRomanticPurpleTheme();
case "RomanticPurpleMini": return GetRomanticPurpleMiniTheme();
case "FreshRed": return GetFreshRedTheme();
case "FreshRedMini": return GetFreshRedMiniTheme();
case "EarthyYellow": return GetEarthyYellowTheme();
case "EarthyYellowMini": return GetEarthyYellowMiniTheme();
case "CoolLightYellow": return GetCoolLightYellowTheme();
case "CoolLightYellowMini": return GetCoolLightYellowMiniTheme();
default: return GetSkyBlueTheme();
}
}
public static MindThemeModel GetSkyBlueTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0x73, 0xa1, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x73, 0xa1, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x73, 0xa1, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetSkyBlueMiniTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0x73, 0xa1, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x73, 0xa1, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x73, 0xa1, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetLiteratureGreenTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0x73, 0xbf, 0x76),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x73, 0xbf, 0x76),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x73, 0xbf, 0x76),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetLiteratureGreenMiniTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0x73, 0xbf, 0x76),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x73, 0xbf, 0x76),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x73, 0xbf, 0x76),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetBrainDeadPinkTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0xbf, 0x73, 0x94),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x73, 0x94),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x73, 0x94),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetBrainDeadPinkMiniTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0xbf, 0x73, 0x94),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x73, 0x94),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x73, 0x94),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetRomanticPurpleTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0x7b, 0x73, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x7b, 0x73, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x7b, 0x73, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetRomanticPurpleMiniTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0x7b, 0x73, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x7b, 0x73, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0x7b, 0x73, 0xbf),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetFreshRedTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0xbf, 0x73, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x73, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x73, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetFreshRedMiniTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0xbf, 0x73, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x73, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x73, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetEarthyYellowTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0xbf, 0x93, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x93, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x93, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetEarthyYellowMiniTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0xbf, 0x93, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x93, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xbf, 0x93, 0x73),
FontColor = Colors.White,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetCoolLightYellowTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0xe9, 0xdf, 0x98),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xe9, 0xdf, 0x98),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xe9, 0xdf, 0x98),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static MindThemeModel GetCoolLightYellowMiniTheme()
{
return new MindThemeModel()
{
MindThemeLevel1 = new MindTheme()
{
ItemWidth = 110,
ItemHeight = 40,
FillColor = Color.FromRgb(0xe9, 0xdf, 0x98),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(50, 15),
},
MindThemeLevel2 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xe9, 0xdf, 0x98),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
},
MindThemeLevel3 = new MindTheme()
{
ItemWidth = 80,
ItemHeight = 25,
FillColor = Color.FromRgb(0xe9, 0xdf, 0x98),
FontColor = Colors.Black,
FontSize = 15,
Spacing = new SizeBase(15, 15),
}
};
}
public static void ThemeChange(MindNode mindNode, MindThemeModel mindThemeModel)
{
switch (mindNode.NodeLevel)
{
case 0:
{
mindNode.ItemWidth = mindThemeModel.MindThemeLevel1.ItemWidth;
mindNode.ItemHeight = mindThemeModel.MindThemeLevel1.ItemHeight;
mindNode.ColorViewModel.FillColor.Color = mindThemeModel.MindThemeLevel1.FillColor;
mindNode.ColorViewModel.LineColor.Color = mindThemeModel.MindThemeLevel1.FillColor;
mindNode.FontViewModel.FontColor = mindThemeModel.MindThemeLevel1.FontColor;
mindNode.FontViewModel.FontSize = mindThemeModel.MindThemeLevel1.FontSize;
mindNode.Spacing = mindThemeModel.MindThemeLevel1.Spacing;
break;
}
case 1:
{
mindNode.ItemWidth = mindThemeModel.MindThemeLevel2.ItemWidth;
mindNode.ItemHeight = mindThemeModel.MindThemeLevel2.ItemHeight;
mindNode.ColorViewModel.FillColor.Color = mindThemeModel.MindThemeLevel2.FillColor;
mindNode.ColorViewModel.LineColor.Color = mindThemeModel.MindThemeLevel2.FillColor;
mindNode.FontViewModel.FontColor = mindThemeModel.MindThemeLevel2.FontColor;
mindNode.FontViewModel.FontSize = mindThemeModel.MindThemeLevel2.FontSize;
mindNode.Spacing = mindThemeModel.MindThemeLevel2.Spacing;
break;
}
default:
{
mindNode.ItemWidth = mindThemeModel.MindThemeLevel3.ItemWidth;
mindNode.ItemHeight = mindThemeModel.MindThemeLevel3.ItemHeight;
mindNode.ColorViewModel.FillColor.Color = mindThemeModel.MindThemeLevel3.FillColor;
mindNode.ColorViewModel.LineColor.Color = mindThemeModel.MindThemeLevel3.FillColor;
mindNode.FontViewModel.FontColor = mindThemeModel.MindThemeLevel3.FontColor;
mindNode.FontViewModel.FontSize = mindThemeModel.MindThemeLevel3.FontSize;
mindNode.Spacing = mindThemeModel.MindThemeLevel3.Spacing;
break;
}
}
}
}
public class MindTheme
{
public double ItemWidth
{
get; set;
}
public double ItemHeight
{
get; set;
}
public Color FillColor
{
get; set;
}
public Color FontColor
{
get; set;
}
public double FontSize
{
get; set;
}
public SizeBase Spacing
{
get; set;
}
}
public class MindThemeModel
{
public MindTheme MindThemeLevel1
{
get; set;
}
public MindTheme MindThemeLevel2
{
get; set;
}
public MindTheme MindThemeLevel3
{
get; set;
}
}
}

View File

@@ -13,7 +13,12 @@ namespace AIStudio.Wpf.Mind.Helpers
{ {
public class OrganizationalLayout : IMindLayout public class OrganizationalLayout : IMindLayout
{ {
public void Appearance(MindNode mindNode, bool initAppearance) public void Appearance(MindNode mindNode)
{
Appearance(mindNode, null, false);
}
public void Appearance(MindNode mindNode, MindThemeModel mindThemeModel, bool initAppearance)
{ {
switch (mindNode.NodeLevel) switch (mindNode.NodeLevel)
{ {
@@ -21,17 +26,11 @@ namespace AIStudio.Wpf.Mind.Helpers
{ {
if (initAppearance) if (initAppearance)
{ {
mindNode.ItemWidth = 110; MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
mindNode.ItemHeight = 40;
mindNode.ClearConnectors();
mindNode.ClearConnectors();
var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.5, YRatio = 1 }; var port = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.5, YRatio = 1 };
mindNode.AddConnector(port); mindNode.AddConnector(port);
mindNode.ColorViewModel.FillColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
mindNode.FontViewModel.FontColor = Colors.White;
mindNode.FontViewModel.FontSize = 15;
} }
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None; mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall; mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;
@@ -42,15 +41,13 @@ namespace AIStudio.Wpf.Mind.Helpers
{ {
if (initAppearance) if (initAppearance)
{ {
mindNode.ItemWidth = 80; MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
mindNode.ItemHeight = 25;
mindNode.ClearConnectors(); mindNode.ClearConnectors();
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Top, true) { XRatio = 0.5, YRatio = 0 }; var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Top, true) { XRatio = 0.5, YRatio = 0 };
mindNode.AddConnector(port1); mindNode.AddConnector(port1);
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.5, YRatio = 1 }; var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.5, YRatio = 1 };
mindNode.AddConnector(port2); mindNode.AddConnector(port2);
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
} }
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None; mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
@@ -62,10 +59,9 @@ namespace AIStudio.Wpf.Mind.Helpers
{ {
if (initAppearance) if (initAppearance)
{ {
mindNode.ItemWidth = 80; MindThemeHelper.ThemeChange(mindNode, mindThemeModel);
mindNode.ItemHeight = 25;
mindNode.ClearConnectors();
mindNode.ClearConnectors();
var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Top, true) { XRatio = 0.5, YRatio = 0 }; var port1 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Top, true) { XRatio = 0.5, YRatio = 0 };
mindNode.AddConnector(port1); mindNode.AddConnector(port1);
var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.5, YRatio = 1 }; var port2 = new FullyCreatedConnectorInfo(mindNode.Root, mindNode, ConnectorOrientation.Bottom, true) { XRatio = 0.5, YRatio = 1 };
@@ -73,8 +69,6 @@ namespace AIStudio.Wpf.Mind.Helpers
mindNode.CornerRadius = new System.Windows.CornerRadius(0); mindNode.CornerRadius = new System.Windows.CornerRadius(0);
mindNode.BorderThickness = new System.Windows.Thickness(0, 0, 0, 0); mindNode.BorderThickness = new System.Windows.Thickness(0, 0, 0, 0);
mindNode.ColorViewModel.LineColor.Color = Color.FromRgb(0x73, 0xa1, 0xbf);
} }
mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None; mindNode.ShapeViewModel.SinkMarker.PathStyle = ArrowPathStyle.None;
mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall; mindNode.ShapeViewModel.SinkMarker.SizeStyle = ArrowSizeStyle.VerySmall;

View File

@@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace AIStudio.Wpf.Mind
{
public enum NodeLevel
{
Level1,
Level2,
Level3
}
}

View File

@@ -0,0 +1,96 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="FlatToggleButtonStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="Background" Value="LightGray" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Grid ClipToBounds="True" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation Duration="0" To="0.38" Storyboard.TargetProperty="(UIElement.Opacity)" />
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="CheckStates">
<VisualStateGroup.Transitions>
<VisualTransition From="*" To="Checked">
<Storyboard>
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" Storyboard.TargetProperty="ScaleX" Storyboard.TargetName="CheckedEllipseScale">
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0.0" />
<LinearDoubleKeyFrame Value="1.0" KeyTime="0:0:0.1" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" Storyboard.TargetProperty="ScaleY" Storyboard.TargetName="CheckedEllipseScale">
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0.0" />
<LinearDoubleKeyFrame Value="1.0" KeyTime="0:0:0.1" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualTransition>
<VisualTransition From="Checked" To="Unchecked">
<Storyboard>
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" Storyboard.TargetProperty="ScaleX" Storyboard.TargetName="CheckedEllipseScale">
<LinearDoubleKeyFrame Value="1.0" KeyTime="0:0:0.0" />
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0.1" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Duration="0:0:0.2" Storyboard.TargetProperty="ScaleY" Storyboard.TargetName="CheckedEllipseScale">
<LinearDoubleKeyFrame Value="1.0" KeyTime="0:0:0.0" />
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0.1" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualTransition>
</VisualStateGroup.Transitions>
<VisualState x:Name="Checked">
<Storyboard>
<DoubleAnimation Duration="0" Storyboard.TargetProperty="ScaleX" Storyboard.TargetName="CheckedEllipseScale" To="1.0" />
<DoubleAnimation Duration="0" Storyboard.TargetProperty="ScaleY" Storyboard.TargetName="CheckedEllipseScale" To="1.0" />
</Storyboard>
</VisualState>
<VisualState x:Name="Unchecked">
<Storyboard>
<DoubleAnimation Duration="0" Storyboard.TargetProperty="ScaleX" Storyboard.TargetName="CheckedEllipseScale" To="0" />
<DoubleAnimation Duration="0" Storyboard.TargetProperty="ScaleY" Storyboard.TargetName="CheckedEllipseScale" To="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Rectangle Fill="Transparent" x:Name="HoverEllipse" Stroke="Transparent" StrokeThickness="1" />
<Rectangle Fill="{TemplateBinding Background}" x:Name="CheckedEllipse" RenderTransformOrigin="0.5, 0.5">
<Rectangle.RenderTransform>
<ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1.0" ScaleY="1.0" x:Name="CheckedEllipseScale"/>
</Rectangle.RenderTransform>
</Rectangle>
<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Stroke" TargetName="HoverEllipse" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}" />
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background" Value="#73a1bf"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value=".9"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Opacity" Value=".6"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.5"/>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using AIStudio.Wpf.DiagramDesigner; using AIStudio.Wpf.DiagramDesigner;
using AIStudio.Wpf.Mind.Helpers;
namespace AIStudio.Wpf.Mind.ViewModels namespace AIStudio.Wpf.Mind.ViewModels
{ {
@@ -14,6 +15,11 @@ namespace AIStudio.Wpf.Mind.ViewModels
get; set; get; set;
} }
MindThemeModel MindThemeModel
{
get; set;
}
MindNode RootItem MindNode RootItem
{ {
get; get;
@@ -29,7 +35,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
get; get;
} }
SimpleCommand AddPeerCommand SimpleCommand AddPearCommand
{ {
get; get;
} }
@@ -54,6 +60,26 @@ namespace AIStudio.Wpf.Mind.ViewModels
get; get;
} }
SimpleCommand SelectBrotherCommand
{
get;
}
SimpleCommand SelectPearCommand
{
get;
}
SimpleCommand SelectRouteCommand
{
get;
}
SimpleCommand SelectChildCommand
{
get;
}
SimpleCommand Expand2Level1Command SimpleCommand Expand2Level1Command
{ {
get; get;

View File

@@ -1,8 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Windows.Documents; using System.Windows.Media;
using AIStudio.Wpf.DiagramDesigner; using AIStudio.Wpf.DiagramDesigner;
using AIStudio.Wpf.Mind.Helpers;
namespace AIStudio.Wpf.Mind.ViewModels 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 public MindNode RootItem
{ {
get get
@@ -53,12 +66,12 @@ namespace AIStudio.Wpf.Mind.ViewModels
} }
} }
private SimpleCommand _addPeerCommand; private SimpleCommand _AddPearCommand;
public SimpleCommand AddPeerCommand public SimpleCommand AddPearCommand
{ {
get 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; private SimpleCommand _addLinkCommand;
public SimpleCommand AddLinkCommand public SimpleCommand AddLinkCommand
{ {
@@ -175,7 +224,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
{ {
get 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 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 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 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 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 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 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 get
{ {
return this._expand2Level6Command ?? (this._expand2Level6Command = new SimpleCommand(MindExecuteEnable, this.ExecutedExpand2Level6Command)); return this._expand2Level6Command ?? (this._expand2Level6Command = new SimpleCommand(ExecuteEnable, this.ExecutedExpand2Level6Command));
} }
} }
#endregion #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>(); List<MindNode> items = new List<MindNode>();
if (parameter is MindNode pear) if (parameter is MindNode pear)
@@ -539,52 +615,52 @@ namespace AIStudio.Wpf.Mind.ViewModels
private void ExecuteAddLinkCommand(object obj) private void ExecuteAddLinkCommand(object obj)
{ {
throw new NotImplementedException();
} }
private void ExecuteRemoveLinkCommand(object obj) private void ExecuteRemoveLinkCommand(object obj)
{ {
throw new NotImplementedException();
} }
private void ExecuteAddImageCommand(object obj) private void ExecuteAddImageCommand(object obj)
{ {
throw new NotImplementedException();
} }
private void ExecuteRemoveImageCommand(object obj) private void ExecuteRemoveImageCommand(object obj)
{ {
throw new NotImplementedException();
} }
private void ExecuteAddRemarkCommand(object obj) private void ExecuteAddRemarkCommand(object obj)
{ {
throw new NotImplementedException();
} }
private void ExecuteRemoveRemarkCommand(object obj) private void ExecuteRemoveRemarkCommand(object obj)
{ {
throw new NotImplementedException();
} }
private void ExecuteAddPriorityCommand(object obj) private void ExecuteAddPriorityCommand(object obj)
{ {
throw new NotImplementedException();
} }
private void ExecuteAddRatioCommand(object obj) private void ExecuteAddRatioCommand(object obj)
{ {
throw new NotImplementedException();
} }
private void ExecuteAddTagCommand(object obj) private void ExecuteAddTagCommand(object obj)
{ {
throw new NotImplementedException();
} }
private void ExecuteRemoveTagCommand(object obj) private void ExecuteRemoveTagCommand(object obj)
{ {
throw new NotImplementedException();
} }
private void ExecutedChangeMindTypeCommand(object obj) private void ExecutedChangeMindTypeCommand(object obj)
@@ -599,44 +675,106 @@ namespace AIStudio.Wpf.Mind.ViewModels
private void ExecutedChangeMindThemeCommand(object obj) 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) private void ExecutedExpand2Level1Command(object obj)
{ {
throw new NotImplementedException();
} }
private void ExecutedExpand2Level2Command(object obj) private void ExecutedExpand2Level2Command(object obj)
{ {
throw new NotImplementedException();
} }
private void ExecutedExpand2Level3Command(object obj) private void ExecutedExpand2Level3Command(object obj)
{ {
throw new NotImplementedException();
} }
private void ExecutedExpand2Level4Command(object obj) private void ExecutedExpand2Level4Command(object obj)
{ {
throw new NotImplementedException();
} }
private void ExecutedExpand2Level5Command(object obj) private void ExecutedExpand2Level5Command(object obj)
{ {
throw new NotImplementedException();
} }
private void ExecutedExpand2Level6Command(object obj) private void ExecutedExpand2Level6Command(object obj)
{ {
throw new NotImplementedException();
} }
#endregion #endregion
protected override void ExecutedInitLayoutCommand(object obj)
{
}
protected override void ExecutedResetLayoutCommand(object obj) protected override void ExecutedResetLayoutCommand(object obj)
{ {
foreach (var item in Items.OfType<MindNode>()) foreach (var item in Items.OfType<MindNode>())

View File

@@ -59,7 +59,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
AddChildCommand = (Root as IMindDiagramViewModel)?.AddChildCommand; AddChildCommand = (Root as IMindDiagramViewModel)?.AddChildCommand;
AddParentCommand = (Root as IMindDiagramViewModel)?.AddParentCommand; AddParentCommand = (Root as IMindDiagramViewModel)?.AddParentCommand;
AddPeerCommand = (Root as IMindDiagramViewModel)?.AddPeerCommand; AddPearCommand = (Root as IMindDiagramViewModel)?.AddPearCommand;
DeleteCommand = (Root as IMindDiagramViewModel)?.DeleteCommand; DeleteCommand = (Root as IMindDiagramViewModel)?.DeleteCommand;
MoveForwardCommand = (Root as IMindDiagramViewModel)?.MoveForwardCommand; MoveForwardCommand = (Root as IMindDiagramViewModel)?.MoveForwardCommand;
MoveBackCommand = (Root as IMindDiagramViewModel)?.MoveBackCommand; MoveBackCommand = (Root as IMindDiagramViewModel)?.MoveBackCommand;
@@ -72,12 +72,17 @@ 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();
IsInnerConnector = true; IsInnerConnector = true;
MindLayout.Appearance(this, initAppearance); MindLayout.Appearance(this, MindThemeModel, initAppearance);
this.PropertyChanged -= this.Item_PropertyChanged; this.PropertyChanged -= this.Item_PropertyChanged;
this.PropertyChanged += this.Item_PropertyChanged; this.PropertyChanged += this.Item_PropertyChanged;
} }
public void ThemeChange()
{
MindThemeHelper.ThemeChange(this, MindThemeModel);
}
protected override void LoadDesignerItemViewModel(SelectableItemBase designerbase) protected override void LoadDesignerItemViewModel(SelectableItemBase designerbase)
{ {
base.LoadDesignerItemViewModel(designerbase); base.LoadDesignerItemViewModel(designerbase);
@@ -138,6 +143,14 @@ namespace AIStudio.Wpf.Mind.ViewModels
} }
} }
public MindThemeModel MindThemeModel
{
get
{
return (Root as IMindDiagramViewModel)?.MindThemeModel ?? MindThemeHelper.GetTheme("SkyBlue");
}
}
private bool _isExpanded = true; private bool _isExpanded = true;
public bool IsExpanded public bool IsExpanded
{ {
@@ -303,7 +316,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
get; private set; get; private set;
} }
public SimpleCommand AddPeerCommand public SimpleCommand AddPearCommand
{ {
get; private set; get; private set;
} }
@@ -335,7 +348,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
menuOptions.Add(menuItem); menuOptions.Add(menuItem);
menuItem = new CinchMenuItem(); menuItem = new CinchMenuItem();
menuItem.Text = "同级"; menuItem.Text = "同级";
menuItem.Command = AddPeerCommand; menuItem.Command = AddPearCommand;
menuItem.CommandParameter = this; menuItem.CommandParameter = this;
menuOptions.Add(menuItem); menuOptions.Add(menuItem);
menuItem = new CinchMenuItem(); menuItem = new CinchMenuItem();
@@ -431,7 +444,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
break; break;
} }
case nameof(NodeLevel): case nameof(NodeLevel):
MindLayout?.Appearance(this, false); MindLayout?.Appearance(this);
break; break;
case nameof(Left): case nameof(Left):
{ {