整理了下代码,摸一摸bug

This commit is contained in:
艾竹
2023-05-21 23:03:28 +08:00
parent fde899cfa9
commit b11d39024a
13 changed files with 51 additions and 20 deletions

View File

@@ -264,6 +264,9 @@
</ItemGroup>
<ItemGroup>
<None Update="Images\Gifs\car_chase.gif">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Images\Svgs\account-book.svg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

View File

Before

Width:  |  Height:  |  Size: 4.5 MiB

After

Width:  |  Height:  |  Size: 4.5 MiB

View File

@@ -42,13 +42,13 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
DesignerItemViewModelBase start = new StartFlowNode() { Left = 100, Top = 0, ItemWidth = 80, ItemHeight = 40, StatusColor = Colors.Yellow.ToString() };
DiagramViewModel.Add(start);
DesignerItemViewModelBase middle1 = new MiddleFlowNode() { Left = 100, Top = 100, ItemWidth = 80, ItemHeight = 40, StatusColor = Colors.Yellow.ToString(), Text = "主管审批", UserIds= new List<string> { "操作员1", "操作员2" }, ActType = "or", SimulateApprove = true };
DesignerItemViewModelBase middle1 = new MiddleFlowNode() { Left = 100, Top = 100, ItemWidth = 80, ItemHeight = 40, StatusColor = Colors.Yellow.ToString(), Text = "主管审批(两人或)", UserIds= new List<string> { "操作员1", "操作员2" }, ActType = "or", SimulateApprove = true };
DiagramViewModel.Add(middle1);
DesignerItemViewModelBase decide = new DecideFlowNode() { Left = 100, Top = 200, ItemWidth = 80, ItemHeight = 40, StatusColor = Colors.Yellow.ToString(), Text = "5" };
DiagramViewModel.Add(decide);
DesignerItemViewModelBase middle2 = new MiddleFlowNode() { Left = 200, Top = 300, ItemWidth = 80, ItemHeight = 40, StatusColor = Colors.Yellow.ToString(), Text = "分管领导", UserIds = new List<string> { "操作员1", "操作员2" }, ActType = "and", SimulateApprove = true };
DesignerItemViewModelBase middle2 = new MiddleFlowNode() { Left = 200, Top = 300, ItemWidth = 80, ItemHeight = 40, StatusColor = Colors.Yellow.ToString(), Text = "分管领导(两人与)", UserIds = new List<string> { "操作员1", "操作员2" }, ActType = "and", SimulateApprove = true };
DiagramViewModel.Add(middle2);
DesignerItemViewModelBase cobegin = new COBeginFlowNode() { Left = 100, Top = 400, ItemWidth = 80, ItemHeight = 40, StatusColor = Colors.Yellow.ToString() };
@@ -101,7 +101,7 @@ namespace AIStudio.Wpf.DiagramApp.ViewModels
TextDesignerItemViewModel despcription = new TextDesignerItemViewModel()
{
Name = nameof(despcription),
Left = 260,
Left = 360,
Top = 60,
ItemWidth = 300,
ItemHeight = 150,

View File

@@ -13,6 +13,12 @@
<Description>一个Wpf的Diagram控件帮助库</Description>
</PropertyGroup>
<ItemGroup>
<None Remove="Images\Bold.png" />
<None Remove="Images\Italic.png" />
<None Remove="Images\Underline.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Fluent.Ribbon" Version="8.0.3" />
<PackageReference Include="MahApps.Metro.IconPacks" Version="4.8.0" />
@@ -32,4 +38,10 @@
</None>
</ItemGroup>
<ItemGroup>
<Resource Include="Images\Bold.png" />
<Resource Include="Images\Italic.png" />
<Resource Include="Images\Underline.png" />
</ItemGroup>
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -47,12 +47,6 @@
<Resource Include="Images\FormatPainter.cur" />
</ItemGroup>
<ItemGroup>
<None Update="Images\Gifs\car_chase.gif">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Page Update="Controls\MultiSelectComboBox.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>

View File

@@ -43,5 +43,18 @@ namespace AIStudio.Wpf.DiagramDesigner
ColorViewModel.LineColor.Color = Colors.Transparent;
ColorViewModel.FillColor.Color = Colors.Transparent;
}
public override bool CanAttachTo(ConnectorInfoBase port)
{
if (port is BlockConnectorInfo blockConnectorInfo)
{
return port != this && !port.IsReadOnly && DataItem != blockConnectorInfo.DataItem;
}
else
{
return false;
}
}
}
}

