This commit is contained in:
艾竹
2023-03-13 22:27:00 +08:00
parent 31872222bc
commit 035a725da3
10 changed files with 109 additions and 26 deletions

View File

@@ -23,13 +23,4 @@
<ProjectReference Include="..\AIStudio.Wpf.DiagramModels\AIStudio.Wpf.DiagramModels.csproj" />
</ItemGroup>
<ItemGroup>
<Page Update="Themes\MindNode.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
</Page>
<Page Update="Themes\Generic.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
</Page>
</ItemGroup>
</Project>

View File

@@ -4,11 +4,68 @@
<Style x:Key="PriorityControlStyle" TargetType="{x:Type controls:PriorityControl}">
<Setter Property="Template">
<Setter Property="Background" Value="Gray" />
<Setter Property="Foreground" Value="White" />
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="3" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:PriorityControl}">
<Grid>
<Grid x:Name="RootGrid">
<Border x:Name="border"
Background="{TemplateBinding Background}"
CornerRadius="3"
Padding="{TemplateBinding Padding}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Path x:Name="Path" Stretch="Uniform" Fill="{TemplateBinding Foreground}"
RenderTransformOrigin="0.5,0.5"
Data="">
<Path.RenderTransform>
<ScaleTransform ScaleY="-1"/>
</Path.RenderTransform>
</Path>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Priority" Value="1">
<Setter TargetName="Path" Property="Data" Value="M700 1125V100H600V1014.8L375 954.5V1058.05L625 1125z"/>
<Setter Property="Background" Value="Red"/>
</Trigger>
<Trigger Property="Priority" Value="2">
<Setter TargetName="Path" Property="Data" Value="M800 825A200 200 0 1 1 400 825H300A300 300 0 1 0 833.15 636.2L467.15 200.0499999999999L900 200V100H300V156.3499999999999L753.2 696.4499999999999A199.10000000000002 199.10000000000002 0 0 1 800 825z"/>
<Setter Property="Background" Value="Blue"/>
</Trigger>
<Trigger Property="Priority" Value="3">
<Setter TargetName="Path" Property="Data" Value="M900 1100V1031.9L640.4499999999999 722.5A325.05 325.05 0 1 0 284.65 321.0999999999999L381.65 345.3999999999999A225.1 225.1 0 0 1 825 400A225 225 0 0 1 499.7500000000001 601.5L488.3500000000001 595.4000000000001L453.8500000000001 655.7500000000001L742.75 1000L325 1000V1100H900z"/>
<Setter Property="Background" Value="Green"/>
</Trigger>
<Trigger Property="Priority" Value="4">
<Setter TargetName="Path" Property="Data" Value="M800 1125V400H950V300H800V100H700V300H200V355.1L700 1125H800zM700 400V941.45L348.4 400H700z"/>
<Setter Property="Background" Value="Orange"/>
</Trigger>
<Trigger Property="Priority" Value="5">
<Setter TargetName="Path" Property="Data" Value="M900 1100V1000H465.0000000000001L431.1500000000001 677.75A325 325 0 1 0 284.6500000000001 321.1L381.6500000000001 345.4000000000001A225.1 225.1 0 0 1 825 400A225 225 0 0 1 600 625C498.9 625 436.1 593.0500000000001 402 548.5L323.25 607.6L375 1100H900z"/>
<Setter Property="Background" Value="Purple"/>
</Trigger>
<Trigger Property="Priority" Value="6">
<Setter TargetName="Path" Property="Data" Value="M744.3 1100L522.4 715.7A325 325 0 1 0 320 565L628.8000000000001 1100H744.3000000000001zM600 625A225 225 0 1 1 600 175A225 225 0 0 1 600 625z"/>
<Setter Property="Background" Value="Gray"/>
</Trigger>
<Trigger Property="Priority" Value="7">
<Setter TargetName="Path" Property="Data" Value="M950 1100V1025L538.15 100H428.7L829.35 1000H300V1100z"/>
<Setter Property="Background" Value="Gray"/>
</Trigger>
<Trigger Property="Priority" Value="8">
<Setter TargetName="Path" Property="Data" Value="M600 1125A275 275 0 0 0 767.6 632C861.9999999999999 579.5 925 484 925 375C925 209.3 779.5 75 600 75S275 209.3 275 375C275 484.0500000000001 338.05 579.5 432.35 632.05A275 275 0 0 0 600 1125zM600 575C474 575 375 483.6 375 375C375 266.4 474 175 600 175S825 266.4 825 375C825 483.6 726 575 600 575zM600 1025A175 175 0 1 1 600 675A175 175 0 0 1 600 1025z"/>
<Setter Property="Background" Value="Gray"/>
</Trigger>
<Trigger Property="Priority" Value="9">
<Setter TargetName="Path" Property="Data" Value="M600 1125A325 325 0 0 0 880.95 636.5L571.15 100.05H455.7L677.6500000000001 484.35A325 325 0 1 0 600 1125zM600 1025A225 225 0 1 1 600 575A225 225 0 0 1 600 1025z"/>
<Setter Property="Background" Value="Gray"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>

