mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-23 18:06:35 +08:00
Mind Editoe
This commit is contained in:
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
class DoCommandManager
|
||||
public class DoCommandManager
|
||||
{
|
||||
#region Command定义
|
||||
public class Command
|
||||
@@ -24,9 +24,18 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
this.clearAction = clearAction;
|
||||
}
|
||||
|
||||
internal void Do() { action(); }
|
||||
internal void UnDo() { unDoAction(); }
|
||||
internal void Clear() { if (clearAction != null) clearAction(); }
|
||||
internal void Do()
|
||||
{
|
||||
action();
|
||||
}
|
||||
internal void UnDo()
|
||||
{
|
||||
unDoAction();
|
||||
}
|
||||
internal void Clear()
|
||||
{
|
||||
if (clearAction != null) clearAction();
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
@@ -35,35 +44,57 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
#endregion
|
||||
|
||||
public Stack<Command> ReDoActionStack { get; private set; }
|
||||
public Stack<Command> UnDoActionStack { get; private set; }
|
||||
public Stack<Command> ReDoActionStack
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
public Stack<Command> UnDoActionStack
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public int Capacity { get; set; } = 10;
|
||||
|
||||
public DoCommandManager()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
ReDoActionStack = new Stack<Command>();
|
||||
UnDoActionStack = new Stack<Command>();
|
||||
}
|
||||
|
||||
private bool _undoing;
|
||||
public void DoNewCommand(string name, Action action, Action unDoAction, Action clearAction = null, bool doit = true)
|
||||
{
|
||||
if (UnDoActionStack.Count >= Capacity)
|
||||
{
|
||||
//清理
|
||||
var clear = UnDoActionStack.LastOrDefault();
|
||||
clear.Clear();
|
||||
|
||||
UnDoActionStack = new Stack<Command>(UnDoActionStack.Take(Capacity - 1).Reverse());
|
||||
}
|
||||
|
||||
var cmd = new Command(name, action, unDoAction, clearAction);
|
||||
UnDoActionStack.Push(cmd);
|
||||
|
||||
ReDoActionStack.Clear();
|
||||
if (doit)
|
||||
if (_undoing == true) return;
|
||||
try
|
||||
{
|
||||
cmd.Do();
|
||||
_undoing = true;
|
||||
|
||||
if (UnDoActionStack.Count >= Capacity)
|
||||
{
|
||||
//清理
|
||||
var clear = UnDoActionStack.LastOrDefault();
|
||||
clear.Clear();
|
||||
|
||||
UnDoActionStack = new Stack<Command>(UnDoActionStack.Take(Capacity - 1).Reverse());
|
||||
}
|
||||
|
||||
var cmd = new Command(name, action, unDoAction, clearAction);
|
||||
UnDoActionStack.Push(cmd);
|
||||
|
||||
ReDoActionStack.Clear();
|
||||
if (doit)
|
||||
{
|
||||
cmd.Do();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_undoing = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,9 +103,19 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
if (!CanUnDo)
|
||||
return;
|
||||
|
||||
var cmd = UnDoActionStack.Pop();
|
||||
ReDoActionStack.Push(cmd);
|
||||
cmd.UnDo();
|
||||
if (_undoing == true) return;
|
||||
try
|
||||
{
|
||||
_undoing = true;
|
||||
|
||||
var cmd = UnDoActionStack.Pop();
|
||||
ReDoActionStack.Push(cmd);
|
||||
cmd.UnDo();
|
||||
}
|
||||
finally
|
||||
{
|
||||
_undoing = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void ReDo()
|
||||
@@ -82,13 +123,34 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
if (!CanReDo)
|
||||
return;
|
||||
|
||||
var cmd = ReDoActionStack.Pop();
|
||||
UnDoActionStack.Push(cmd);
|
||||
cmd.Do();
|
||||
if (_undoing == true) return;
|
||||
try
|
||||
{
|
||||
_undoing = true;
|
||||
var cmd = ReDoActionStack.Pop();
|
||||
UnDoActionStack.Push(cmd);
|
||||
cmd.Do();
|
||||
}
|
||||
finally
|
||||
{
|
||||
_undoing = false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanUnDo { get { return UnDoActionStack.Count != 0; } }
|
||||
public bool CanReDo { get { return ReDoActionStack.Count != 0; } }
|
||||
public bool CanUnDo
|
||||
{
|
||||
get
|
||||
{
|
||||
return UnDoActionStack.Count != 0;
|
||||
}
|
||||
}
|
||||
public bool CanReDo
|
||||
{
|
||||
get
|
||||
{
|
||||
return ReDoActionStack.Count != 0;
|
||||
}
|
||||
}
|
||||
//public IEnumerable<Command> Actions { get { return ReDoActionStack.Reverse().Concat(UnDoActionStack); } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner.Helpers
|
||||
{
|
||||
public static class IEnumerableExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Invokes a transform function on each element of a sequence and returns the minimum Double value
|
||||
/// if the sequence is not empty; otherwise returns the specified default value.
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"> The type of the elements of source. </typeparam>
|
||||
/// <param name="source"> A sequence of values to determine the minimum value of. </param>
|
||||
/// <param name="selector"> A transform function to apply to each element. </param>
|
||||
/// <param name="defaultValue"> The default value. </param>
|
||||
/// <returns> The minimum value in the sequence or default value if sequence is empty. </returns>
|
||||
public static double MinOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, double> selector, double defaultValue=default(double))
|
||||
{
|
||||
if (source.Any<TSource>())
|
||||
return source.Min<TSource>(selector);
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes a transform function on each element of a sequence and returns the maximum Double value
|
||||
/// if the sequence is not empty; otherwise returns the specified default value.
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"> The type of the elements of source. </typeparam>
|
||||
/// <param name="source"> A sequence of values to determine the maximum value of. </param>
|
||||
/// <param name="selector"> A transform function to apply to each element. </param>
|
||||
/// <param name="defaultValue"> The default value. </param>
|
||||
/// <returns> The maximum value in the sequence or default value if sequence is empty. </returns>
|
||||
public static double MaxOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, double> selector, double defaultValue=default(double))
|
||||
{
|
||||
if (source.Any<TSource>())
|
||||
return source.Max<TSource>(selector);
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
public static TResult MinOrDefault<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector, TResult defaultValue)
|
||||
{
|
||||
if (source.Any())
|
||||
{
|
||||
return source.Min(selector);
|
||||
}
|
||||
return defaultValue;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static TResult MaxOrDefault<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector, TResult defaultValue)
|
||||
{
|
||||
if (source.Any())
|
||||
{
|
||||
return source.Max(selector);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes a transform function on each element of a sequence and returns the minimum Double value
|
||||
/// if the sequence is not empty; otherwise returns the specified default value.
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"> The type of the elements of source. </typeparam>
|
||||
/// <param name="source"> A sequence of values to determine the minimum value of. </param>
|
||||
/// <param name="selector"> A transform function to apply to each element. </param>
|
||||
/// <param name="defaultValue"> The default value. </param>
|
||||
/// <returns> The minimum value in the sequence or default value if sequence is empty. </returns>
|
||||
public static double SumOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, double> selector, double defaultValue=default(double))
|
||||
{
|
||||
if (source.Any<TSource>())
|
||||
return source.Sum<TSource>(selector);
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -540,9 +540,10 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
var nodeB = Get(b);
|
||||
|
||||
if (nodeA == null || nodeB == null)
|
||||
return;
|
||||
return;
|
||||
|
||||
nodeA.AdjacentNodes.Add(nodeB, a.DistanceTo(b));
|
||||
if (!nodeA.AdjacentNodes.ContainsKey(nodeB))
|
||||
nodeA.AdjacentNodes.Add(nodeB, a.DistanceTo(b));
|
||||
}
|
||||
|
||||
public bool Has(PointBase p)
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:s="clr-namespace:AIStudio.Wpf.DiagramDesigner">
|
||||
|
||||
<s:BrushOpacityConverter x:Key="BrushOpacityConverter"/>
|
||||
|
||||
<Style x:Key="AIStudio.Styles.Button.Flat" TargetType="{x:Type ButtonBase}">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Foreground" Value="Black" />
|
||||
<Setter Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="3" />
|
||||
<Setter Property="MinHeight" Value="22" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ButtonBase}">
|
||||
<Grid>
|
||||
<Border x:Name="border"
|
||||
Background="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Background}"
|
||||
CornerRadius="3"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}">
|
||||
|
||||
<ContentPresenter x:Name="content" RecognizesAccessKey="True"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
<!--触发器-->
|
||||
<ControlTemplate.Triggers>
|
||||
<!--设置鼠标进入时的背景、前景样式-->
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter Property="Background" TargetName="border" Value="{Binding Foreground,
|
||||
RelativeSource={RelativeSource Mode=TemplatedParent},
|
||||
Converter={StaticResource BrushOpacityConverter},
|
||||
ConverterParameter=0.16}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Opacity" Value="0.5"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
@@ -1,6 +1,6 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:s="clr-namespace:AIStudio.Wpf.DiagramDesigner">
|
||||
xmlns:dd="clr-namespace:AIStudio.Wpf.DiagramDesigner">
|
||||
<!--TextBox水印样式-->
|
||||
<Style TargetType="{x:Type TextBox}" x:Key="WaterTextBox">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
@@ -29,7 +29,7 @@
|
||||
</ScrollViewer>
|
||||
<!--水印-->
|
||||
<TextBlock x:Name="Message" Padding="{TemplateBinding Padding}" Visibility="Collapsed"
|
||||
Text="{TemplateBinding s:ControlAttachProperty.Watermark}" Grid.Column="1"
|
||||
Text="{TemplateBinding dd:ControlAttachProperty.Watermark}" Grid.Column="1"
|
||||
Foreground="{TemplateBinding Foreground}" IsHitTestVisible="False" Opacity="0.5"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="5,2,5,2" />
|
||||
@@ -78,7 +78,7 @@
|
||||
</ScrollViewer>
|
||||
<!--水印-->
|
||||
<TextBlock x:Name="Message" Padding="{TemplateBinding Padding}" Visibility="Collapsed"
|
||||
Text="{TemplateBinding s:ControlAttachProperty.Watermark}" Grid.Column="1"
|
||||
Text="{TemplateBinding dd:ControlAttachProperty.Watermark}" Grid.Column="1"
|
||||
Foreground="{TemplateBinding Foreground}" IsHitTestVisible="False" Opacity="0.5"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="5,2,5,2" />
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:s="clr-namespace:AIStudio.Wpf.DiagramDesigner">
|
||||
xmlns:dd="clr-namespace:AIStudio.Wpf.DiagramDesigner">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Shared.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<Style TargetType="{x:Type s:ZoomBox}">
|
||||
<Style TargetType="{x:Type dd:ZoomBox}">
|
||||
|
||||
<Style.Resources>
|
||||
|
||||
@@ -165,7 +165,7 @@
|
||||
Value="true" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type s:ZoomBox}">
|
||||
<ControlTemplate TargetType="{x:Type dd:ZoomBox}">
|
||||
<Border CornerRadius="1"
|
||||
BorderThickness="1"
|
||||
Background="#EEE"
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:s="clr-namespace:AIStudio.Wpf.DiagramDesigner"
|
||||
xmlns:dd="clr-namespace:AIStudio.Wpf.DiagramDesigner"
|
||||
xmlns:c="clr-namespace:AIStudio.Wpf.DiagramDesigner.Controls">
|
||||
<s:ColorBrushConverter x:Key="ColorBrushConverter" />
|
||||
<s:ConectorOrientationConverter x:Key="ConectorOrientationConverter" />
|
||||
<s:ConectorValueConverter x:Key="ConectorValueConverter"/>
|
||||
<dd:ColorBrushConverter x:Key="ColorBrushConverter" />
|
||||
<dd:ConectorOrientationConverter x:Key="ConectorOrientationConverter" />
|
||||
<dd:ConectorValueConverter x:Key="ConectorValueConverter"/>
|
||||
|
||||
<DataTemplate DataType="{x:Type s:FullyCreatedConnectorInfo}">
|
||||
<DataTemplate DataType="{x:Type dd:FullyCreatedConnectorInfo}">
|
||||
<Grid Width="{Binding ConnectorWidth}" Height="{Binding ConnectorHeight}">
|
||||
<Grid.ContextMenu>
|
||||
<ContextMenu ItemsSource="{Binding MenuOptions}" >
|
||||
@@ -29,7 +29,7 @@
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="{x:Type s:LogicalConnectorInfo}">
|
||||
<DataTemplate DataType="{x:Type dd:LogicalConnectorInfo}">
|
||||
<Grid>
|
||||
<Grid Width="{Binding ConnectorWidth}" Height="{Binding ConnectorHeight}" HorizontalAlignment="Left" VerticalAlignment="Top">
|
||||
<Grid.ContextMenu>
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:s="clr-namespace:AIStudio.Wpf.DiagramDesigner"
|
||||
xmlns:dd="clr-namespace:AIStudio.Wpf.DiagramDesigner"
|
||||
xmlns:c="clr-namespace:AIStudio.Wpf.DiagramDesigner.Controls"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:gif="http://wpfanimatedgif.codeplex.com" >
|
||||
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
||||
<s:ColorBrushConverter x:Key="ColorBrushConverter" />
|
||||
<s:ConectorOrientationConverter x:Key="ConectorOrientationConverter" />
|
||||
<s:ConectorValueConverter x:Key="ConectorValueConverter"/>
|
||||
<s:ArrowPathConverter x:Key="ArrowPathConverter"/>
|
||||
<s:ArrowSizeConverter x:Key="ArrowSizeConverter"/>
|
||||
<s:LineDashConverter x:Key="LineDashConverter"/>
|
||||
<s:ClipConverter x:Key="ClipConverter"/>
|
||||
<dd:ColorBrushConverter x:Key="ColorBrushConverter" />
|
||||
<dd:ConectorOrientationConverter x:Key="ConectorOrientationConverter" />
|
||||
<dd:ConectorValueConverter x:Key="ConectorValueConverter"/>
|
||||
<dd:ArrowPathConverter x:Key="ArrowPathConverter"/>
|
||||
<dd:ArrowSizeConverter x:Key="ArrowSizeConverter"/>
|
||||
<dd:LineDashConverter x:Key="LineDashConverter"/>
|
||||
<dd:ClipConverter x:Key="ClipConverter"/>
|
||||
|
||||
<DataTemplate DataType="{x:Type s:DefaultDesignerItemViewModel}">
|
||||
<DataTemplate DataType="{x:Type dd:DefaultDesignerItemViewModel}">
|
||||
<Grid IsHitTestVisible="False">
|
||||
<Rectangle StrokeThickness="1" Fill="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}" Stroke="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="{x:Type s:TextDesignerItemViewModel}">
|
||||
<DataTemplate DataType="{x:Type dd:TextDesignerItemViewModel}">
|
||||
<Grid >
|
||||
<Border Background="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}" IsHitTestVisible="False"/>
|
||||
<Grid Margin="5">
|
||||
<s:TextControl s:ControlAttachProperty.Watermark="{Binding Watermark}" />
|
||||
<dd:TextControl dd:ControlAttachProperty.Watermark="{Binding Watermark}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="{x:Type s:ShapeDesignerItemViewModel}">
|
||||
<DataTemplate DataType="{x:Type dd:ShapeDesignerItemViewModel}">
|
||||
<Grid IsHitTestVisible="False" Background="White">
|
||||
<Grid.ContextMenu>
|
||||
<ContextMenu>
|
||||
@@ -84,7 +84,7 @@
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Polyline
|
||||
Points="{Binding ConnectionPoints, Converter={x:Static s:ConnectionPointConverter.Instance}}"
|
||||
Points="{Binding ConnectionPoints, Converter={x:Static dd:ConnectionPointConverter.Instance}}"
|
||||
Stroke="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}"
|
||||
StrokeThickness="{Binding ColorViewModel.LineWidth}"
|
||||
Fill="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}"
|
||||
@@ -99,7 +99,7 @@
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Polygon
|
||||
Points="{Binding ConnectionPoints, Converter={x:Static s:ConnectionPointConverter.Instance}}"
|
||||
Points="{Binding ConnectionPoints, Converter={x:Static dd:ConnectionPointConverter.Instance}}"
|
||||
Stroke="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}"
|
||||
StrokeThickness="{Binding ColorViewModel.LineWidth}"
|
||||
Fill="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}"
|
||||
@@ -114,7 +114,7 @@
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Polyline
|
||||
Points="{Binding ConnectionPoints, Converter={x:Static s:ConnectionPointConverter.Instance}}"
|
||||
Points="{Binding ConnectionPoints, Converter={x:Static dd:ConnectionPointConverter.Instance}}"
|
||||
Stroke="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}"
|
||||
StrokeThickness="{Binding ColorViewModel.LineWidth}"
|
||||
Fill="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}"
|
||||
@@ -129,13 +129,13 @@
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="{x:Type s:GroupDesignerItemViewModel}">
|
||||
<DataTemplate DataType="{x:Type dd:GroupDesignerItemViewModel}">
|
||||
<Grid IsHitTestVisible="False">
|
||||
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="{x:Type s:GifImageItemViewModel}">
|
||||
<DataTemplate DataType="{x:Type dd:GifImageItemViewModel}">
|
||||
<Grid IsHitTestVisible="False">
|
||||
<Image Name="PART_Image_run" gif:ImageBehavior.AnimatedSource="{Binding Icon}" gif:ImageBehavior.AutoStart="True" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="Visible"/>
|
||||
<Control x:Name="control" />
|
||||
@@ -147,13 +147,13 @@
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="{x:Type s:VideoItemViewModel}">
|
||||
<DataTemplate DataType="{x:Type dd:VideoItemViewModel}">
|
||||
<Grid IsHitTestVisible="False">
|
||||
<MediaElement x:Name="MediaPlayer" LoadedBehavior="Play" Source="{Binding Icon}" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="Visible"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="{x:Type s:ImageItemViewModel}">
|
||||
<DataTemplate DataType="{x:Type dd:ImageItemViewModel}">
|
||||
<Grid ToolTip="{Binding Icon}">
|
||||
<Grid IsHitTestVisible="False" ClipToBounds="True">
|
||||
<Image x:Name="image" Source="{Binding Icon}" Stretch="Fill"
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:s="clr-namespace:AIStudio.Wpf.DiagramDesigner"
|
||||
xmlns:c="clr-namespace:AIStudio.Wpf.DiagramDesigner.Controls"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:gif="http://wpfanimatedgif.codeplex.com" >
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/AIStudio.Wpf.DiagramDesigner;component/Themes/DesignerItem.xaml" />
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/Button.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/ScrollBar.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/Expander.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramDesigner;component/Styles/GroupBox.xaml" />
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:s="clr-namespace:AIStudio.Wpf.DiagramDesigner"
|
||||
xmlns:dd="clr-namespace:AIStudio.Wpf.DiagramDesigner"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<ItemsControl.ItemsPanel>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:s="clr-namespace:AIStudio.Wpf.DiagramDesigner"
|
||||
xmlns:dd="clr-namespace:AIStudio.Wpf.DiagramDesigner"
|
||||
xmlns:c="clr-namespace:AIStudio.Wpf.DiagramDesigner.Controls"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
@@ -15,16 +15,16 @@
|
||||
<ResourceDictionary Source="/AIStudio.Wpf.DiagramDesigner;component/Themes/Generic.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
||||
<s:ColorBrushConverter x:Key="ColorBrushConverter" />
|
||||
<s:ConectorOrientationConverter x:Key="ConectorOrientationConverter" />
|
||||
<s:ConectorValueConverter x:Key="ConectorValueConverter"/>
|
||||
<s:ArrowPathConverter x:Key="ArrowPathConverter"/>
|
||||
<s:ArrowSizeConverter x:Key="ArrowSizeConverter"/>
|
||||
<s:LineDashConverter x:Key="LineDashConverter"/>
|
||||
<s:ClipConverter x:Key="ClipConverter"/>
|
||||
<s:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
<s:ConectorStyleConverter x:Key="ConectorStyleConverter"/>
|
||||
<s:NotNullOrEmptyToBoolConverter x:Key="NotNullOrEmptyToBoolConverter"/>
|
||||
<dd:ColorBrushConverter x:Key="ColorBrushConverter" />
|
||||
<dd:ConectorOrientationConverter x:Key="ConectorOrientationConverter" />
|
||||
<dd:ConectorValueConverter x:Key="ConectorValueConverter"/>
|
||||
<dd:ArrowPathConverter x:Key="ArrowPathConverter"/>
|
||||
<dd:ArrowSizeConverter x:Key="ArrowSizeConverter"/>
|
||||
<dd:LineDashConverter x:Key="LineDashConverter"/>
|
||||
<dd:ClipConverter x:Key="ClipConverter"/>
|
||||
<dd:InvertBoolConverter x:Key="InvertBoolConverter"/>
|
||||
<dd:ConectorStyleConverter x:Key="ConectorStyleConverter"/>
|
||||
<dd:NotNullOrEmptyToBoolConverter x:Key="NotNullOrEmptyToBoolConverter"/>
|
||||
|
||||
<!-- ResizeDecorator Default Template -->
|
||||
<!--
|
||||
@@ -145,7 +145,7 @@
|
||||
|
||||
<ObjectDataProvider x:Key="ConnectorOrientationMenu" MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="s:ConnectorOrientation" />
|
||||
<x:Type TypeName="dd:ConnectorOrientation" />
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
|
||||
@@ -157,11 +157,11 @@
|
||||
</Style>
|
||||
|
||||
<!-- Connector Style -->
|
||||
<Style x:Key="PointConnectorStyle" TargetType="{x:Type s:PointConnector}">
|
||||
<Style x:Key="PointConnectorStyle" TargetType="{x:Type dd:PointConnector}">
|
||||
<Setter Property="SnapsToDevicePixels" Value="true" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type s:PointConnector}">
|
||||
<ControlTemplate TargetType="{x:Type dd:PointConnector}">
|
||||
<Grid Width="{Binding ConnectorWidth}" Height="{Binding ConnectorHeight}">
|
||||
<!-- transparent extra space makes connector easier to hit -->
|
||||
<Ellipse Fill="Transparent" Margin="-2" />
|
||||
@@ -172,7 +172,7 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="GifImageConnectorContainer" TargetType="{x:Type s:ConnectorContainer}">
|
||||
<Style x:Key="GifImageConnectorContainer" TargetType="{x:Type dd:ConnectorContainer}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ItemsControl}">
|
||||
@@ -182,7 +182,7 @@
|
||||
</Border>
|
||||
<Rectangle Fill="#7F243859" Opacity="0.5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Visibility="{Binding ShouldInsertAnchor, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<i:Interaction.Behaviors>
|
||||
<s:ControlMouseLeftButtonDownCommandBehavior Command="{Binding AddItemCommand}" />
|
||||
<dd:ControlMouseLeftButtonDownCommandBehavior Command="{Binding AddItemCommand}" />
|
||||
</i:Interaction.Behaviors>
|
||||
</Rectangle>
|
||||
</Grid>
|
||||
@@ -208,87 +208,87 @@
|
||||
<ControlTemplate x:Key="ConnectorDecoratorTemplate"
|
||||
TargetType="{x:Type Control}">
|
||||
<Grid Margin="-5">
|
||||
<s:Connector
|
||||
<dd:Connector
|
||||
Content="{Binding LeftConnector}"
|
||||
Cursor="Cross"
|
||||
SnapsToDevicePixels="True"
|
||||
Orientation="Left"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left"
|
||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static s:BoolToVisibilityConverter.Instance}}" />
|
||||
<s:Connector
|
||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
||||
<dd:Connector
|
||||
Content="{Binding TopLeftConnector}"
|
||||
Cursor="Cross"
|
||||
SnapsToDevicePixels="True"
|
||||
Orientation="TopLeft"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Left"
|
||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static s:BoolToVisibilityConverter.Instance}}" />
|
||||
<s:Connector
|
||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
||||
<dd:Connector
|
||||
Content="{Binding TopConnector}"
|
||||
Cursor="Cross"
|
||||
SnapsToDevicePixels="True"
|
||||
Orientation="Top"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Center"
|
||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static s:BoolToVisibilityConverter.Instance}}" />
|
||||
<s:Connector
|
||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
||||
<dd:Connector
|
||||
Content="{Binding TopRightConnector}"
|
||||
Cursor="Cross"
|
||||
SnapsToDevicePixels="True"
|
||||
Orientation="TopRight"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Right"
|
||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static s:BoolToVisibilityConverter.Instance}}" />
|
||||
<s:Connector
|
||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
||||
<dd:Connector
|
||||
Content="{Binding RightConnector}"
|
||||
Cursor="Cross"
|
||||
SnapsToDevicePixels="True"
|
||||
Orientation="Right"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Right"
|
||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static s:BoolToVisibilityConverter.Instance}}" />
|
||||
<s:Connector
|
||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
||||
<dd:Connector
|
||||
Content="{Binding BottomRightConnector}"
|
||||
Cursor="Cross"
|
||||
SnapsToDevicePixels="True"
|
||||
Orientation="BottomRight"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Right"
|
||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static s:BoolToVisibilityConverter.Instance}}" />
|
||||
<s:Connector
|
||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
||||
<dd:Connector
|
||||
Content="{Binding BottomConnector}"
|
||||
Cursor="Cross"
|
||||
SnapsToDevicePixels="True"
|
||||
Orientation="Bottom"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Center"
|
||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static s:BoolToVisibilityConverter.Instance}}" />
|
||||
<s:Connector
|
||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
||||
<dd:Connector
|
||||
Content="{Binding BottomLeftConnector}"
|
||||
Cursor="Cross"
|
||||
SnapsToDevicePixels="True"
|
||||
Orientation="BottomLeft"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Left"
|
||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static s:BoolToVisibilityConverter.Instance}}" />
|
||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTemplate x:Key="InnerConnectorDecoratorTemplate"
|
||||
TargetType="{x:Type Control}">
|
||||
<s:ConnectorContainer x:Name="PART_ConnectorContainer" Style="{StaticResource ItemsControlStyle}" ItemsSource="{Binding Connectors}" Visibility="{Binding Path=ShowConnectors, Converter={x:Static s:BoolToVisibilityConverter.Instance}}">
|
||||
<s:ConnectorContainer.ItemTemplate>
|
||||
<dd:ConnectorContainer x:Name="PART_ConnectorContainer" Style="{StaticResource ItemsControlStyle}" ItemsSource="{Binding Connectors}" Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}">
|
||||
<dd:ConnectorContainer.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<s:Connector
|
||||
<dd:Connector
|
||||
Content="{Binding .}"
|
||||
Cursor="Cross"
|
||||
SnapsToDevicePixels="True"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</s:ConnectorContainer.ItemTemplate>
|
||||
</s:ConnectorContainer>
|
||||
</dd:ConnectorContainer.ItemTemplate>
|
||||
</dd:ConnectorContainer>
|
||||
</ControlTemplate>
|
||||
|
||||
<!--基础类型-->
|
||||
@@ -300,9 +300,9 @@
|
||||
Value="{Binding Top}" />
|
||||
<Setter Property="Canvas.ZIndex"
|
||||
Value="{Binding ZIndex}" />
|
||||
<Setter Property="s:SelectionProps.EnabledForSelection"
|
||||
<Setter Property="dd:SelectionProps.EnabledForSelection"
|
||||
Value="{Binding EnabledForSelection}" />
|
||||
<Setter Property="s:ItemConnectProps.EnabledForConnection"
|
||||
<Setter Property="dd:ItemConnectProps.EnabledForConnection"
|
||||
Value="{Binding EnabledForConnection}" />
|
||||
<Setter Property="Visibility"
|
||||
Value="{Binding Visible,Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||
@@ -368,7 +368,7 @@
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<s:TextControl x:Name="PART_Text" />
|
||||
<dd:TextControl x:Name="PART_Text" />
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
@@ -377,7 +377,7 @@
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<s:TextControl x:Name="PART_Text" />
|
||||
<dd:TextControl x:Name="PART_Text" />
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
@@ -459,7 +459,7 @@
|
||||
Value="{Binding Area.Left}" />
|
||||
<Setter Property="Canvas.ZIndex"
|
||||
Value="{Binding ZIndex}" />
|
||||
<Setter Property="s:SelectionProps.EnabledForSelection"
|
||||
<Setter Property="dd:SelectionProps.EnabledForSelection"
|
||||
Value="{Binding EnabledForSelection}" />
|
||||
<Setter Property="Visibility"
|
||||
Value="{Binding Visible,Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||
@@ -475,11 +475,11 @@
|
||||
<ContextMenu>
|
||||
<MenuItem Header="删除" Command="{Binding DeleteConnectionCommand}" CommandParameter="{Binding}"/>
|
||||
<MenuItem Header="添加文本" Command="{Binding AddLabelCommand}" CommandParameter="{Binding}"/>
|
||||
<MenuItem Header="插入点(按住ctrl可一直插入)" IsCheckable="True" IsChecked="{Binding ShouldInsertAnchor}" IsEnabled="{Binding IsReadOnly,Converter={s:InvertBoolConverter}}" />
|
||||
<MenuItem Header="插入点(按住ctrl可一直插入)" IsCheckable="True" IsChecked="{Binding ShouldInsertAnchor}" IsEnabled="{Binding IsReadOnly,Converter={dd:InvertBoolConverter}}" />
|
||||
</ContextMenu>
|
||||
</Grid.ContextMenu>
|
||||
|
||||
<s:LineControl x:Name="line"/>
|
||||
<dd:LineControl x:Name="line"/>
|
||||
|
||||
<!-- PART_DragThumb -->
|
||||
<c:DragThumb x:Name="PART_DragThumb" Margin="8"
|
||||
@@ -489,8 +489,8 @@
|
||||
</c:DragThumb.InputBindings>
|
||||
</c:DragThumb>
|
||||
|
||||
<s:PointContainer x:Name="PART_VerticesContainer" Style="{StaticResource ItemsControlStyle}" ItemsSource="{Binding Vertices}" Visibility="Collapsed">
|
||||
<s:PointContainer.ItemTemplate>
|
||||
<dd:PointContainer x:Name="PART_VerticesContainer" Style="{StaticResource ItemsControlStyle}" ItemsSource="{Binding Vertices}" Visibility="Collapsed">
|
||||
<dd:PointContainer.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid.ContextMenu>
|
||||
@@ -498,23 +498,23 @@
|
||||
<MenuItem Header="删除" Command="{Binding DeleteVertexCommand}" CommandParameter="{Binding}"/>
|
||||
</ContextMenu>
|
||||
</Grid.ContextMenu>
|
||||
<s:PointConnector Style="{StaticResource PointConnectorStyle}"/>
|
||||
<dd:PointConnector Style="{StaticResource PointConnectorStyle}"/>
|
||||
<c:PointDragThumb Cursor="SizeAll" Opacity="0"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</s:PointContainer.ItemTemplate>
|
||||
<s:PointContainer.Resources>
|
||||
</dd:PointContainer.ItemTemplate>
|
||||
<dd:PointContainer.Resources>
|
||||
<Style TargetType="{x:Type ContentPresenter}">
|
||||
<Setter Property="Canvas.Left" Value="{Binding Left}" />
|
||||
<Setter Property="Canvas.Top" Value="{Binding Top}" />
|
||||
</Style>
|
||||
</s:PointContainer.Resources>
|
||||
</s:PointContainer>
|
||||
</dd:PointContainer.Resources>
|
||||
</dd:PointContainer>
|
||||
|
||||
<s:PointContainer x:Name="PART_LabelsContainer" Style="{StaticResource ItemsControlStyle}" ItemsSource="{Binding Labels}" >
|
||||
<s:PointContainer.ItemTemplate>
|
||||
<dd:PointContainer x:Name="PART_LabelsContainer" Style="{StaticResource ItemsControlStyle}" ItemsSource="{Binding Labels}" >
|
||||
<dd:PointContainer.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid s:SelectionProps.EnabledForSelection="True" Background="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}">
|
||||
<Grid dd:SelectionProps.EnabledForSelection="True" Background="{Binding ColorViewModel.FillColor,Converter={StaticResource ColorBrushConverter}}">
|
||||
<Grid.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="删除" Command="{Binding DeleteLabelCommand}" CommandParameter="{Binding}"/>
|
||||
@@ -525,21 +525,21 @@
|
||||
<MouseBinding MouseAction="LeftDoubleClick" Command="{Binding EditCommand}" CommandParameter="{Binding }" />
|
||||
</c:PointDragThumb.InputBindings>
|
||||
</c:PointDragThumb>
|
||||
<s:TextControl Margin="5" />
|
||||
<dd:TextControl Margin="5" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</s:PointContainer.ItemTemplate>
|
||||
<s:PointContainer.Resources>
|
||||
</dd:PointContainer.ItemTemplate>
|
||||
<dd:PointContainer.Resources>
|
||||
<Style TargetType="{x:Type ContentPresenter}">
|
||||
<Setter Property="Canvas.Left" Value="{Binding Left}" />
|
||||
<Setter Property="Canvas.Top" Value="{Binding Top}" />
|
||||
</Style>
|
||||
</s:PointContainer.Resources>
|
||||
</s:PointContainer>
|
||||
</dd:PointContainer.Resources>
|
||||
</dd:PointContainer>
|
||||
|
||||
<Rectangle Fill="#7F243859" Opacity="0.5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Visibility="{Binding ShouldInsertAnchor, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<i:Interaction.Behaviors>
|
||||
<s:ControlMouseLeftButtonDownCommandBehavior Command="{Binding AddVertexCommand}" />
|
||||
<dd:ControlMouseLeftButtonDownCommandBehavior Command="{Binding AddVertexCommand}" />
|
||||
</i:Interaction.Behaviors>
|
||||
</Rectangle>
|
||||
</Grid>
|
||||
@@ -572,9 +572,9 @@
|
||||
Value="{Binding Left}" />
|
||||
<Setter Property="Canvas.ZIndex"
|
||||
Value="{Binding ZIndex}" />
|
||||
<Setter Property="s:SelectionProps.EnabledForSelection"
|
||||
<Setter Property="dd:SelectionProps.EnabledForSelection"
|
||||
Value="{Binding EnabledForSelection}" />
|
||||
<Setter Property="s:ItemConnectProps.EnabledForConnection"
|
||||
<Setter Property="dd:ItemConnectProps.EnabledForConnection"
|
||||
Value="{Binding EnabledForConnection}" />
|
||||
<Setter Property="Visibility"
|
||||
Value="{Binding Visible,Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||
@@ -608,13 +608,13 @@
|
||||
VerticalAlignment="Stretch"
|
||||
Content="{TemplateBinding Content}" />
|
||||
<!-- PART_ConnectorDecorator -->
|
||||
<s:ConnectorContainer x:Name="PART_ConnectorContainer" Visibility="Hidden" Style="{StaticResource GifImageConnectorContainer}" ItemsSource="{Binding Connectors}">
|
||||
<s:ConnectorContainer.ItemTemplate>
|
||||
<dd:ConnectorContainer x:Name="PART_ConnectorContainer" Visibility="Hidden" Style="{StaticResource GifImageConnectorContainer}" ItemsSource="{Binding Connectors}">
|
||||
<dd:ConnectorContainer.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<s:Connector Content="{Binding .}" Cursor="Cross" SnapsToDevicePixels="True"/>
|
||||
<dd:Connector Content="{Binding .}" Cursor="Cross" SnapsToDevicePixels="True"/>
|
||||
</DataTemplate>
|
||||
</s:ConnectorContainer.ItemTemplate>
|
||||
</s:ConnectorContainer>
|
||||
</dd:ConnectorContainer.ItemTemplate>
|
||||
</dd:ConnectorContainer>
|
||||
<Grid.RenderTransform>
|
||||
<TransformGroup>
|
||||
<RotateTransform Angle="{Binding Angle}" />
|
||||
@@ -652,9 +652,9 @@
|
||||
Value="{Binding Left}" />
|
||||
<Setter Property="Canvas.ZIndex"
|
||||
Value="{Binding ZIndex}" />
|
||||
<Setter Property="s:SelectionProps.EnabledForSelection"
|
||||
<Setter Property="dd:SelectionProps.EnabledForSelection"
|
||||
Value="{Binding EnabledForSelection}" />
|
||||
<Setter Property="s:ItemConnectProps.EnabledForConnection"
|
||||
<Setter Property="dd:ItemConnectProps.EnabledForConnection"
|
||||
Value="{Binding EnabledForConnection}" />
|
||||
<Setter Property="Visibility"
|
||||
Value="{Binding Visible,Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||
@@ -685,15 +685,15 @@
|
||||
</Grid.ContextMenu>
|
||||
|
||||
<!--PART_ConnectorDecorator-->
|
||||
<s:ConnectorContainer x:Name="PART_ConnectorContainer" Style="{StaticResource ItemsControlStyle}" ItemsSource="{Binding Connectors}" Margin="0,0,0,0">
|
||||
<s:ConnectorContainer.ItemTemplate>
|
||||
<dd:ConnectorContainer x:Name="PART_ConnectorContainer" Style="{StaticResource ItemsControlStyle}" ItemsSource="{Binding Connectors}" Margin="0,0,0,0">
|
||||
<dd:ConnectorContainer.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<s:Connector Content="{Binding .}" Cursor="Cross" SnapsToDevicePixels="True"/>
|
||||
<dd:Connector Content="{Binding .}" Cursor="Cross" SnapsToDevicePixels="True"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</s:ConnectorContainer.ItemTemplate>
|
||||
</s:ConnectorContainer>
|
||||
</dd:ConnectorContainer.ItemTemplate>
|
||||
</dd:ConnectorContainer>
|
||||
<!-- PART_DragThumb -->
|
||||
<c:DragThumb x:Name="PART_DragThumb"
|
||||
Cursor="SizeAll" >
|
||||
@@ -733,7 +733,7 @@
|
||||
Value="{Binding Left}" />
|
||||
<Setter Property="Canvas.ZIndex"
|
||||
Value="{Binding ZIndex}" />
|
||||
<Setter Property="s:SelectionProps.EnabledForSelection"
|
||||
<Setter Property="dd:SelectionProps.EnabledForSelection"
|
||||
Value="{Binding EnabledForSelection}" />
|
||||
<Setter Property="Visibility"
|
||||
Value="{Binding Visible,Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||
@@ -746,11 +746,11 @@
|
||||
<Setter Property="ContentTemplate">
|
||||
<Setter.Value>
|
||||
<DataTemplate>
|
||||
<Grid x:Name="selectedGrid" Visibility="{Binding Path=ShowConnectors, Converter={x:Static s:BoolToVisibilityConverter.Instance}}">
|
||||
<Grid x:Name="selectedGrid" Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}">
|
||||
<!-- PART_ConnectorDecorator -->
|
||||
<Grid Margin="-5"
|
||||
x:Name="PART_ConnectorDecorator">
|
||||
<s:PointConnector DataContext="{Binding TopConnector}" Style="{StaticResource PointConnectorStyle}"/>
|
||||
<dd:PointConnector DataContext="{Binding TopConnector}" Style="{StaticResource PointConnectorStyle}"/>
|
||||
</Grid>
|
||||
<!-- PART_DragThumb -->
|
||||
<c:DragThumb x:Name="PART_DragThumb"
|
||||
@@ -779,9 +779,9 @@
|
||||
Value="{Binding Left}" />
|
||||
<Setter Property="Canvas.ZIndex"
|
||||
Value="{Binding ZIndex}" />
|
||||
<Setter Property="s:SelectionProps.EnabledForSelection"
|
||||
<Setter Property="dd:SelectionProps.EnabledForSelection"
|
||||
Value="{Binding EnabledForSelection}" />
|
||||
<Setter Property="s:ItemConnectProps.EnabledForConnection"
|
||||
<Setter Property="dd:ItemConnectProps.EnabledForConnection"
|
||||
Value="{Binding EnabledForConnection}" />
|
||||
<Setter Property="Visibility"
|
||||
Value="{Binding Visible,Converter={StaticResource BooleanToVisibilityConverter}}"/>
|
||||
@@ -799,12 +799,12 @@
|
||||
<!-- PART_ConnectorDecorator -->
|
||||
<Grid Margin="-5"
|
||||
x:Name="PART_ConnectorDecorator">
|
||||
<s:Connector Content="{Binding Connectors[0]}"
|
||||
<dd:Connector Content="{Binding Connectors[0]}"
|
||||
Cursor="Cross"
|
||||
SnapsToDevicePixels="True"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static s:BoolToVisibilityConverter.Instance}}" />
|
||||
Visibility="{Binding Path=ShowConnectors, Converter={x:Static dd:BoolToVisibilityConverter.Instance}}" />
|
||||
</Grid>
|
||||
<!-- PART_DragThumb -->
|
||||
<c:DragThumb x:Name="PART_DragThumb"
|
||||
@@ -835,10 +835,10 @@
|
||||
<ControlTemplate>
|
||||
<Grid>
|
||||
<ItemsControl ItemsSource="{Binding Items}"
|
||||
ItemContainerStyleSelector="{x:Static s:DesignerItemsControlItemStyleSelector.Instance}">
|
||||
ItemContainerStyleSelector="{x:Static dd:DesignerItemsControlItemStyleSelector.Instance}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<s:DesignerCanvas
|
||||
<dd:DesignerCanvas
|
||||
Height="{Binding PageSize.Height}"
|
||||
Width="{Binding PageSize.Width}"
|
||||
ShowGrid="{Binding ShowGrid}"
|
||||
@@ -847,10 +847,10 @@
|
||||
GridColor="{Binding GridColor}"
|
||||
Background="{Binding PageBackground,Converter={StaticResource ColorBrushConverter}}"
|
||||
AllowDrop="{Binding AllowDrop}">
|
||||
<s:DesignerCanvas.LayoutTransform>
|
||||
<dd:DesignerCanvas.LayoutTransform>
|
||||
<ScaleTransform ScaleX="{Binding ZoomValue}" ScaleY="{Binding ZoomValue}" />
|
||||
</s:DesignerCanvas.LayoutTransform>
|
||||
</s:DesignerCanvas>
|
||||
</dd:DesignerCanvas.LayoutTransform>
|
||||
</dd:DesignerCanvas>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
|
||||
@@ -870,10 +870,10 @@
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<ItemsControl x:Name="diagram" ItemsSource="{Binding Items}"
|
||||
ItemContainerStyleSelector="{x:Static s:DesignerItemsControlItemStyleSelector.Instance}">
|
||||
ItemContainerStyleSelector="{x:Static dd:DesignerItemsControlItemStyleSelector.Instance}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<s:DesignerCanvas
|
||||
<dd:DesignerCanvas
|
||||
Height="{Binding PageSize.Height}"
|
||||
Width="{Binding PageSize.Width}"
|
||||
ShowGrid="{Binding ShowGrid}"
|
||||
@@ -882,16 +882,16 @@
|
||||
GridColor="{Binding GridColor}"
|
||||
Background="{Binding PageBackground,Converter={StaticResource ColorBrushConverter}}"
|
||||
AllowDrop="{Binding AllowDrop}">
|
||||
<s:DesignerCanvas.LayoutTransform>
|
||||
<dd:DesignerCanvas.LayoutTransform>
|
||||
<ScaleTransform ScaleX="{Binding ZoomValue}" ScaleY="{Binding ZoomValue}" />
|
||||
</s:DesignerCanvas.LayoutTransform>
|
||||
</s:DesignerCanvas>
|
||||
</dd:DesignerCanvas.LayoutTransform>
|
||||
</dd:DesignerCanvas>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
<s:ZoomBox x:Name="zoomBox"
|
||||
<dd:ZoomBox x:Name="zoomBox"
|
||||
Width="180"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:s="clr-namespace:AIStudio.Wpf.DiagramDesigner"
|
||||
xmlns:dd="clr-namespace:AIStudio.Wpf.DiagramDesigner"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<s:ColorBrushConverter x:Key="ColorBrushConverter" />
|
||||
<s:LineDashConverter x:Key="LineDashConverter"/>
|
||||
<s:ArrowPathConverter x:Key="ArrowPathConverter"/>
|
||||
<s:ArrowSizeConverter x:Key="ArrowSizeConverter"/>
|
||||
<s:MathConverter x:Key="MathAddConverter" Operation="Add" />
|
||||
<dd:ColorBrushConverter x:Key="ColorBrushConverter" />
|
||||
<dd:LineDashConverter x:Key="LineDashConverter"/>
|
||||
<dd:ArrowPathConverter x:Key="ArrowPathConverter"/>
|
||||
<dd:ArrowSizeConverter x:Key="ArrowSizeConverter"/>
|
||||
<dd:MathConverter x:Key="MathAddConverter" Operation="Add" />
|
||||
<Style x:Key="LineStyle" TargetType="Path">
|
||||
<Setter Property="Stroke" Value="{Binding ColorViewModel.LineColor,Converter={StaticResource ColorBrushConverter}}"/>
|
||||
<Style.Triggers>
|
||||
@@ -40,7 +40,7 @@
|
||||
StrokeStartLineCap="Round"
|
||||
StrokeEndLineCap="Round">
|
||||
<Path.Data>
|
||||
<MultiBinding Converter="{x:Static s:ConnectionPathConverter.Instance}">
|
||||
<MultiBinding Converter="{x:Static dd:ConnectionPathConverter.Instance}">
|
||||
<Binding Path="PathGeneratorResult"/>
|
||||
</MultiBinding>
|
||||
</Path.Data>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:s="clr-namespace:AIStudio.Wpf.DiagramDesigner"
|
||||
xmlns:dd="clr-namespace:AIStudio.Wpf.DiagramDesigner"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
@@ -11,8 +11,8 @@
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/AIStudio.Wpf.DiagramDesigner;component/Styles/TextBox.xaml" />
|
||||
<ResourceDictionary>
|
||||
<s:ColorBrushConverter x:Key="ColorBrushConverter" />
|
||||
<s:TrueToFalseConverter x:Key="TrueToFalseConverter"/>
|
||||
<dd:ColorBrushConverter x:Key="ColorBrushConverter" />
|
||||
<dd:TrueToFalseConverter x:Key="TrueToFalseConverter"/>
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
@@ -32,7 +32,7 @@
|
||||
TextBlock.LineHeight="{Binding FontViewModel.LineHeight}"
|
||||
AcceptsReturn="True"
|
||||
IsHitTestVisible="False"
|
||||
s:ControlAttachProperty.Watermark="{Binding Path=(s:ControlAttachProperty.Watermark),RelativeSource={RelativeSource AncestorType={x:Type s:TextControl}}}"
|
||||
dd:ControlAttachProperty.Watermark="{Binding Path=(dd:ControlAttachProperty.Watermark),RelativeSource={RelativeSource AncestorType={x:Type dd:TextControl}}}"
|
||||
Style="{StaticResource WaterTextBoxWithEffect}" IsReadOnly="True">
|
||||
|
||||
</TextBox>
|
||||
@@ -50,7 +50,7 @@
|
||||
VerticalContentAlignment="{Binding FontViewModel.VerticalAlignment}"
|
||||
TextBlock.LineHeight="{Binding FontViewModel.LineHeight}"
|
||||
AcceptsReturn="True"
|
||||
s:ControlAttachProperty.Watermark="{Binding Path=(s:ControlAttachProperty.Watermark),RelativeSource={RelativeSource AncestorType={x:Type s:TextControl}}}"
|
||||
dd:ControlAttachProperty.Watermark="{Binding Path=(dd:ControlAttachProperty.Watermark),RelativeSource={RelativeSource AncestorType={x:Type dd:TextControl}}}"
|
||||
Style="{StaticResource WaterTextBoxWithEffect}" Visibility="Collapsed">
|
||||
</TextBox>
|
||||
|
||||
|
||||
@@ -40,13 +40,14 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
this.Loaded -= TextControl_Loaded;
|
||||
|
||||
PART_ShowText.Visibility = Visibility.Visible;
|
||||
PART_TextBlock.Visibility = Visibility.Collapsed;
|
||||
PART_ShowText.Focus();
|
||||
if (!string.IsNullOrEmpty(PART_ShowText.Text))
|
||||
{
|
||||
PART_ShowText.SelectionStart = PART_ShowText.Text.Length;
|
||||
}
|
||||
//新建后处于编辑状态,暂时关闭
|
||||
//PART_ShowText.Visibility = Visibility.Visible;
|
||||
//PART_TextBlock.Visibility = Visibility.Collapsed;
|
||||
//PART_ShowText.Focus();
|
||||
//if (!string.IsNullOrEmpty(PART_ShowText.Text))
|
||||
//{
|
||||
// PART_ShowText.SelectionStart = PART_ShowText.Text.Length;
|
||||
//}
|
||||
|
||||
if (this.DataContext is ISelectable selectable)
|
||||
{
|
||||
@@ -74,6 +75,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
PART_ShowText.Visibility = Visibility.Collapsed;
|
||||
PART_TextBlock.Visibility = Visibility.Visible;
|
||||
selectable.IsEditing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,14 +448,20 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
break;
|
||||
case nameof(SourceConnectorInfo):
|
||||
SourceA = PointHelper.GetPointForConnector(SourceConnectorInfo);
|
||||
SourceConnectorInfo.DataItem.PropertyChanged += new WeakINPCEventHandler(ConnectorViewModel_PropertyChanged).Handler;
|
||||
if (SourceConnectorInfo != null)
|
||||
{
|
||||
SourceA = PointHelper.GetPointForConnector(SourceConnectorInfo);
|
||||
SourceConnectorInfo.DataItem.PropertyChanged += new WeakINPCEventHandler(ConnectorViewModel_PropertyChanged).Handler;
|
||||
}
|
||||
break;
|
||||
case nameof(SinkConnectorInfo):
|
||||
SourceB = SinkConnectorInfo.Position;
|
||||
if (SinkConnectorInfo is FullyCreatedConnectorInfo)
|
||||
if (SinkConnectorInfo != null)
|
||||
{
|
||||
SinkConnectorInfoFully.DataItem.PropertyChanged += new WeakINPCEventHandler(ConnectorViewModel_PropertyChanged).Handler;
|
||||
SourceB = SinkConnectorInfo.Position;
|
||||
if (IsFullConnection)
|
||||
{
|
||||
SinkConnectorInfoFully.DataItem.PropertyChanged += new WeakINPCEventHandler(ConnectorViewModel_PropertyChanged).Handler;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case nameof(IsSelected):
|
||||
|
||||
@@ -26,6 +26,14 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
}
|
||||
|
||||
public SelectableDesignerItemViewModelBase SelectedItem
|
||||
{
|
||||
get
|
||||
{
|
||||
return SelectedItems.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
private SelectionService selectionService;
|
||||
public SelectionService SelectionService
|
||||
{
|
||||
@@ -646,6 +654,11 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public SimpleCommand SelectItemCommand
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public SimpleCommand CopyCommand
|
||||
{
|
||||
get; private set;
|
||||
@@ -723,6 +736,11 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public SimpleCommand EditCommand
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
private SimpleCommand _undoCommand;
|
||||
public SimpleCommand UndoCommand
|
||||
{
|
||||
@@ -742,7 +760,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
#endregion
|
||||
|
||||
private DoCommandManager DoCommandManager = new DoCommandManager();
|
||||
public DoCommandManager DoCommandManager = new DoCommandManager();
|
||||
|
||||
public event DiagramEventHandler Event;
|
||||
|
||||
@@ -770,6 +788,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
DistributeHorizontalCommand = new SimpleCommand(ExecuteEnable, ExecuteDistributeHorizontalCommand);
|
||||
DistributeVerticalCommand = new SimpleCommand(ExecuteEnable, ExecuteDistributeVerticalCommand);
|
||||
SelectAllCommand = new SimpleCommand(ExecuteEnable, ExecuteSelectAllCommand);
|
||||
SelectItemCommand = new SimpleCommand(ExecuteEnable, ExecuteSelectItemCommand);
|
||||
CopyCommand = new SimpleCommand(ExecuteEnable, ExecuteCopyCommand);
|
||||
PasteCommand = new SimpleCommand(ExecuteEnable, ExecutePasteCommand);
|
||||
CutCommand = new SimpleCommand(ExecuteEnable, ExecuteCutCommand);
|
||||
@@ -787,6 +806,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
UngroupCommand = new SimpleCommand(ExecuteEnable, ExecuteUngroupCommand);
|
||||
LockCommand = new SimpleCommand(ExecuteEnable, ExecuteLockCommand);
|
||||
UnlockCommand = new SimpleCommand(ExecuteEnable, ExecuteUnlockCommand);
|
||||
EditCommand = new SimpleCommand(ExecuteEnable, ExecuteEditCommand);
|
||||
Mediator.Instance.Register(this);
|
||||
|
||||
Items.CollectionChanged += Items_CollectionChanged;
|
||||
@@ -815,7 +835,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
AllowDrop = diagramItem.AllowDrop;
|
||||
}
|
||||
|
||||
public bool ExecuteEnable(object para)
|
||||
public virtual bool ExecuteEnable(object para)
|
||||
{
|
||||
return IsReadOnly == false;
|
||||
}
|
||||
@@ -832,7 +852,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
sender.SetPropertyValue(propertyName, oldvalue);
|
||||
}
|
||||
|
||||
private bool _undoing;
|
||||
|
||||
private void UndoExecuted(object para)
|
||||
{
|
||||
Undo(para);
|
||||
@@ -845,11 +865,9 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_undoing = true;
|
||||
|
||||
DoCommandManager.UnDo();
|
||||
_undoing = false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -865,10 +883,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
_undoing = true;
|
||||
DoCommandManager.ReDo();
|
||||
_undoing = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -909,8 +924,6 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
RaisePropertyChanged(sender, e.PropertyName);
|
||||
|
||||
if (_undoing == true) return;
|
||||
|
||||
//连续改变,需要特殊处理,不单独触发属性改变ReDo
|
||||
if (sender is DesignerItemViewModelBase designer)
|
||||
{
|
||||
@@ -1121,6 +1134,14 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
item.IsSelected = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void ExecuteSelectItemCommand(object parameter)
|
||||
{
|
||||
if (parameter is ISelectable selectable)
|
||||
{
|
||||
selectable.IsSelected = true;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 布局
|
||||
@@ -2259,5 +2280,19 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected virtual void ExecuteEditCommand(object parameter)
|
||||
{
|
||||
if (parameter is SelectableDesignerItemViewModelBase designerItem)
|
||||
{
|
||||
designerItem.ShowText = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SelectedItem != null)
|
||||
SelectedItem.ShowText = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,10 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
get;
|
||||
}
|
||||
SelectableDesignerItemViewModelBase SelectedItem
|
||||
{
|
||||
get;
|
||||
}
|
||||
ObservableCollection<SelectableDesignerItemViewModelBase> Items
|
||||
{
|
||||
get;
|
||||
@@ -104,6 +108,10 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
get;
|
||||
}
|
||||
SimpleCommand SelectItemCommand
|
||||
{
|
||||
get;
|
||||
}
|
||||
SimpleCommand CopyCommand
|
||||
{
|
||||
get;
|
||||
|
||||
Reference in New Issue
Block a user