View File

@@ -1187,7 +1187,7 @@ namespace AIStudio.Wpf.DiagramDesigner
}
else if (parameter is IEnumerable<SelectableDesignerItemViewModelBase> items)
{
if (items.Select(p => AddVerify(p)).Any() != true) return;
if (items.Select(p => AddVerify(p)).ToList().Any() != true) return;
foreach (var item in items)
{

View File

@@ -88,7 +88,7 @@ namespace AIStudio.Wpf.DiagramDesigner
get { return _suffix; }
set
{
SetProperty(ref _suffix, filter.Contains(value) ? value : ".txt");
SetProperty(ref _suffix, value != null && filter.Contains(value) ? value : ".txt");
}
}
@@ -167,8 +167,10 @@ namespace AIStudio.Wpf.DiagramDesigner
return;
}
System.Diagnostics.Process.Start(Icon);
if (!string.IsNullOrEmpty(Icon))
{
System.Diagnostics.Process.Start(Icon);
}
}
public void InitWidthAndHeight()

View File

@@ -41,11 +41,14 @@ namespace AIStudio.Wpf.DiagramDesigner
if (IsFinish)
{
var path = GetPath();
var rect = new Rect(Points[0], Points[1]);
var point0 = rect.TopLeft;
var point1 = rect.BottomRight;
PathGeometry pathGeometry = PathGeometry.CreateFromGeometry(Geometry.Parse(path));
var transformGroup = new TransformGroup();
double radiox = Math.Abs(Points[1].X - Points[0].X) / pathGeometry.Bounds.Width;
double radioy = Math.Abs(Points[1].Y - Points[0].Y) / pathGeometry.Bounds.Height;
transformGroup.Children.Add(new TranslateTransform((Points[0].X) / radiox - pathGeometry.Bounds.Left, (Points[0].Y) / radioy - pathGeometry.Bounds.Top));
double radiox = Math.Abs(point1.X - point0.X) / pathGeometry.Bounds.Width;
double radioy = Math.Abs(point1.Y - point0.Y) / pathGeometry.Bounds.Height;
transformGroup.Children.Add(new TranslateTransform((point0.X) / radiox - pathGeometry.Bounds.Left, (point0.Y) / radioy - pathGeometry.Bounds.Top));
transformGroup.Children.Add(new ScaleTransform(radiox, radioy));
pathGeometry.Transform = transformGroup;
Geometry = pathGeometry;
@@ -85,11 +88,15 @@ namespace AIStudio.Wpf.DiagramDesigner
}
var path = GetPath();
var rect = new Rect(Points[0], Points[1]);
var point0 = rect.TopLeft;
var point1 = rect.BottomRight;
PathGeometry pathGeometry = PathGeometry.CreateFromGeometry(Geometry.Parse(path));
var transformGroup = new TransformGroup();
double radiox = Math.Abs(point.X - Points[0].X) / pathGeometry.Bounds.Width;
double radioy = Math.Abs(point.Y - Points[0].Y) / pathGeometry.Bounds.Height;
transformGroup.Children.Add(new TranslateTransform((Points[0].X) / radiox - pathGeometry.Bounds.Left, (Points[0].Y) / radioy - pathGeometry.Bounds.Top));
double radiox = Math.Abs(point1.X - point0.X) / pathGeometry.Bounds.Width;
double radioy = Math.Abs(point1.Y - point0.Y) / pathGeometry.Bounds.Height;
transformGroup.Children.Add(new TranslateTransform((point0.X) / radiox - pathGeometry.Bounds.Left, (point0.Y) / radioy - pathGeometry.Bounds.Top));
transformGroup.Children.Add(new ScaleTransform(radiox, radioy));
pathGeometry.Transform = transformGroup;
Geometry = pathGeometry;

View File

@@ -35,7 +35,7 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
}
}
private string _remark;
private string _remark = "同意";
public string Remark
{
get