View File

@@ -20,6 +20,10 @@ namespace AIStudio.Wpf.Mind.Controls
/// </summary>
public class PriorityControl : Control
{
static PriorityControl()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(PriorityControl), new FrameworkPropertyMetadata(typeof(PriorityControl)));
}
/// <summary>Identifies the <see cref="Priority"/> dependency property.</summary>
public static readonly DependencyProperty PriorityProperty

View File

@@ -20,6 +20,10 @@ namespace AIStudio.Wpf.Mind.Controls
/// </summary>
public class RateControl : Control
{
static RateControl()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(RateControl), new FrameworkPropertyMetadata(typeof(RateControl)));
}
/// <summary>Identifies the <see cref="Rate"/> dependency property.</summary>
public static readonly DependencyProperty RateProperty

View File

@@ -20,6 +20,10 @@ namespace AIStudio.Wpf.Mind.Controls
/// </summary>
public class RemarkControl : Control
{
static RemarkControl()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(RemarkControl), new FrameworkPropertyMetadata(typeof(RemarkControl)));
}
/// <summary>Identifies the <see cref="Remark"/> dependency property.</summary>
public static readonly DependencyProperty RemarkProperty

View File

@@ -21,7 +21,12 @@ namespace AIStudio.Wpf.Mind.Controls
/// </summary>
public class TagControl : Control
{
/// <summary>Identifies the <see cref="Tags"/> dependency property.</summary>
static TagControl()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(TagControl), new FrameworkPropertyMetadata(typeof(TagControl)));
}
/// <summary>Identifies the <see cref="Tags"/> dependency property.</summary>
public static readonly DependencyProperty TagsProperty
= DependencyProperty.Register(nameof(Tags), typeof(ObservableCollection<string>), typeof(TagControl));

View File

@@ -154,7 +154,8 @@
Background="#FFC5BDAE"
Width="20"
Height="20"
Command="{Binding EditCommand}">
Command="{Binding AddPriorityCommand}"
CommandParameter="0">
<Path Stretch="Uniform" Fill="DarkRed" Data="M966.4 761.6l-140.8 140.8-313.6-320-313.6 320-140.8-140.8 320-313.6-320-313.6 140.8-140.8 313.6 320 313.6-320 140.8 140.8-320 313.6z"></Path>
</Button>
@@ -162,7 +163,8 @@
Background="Red"
Width="20"
Height="20"
Command="{Binding EditCommand}">
Command="{Binding AddPriorityCommand}"
CommandParameter="1">
<Path Stretch="Uniform" Fill="White" RenderTransformOrigin="0.5,0.5" Data="M700 1125V100H600V1014.8L375 954.5V1058.05L625 1125z">
<Path.RenderTransform>
<ScaleTransform ScaleY="-1"/>
@@ -174,7 +176,8 @@
Background="Blue"
Width="20"
Height="20"
Command="{Binding EditCommand}">
Command="{Binding AddPriorityCommand}"
CommandParameter="2">
<Path Stretch="Uniform" Fill="White" RenderTransformOrigin="0.5,0.5" Data="M800 825A200 200 0 1 1 400 825H300A300 300 0 1 0 833.15 636.2L467.15 200.0499999999999L900 200V100H300V156.3499999999999L753.2 696.4499999999999A199.10000000000002 199.10000000000002 0 0 1 800 825z">
<Path.RenderTransform>
<ScaleTransform ScaleY="-1"/>
@@ -186,7 +189,8 @@
Background="Green"
Width="20"
Height="20"
Command="{Binding EditCommand}">
Command="{Binding AddPriorityCommand}"
CommandParameter="3">
<Path Stretch="Uniform" Fill="White" RenderTransformOrigin="0.5,0.5" Data="M900 1100V1031.9L640.4499999999999 722.5A325.05 325.05 0 1 0 284.65 321.0999999999999L381.65 345.3999999999999A225.1 225.1 0 0 1 825 400A225 225 0 0 1 499.7500000000001 601.5L488.3500000000001 595.4000000000001L453.8500000000001 655.7500000000001L742.75 1000L325 1000V1100H900z">
<Path.RenderTransform>
<ScaleTransform ScaleY="-1"/>
@@ -198,7 +202,8 @@
Background="Orange"
Width="20"
Height="20"
Command="{Binding EditCommand}">
Command="{Binding AddPriorityCommand}"
CommandParameter="4">
<Path Stretch="Uniform" Fill="White" RenderTransformOrigin="0.5,0.5" Data="M800 1125V400H950V300H800V100H700V300H200V355.1L700 1125H800zM700 400V941.45L348.4 400H700z">
<Path.RenderTransform>
<ScaleTransform ScaleY="-1"/>
@@ -210,7 +215,8 @@
Background="Purple"
Width="20"
Height="20"
Command="{Binding EditCommand}">
Command="{Binding AddPriorityCommand}"
CommandParameter="5">
<Path Stretch="Uniform" Fill="White" RenderTransformOrigin="0.5,0.5" Data="M900 1100V1000H465.0000000000001L431.1500000000001 677.75A325 325 0 1 0 284.6500000000001 321.1L381.6500000000001 345.4000000000001A225.1 225.1 0 0 1 825 400A225 225 0 0 1 600 625C498.9 625 436.1 593.0500000000001 402 548.5L323.25 607.6L375 1100H900z">
<Path.RenderTransform>
<ScaleTransform ScaleY="-1"/>
@@ -222,7 +228,8 @@
Background="Gray"
Width="20"
Height="20"
Command="{Binding EditCommand}">
Command="{Binding AddPriorityCommand}"
CommandParameter="6">
<Path Stretch="Uniform" Fill="White" RenderTransformOrigin="0.5,0.5" Data="M744.3 1100L522.4 715.7A325 325 0 1 0 320 565L628.8000000000001 1100H744.3000000000001zM600 625A225 225 0 1 1 600 175A225 225 0 0 1 600 625z">
<Path.RenderTransform>
<ScaleTransform ScaleY="-1"/>
@@ -233,7 +240,8 @@
Background="Gray"
Width="20"
Height="20"
Command="{Binding EditCommand}">
Command="{Binding AddPriorityCommand}"
CommandParameter="7">
<Path Stretch="Uniform" Fill="White" RenderTransformOrigin="0.5,0.5" Data="M950 1100V1025L538.15 100H428.7L829.35 1000H300V1100z">
<Path.RenderTransform>
<ScaleTransform ScaleY="-1"/>
@@ -244,7 +252,8 @@
Background="Gray"
Width="20"
Height="20"
Command="{Binding EditCommand}">
Command="{Binding AddPriorityCommand}"
CommandParameter="8">
<Path Stretch="Uniform" Fill="White" RenderTransformOrigin="0.5,0.5" Data="M600 1125A275 275 0 0 0 767.6 632C861.9999999999999 579.5 925 484 925 375C925 209.3 779.5 75 600 75S275 209.3 275 375C275 484.0500000000001 338.05 579.5 432.35 632.05A275 275 0 0 0 600 1125zM600 575C474 575 375 483.6 375 375C375 266.4 474 175 600 175S825 266.4 825 375C825 483.6 726 575 600 575zM600 1025A175 175 0 1 1 600 675A175 175 0 0 1 600 1025z">
<Path.RenderTransform>
<ScaleTransform ScaleY="-1"/>
@@ -255,7 +264,8 @@
Background="Gray"
Width="20"
Height="20"
Command="{Binding EditCommand}">
Command="{Binding AddPriorityCommand}"
CommandParameter="9">
<Path Stretch="Uniform" Fill="White" RenderTransformOrigin="0.5,0.5" Data="M600 1125A325 325 0 0 0 880.95 636.5L571.15 100.05H455.7L677.6500000000001 484.35A325 325 0 1 0 600 1125zM600 1025A225 225 0 1 1 600 575A225 225 0 0 1 600 1025z">
<Path.RenderTransform>
<ScaleTransform ScaleY="-1"/>

View File

@@ -4,6 +4,11 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Controls/DropDownButton.xaml"/>
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Controls/MindEditor.xaml"/>
<!--<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Controls/LinkControl.xaml"/>-->
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Controls/PriorityControl.xaml"/>
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Controls/RateControl.xaml"/>
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Controls/RemarkControl.xaml"/>
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Controls/TagControl.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

View File

@@ -67,7 +67,7 @@
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Image x:Name="image" Source="{Binding Icon}" Stretch="Fill" Width="64" Height="64" Visibility="Collapsed"/>
<Grid Grid.Row="1">
<Grid Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
@@ -77,8 +77,8 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:RateControl Grid.Column="0" />
<controls:PriorityControl Grid.Column="1"/>
<dd:TextControl Grid.Column="2"/>
<controls:PriorityControl Grid.Column="1" Width="20" Height="20" Priority="{Binding Priority}" Visibility="{Binding Priority,Converter={dd:ConverterValueSetToOppositeVisibility},ConverterParameter=0}"/>
<dd:TextControl Grid.Column="2" />
<controls:LinkControl Grid.Column="3"/>
<controls:RemarkControl Grid.Column="4"/>
<controls:TagControl Grid.Column="5"/>

View File

@@ -655,7 +655,10 @@ namespace AIStudio.Wpf.Mind.ViewModels
private void ExecuteAddPriorityCommand(object obj)
{
if (double.TryParse(obj.ToString(), out var priority))
{
SelectedItems.OfType<MindNode>().ToList().ForEach(p => p.Priority = priority);
}
}
private void ExecuteAddRatioCommand(object obj)