性能问题优化

This commit is contained in:
艾竹
2023-02-12 15:46:44 +08:00
parent da2d8cd9b3
commit 1c03c0f055
10 changed files with 66 additions and 55 deletions

View File

@@ -27,6 +27,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AIStudio.Wpf.DiagramDesigner.Additionals", "AIStudio.Wpf.DiagramDesigner.Additionals\AIStudio.Wpf.DiagramDesigner.Additionals.csproj", "{186F34AC-4BC5-40E1-911B-DD3E96AECE6E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AIStudio.Wpf.Mind", "AIStudio.Wpf.Mind\AIStudio.Wpf.Mind.csproj", "{85C437B9-16D2-4076-ABCD-52029AC232FC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -61,6 +63,10 @@ Global
{186F34AC-4BC5-40E1-911B-DD3E96AECE6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{186F34AC-4BC5-40E1-911B-DD3E96AECE6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{186F34AC-4BC5-40E1-911B-DD3E96AECE6E}.Release|Any CPU.Build.0 = Release|Any CPU
{85C437B9-16D2-4076-ABCD-52029AC232FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{85C437B9-16D2-4076-ABCD-52029AC232FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{85C437B9-16D2-4076-ABCD-52029AC232FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{85C437B9-16D2-4076-ABCD-52029AC232FC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -69,6 +75,7 @@ Global
{86ED5B40-D185-4AFA-B5BD-BC8E78DB8758} = {4959F170-02FB-4B7F-8F53-93DAF22713F9}
{CC68D39D-7935-4079-9CEB-FC2FD498D511} = {4959F170-02FB-4B7F-8F53-93DAF22713F9}
{2AB69067-277E-4EE0-9949-8326A145EEE4} = {4959F170-02FB-4B7F-8F53-93DAF22713F9}
{85C437B9-16D2-4076-ABCD-52029AC232FC} = {4959F170-02FB-4B7F-8F53-93DAF22713F9}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D30FC641-F06C-4E35-AEA5-48A9B6E59CE0}

View File

@@ -52,16 +52,16 @@ namespace AIStudio.Wpf.Flowchart
DesignerItemViewModelBase decide = new DecideFlowNode() { Left = 100, Top = 200, ItemWidth = 80, ItemHeight = 40, Color = Colors.Yellow.ToString(), Text = "5" };
DiagramViewModel.DirectAddItemCommand.Execute(decide);
DesignerItemViewModelBase middle2 = new MiddleFlowNode() { Left = 200, Top = 300, ItemWidth = 80, ItemHeight = 40, Color = Colors.Yellow.ToString(), Text = "分管领导", UserIds = new List<string> { "操作员1", "操作员2" }, ActType = "and" };
DesignerItemViewModelBase middle2 = new MiddleFlowNode() { Left = 200, Top = 300, ItemWidth = 80, ItemHeight = 40, Color = Colors.Yellow.ToString(), Text = "分管领导", UserIds = new List<string> { "操作员1", "操作员2" }, ActType = "and", DoubleApprove = true };
DiagramViewModel.DirectAddItemCommand.Execute(middle2);
DesignerItemViewModelBase cobegin = new COBeginFlowNode() { Left = 100, Top = 400, ItemWidth = 80, ItemHeight = 40, Color = Colors.Yellow.ToString() };
DiagramViewModel.DirectAddItemCommand.Execute(cobegin);
DesignerItemViewModelBase middle3 = new MiddleFlowNode() { Left = 100, Top = 500, ItemWidth = 80, ItemHeight = 40, Color = Colors.Yellow.ToString(), Text = "财务审批", UserIds = new List<string> { "Admin" }, ActType = "or" };
DesignerItemViewModelBase middle3 = new MiddleFlowNode() { Left = 100, Top = 500, ItemWidth = 80, ItemHeight = 40, Color = Colors.Yellow.ToString(), Text = "财务审批", UserIds = new List<string> { "Admin" }, ActType = "or", DoubleApprove = true };
DiagramViewModel.DirectAddItemCommand.Execute(middle3);
DesignerItemViewModelBase middle4 = new MiddleFlowNode() { Left = 200, Top = 500, ItemWidth = 80, ItemHeight = 40, Color = Colors.Yellow.ToString(), Text = "人力审批", RoleIds = new List<string> { "操作员", "管理员" }, ActType = "or" };
DesignerItemViewModelBase middle4 = new MiddleFlowNode() { Left = 200, Top = 500, ItemWidth = 80, ItemHeight = 40, Color = Colors.Yellow.ToString(), Text = "人力审批", RoleIds = new List<string> { "操作员", "管理员" }, ActType = "or", DoubleApprove = true };
DiagramViewModel.DirectAddItemCommand.Execute(middle4);
DesignerItemViewModelBase coend = new COEndFlowNode() { Left = 100, Top = 600, ItemWidth = 80, ItemHeight = 40, Color = Colors.Yellow.ToString() };

View File

@@ -25,19 +25,13 @@
<Style x:Key="gridHorizontalLineStyle" TargetType="Line" BasedOn="{StaticResource gridLineStyle}">
<Setter Property="X2" Value="1" />
<Setter Property="VerticalAlignment" Value="Bottom" />
<Setter Property="Grid.ColumnSpan"
Value="{Binding
Path=ColumnDefinitions.Count,
RelativeSource={RelativeSource AncestorType=Grid}}"/>
<Setter Property="Grid.ColumnSpan" Value="2"/>
</Style>
<Style x:Key="gridVerticalLineStyle" TargetType="Line" BasedOn="{StaticResource gridLineStyle}">
<Setter Property="Y2" Value="1" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="Grid.RowSpan"
Value="{Binding
Path=RowDefinitions.Count,
RelativeSource={RelativeSource AncestorType=Grid}}"/>
<Setter Property="Grid.RowSpan" Value="1000"/>
</Style>
</Border.Resources>

View File

@@ -45,14 +45,7 @@ namespace AIStudio.Wpf.DiagramDesigner.Controls
protected virtual void OnSelectedObjectChanged(object oldValue, object newValue)
{
// We do not want to process the change now if the grid is initializing (ie. BeginInit/EndInit).
var obj = oldValue as INotifyPropertyChanged;
if (obj != null)
obj.PropertyChanged -= PropertyChanged;
DisplayProperties();
obj = newValue as INotifyPropertyChanged;
if (obj != null)
obj.PropertyChanged += PropertyChanged;
}
#endregion //SelectedObject
@@ -87,11 +80,6 @@ namespace AIStudio.Wpf.DiagramDesigner.Controls
DisplayProperties();
}
void PropertyChanged(object sender, PropertyChangedEventArgs e)
{
DisplayProperties();
}
private void DisplayProperties()
{
_panel.Children.Clear();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -248,30 +248,12 @@ namespace AIStudio.Wpf.Flowchart.Controls
}
#endregion
//protected override void OnPreviewKeyDown(KeyEventArgs e)
//{
// base.OnPreviewKeyDown(e);
// bool executed = true;
// var para = e.KeyboardDevice.Modifiers == ModifierKeys.None ? e.Key.ToString() : e.KeyboardDevice.Modifiers.ToString() + "+" + e.Key.ToString();
// switch (para)
// {
// case "Control+A": _diagramViewModel.SelectAllCommand.Execute(null); break;
// case "Control+C": _diagramViewModel.CopyCommand.Execute(null); break;
// case "Control+V": _diagramViewModel.PasteCommand.Execute(null); break;
// case "Control+X": _diagramViewModel.CutCommand.Execute(null); break;
// case "Control+Z": _diagramViewModel.UndoCommand.Execute(null); break;
// case "Control+Y": _diagramViewModel.RedoCommand.Execute(null); break;
// case "Delete": _diagramViewModel.DeleteCommand.Execute(null); break;
// case "Left": _diagramViewModel.LeftMoveCommand.Execute(null); break;
// case "Right": _diagramViewModel.RightMoveCommand.Execute(null); break;
// case "Up": _diagramViewModel.UpMoveCommand.Execute(null); break;
// case "Down": _diagramViewModel.DownMoveCommand.Execute(null); break;
// default: executed = false; break;
// }
// e.Handled = executed;
//}
protected override void OnPreviewKeyDown(KeyEventArgs e)
{
base.OnPreviewKeyDown(e);
e.Handled = _diagramViewModel.ExecuteShortcut(e);
}
}
}

View File

@@ -74,21 +74,29 @@ namespace AIStudio.Wpf.Flowchart.ViewModels
}
}
public bool DoubleApprove
{
get;set;
}
protected override void ExecuteEditCommand(object param)
{
if (IsReadOnly == true) return;
if (Status == 1)
if (DoubleApprove)
{
MiddleFlowNodeData data = new MiddleFlowNodeData();
if (visualiserService.ShowDialog(data) == true)
if (Status == 1)
{
FlowchartService.Approve(this, data.Status, data.Remark);
MiddleFlowNodeData data = new MiddleFlowNodeData();
if (visualiserService.ShowDialog(data) == true)
{
FlowchartService.Approve(this, data.Status, data.Remark);
}
}
else
{
MessageBox.Show("该节点不能进行审批!!!");
}
}
else
{
MessageBox.Show("该节点不能进行审批!!!");
}
}

BIN
AIStudio.Wpf.Mind/A.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<UseWPF>true</UseWPF>
<Company>AIStudio.Wpf.Controls</Company>
<Authors>akwkevin</Authors>
<PackageProjectUrl>https://gitee.com/akwkevin</PackageProjectUrl>
<PackageIcon>A.png</PackageIcon>
<PackageIconUrl />
<NeutralLanguage />
<Version>1.0.6</Version>
<Description>一个Wpf的流程图控件</Description>
</PropertyGroup>
<ItemGroup>
<None Include="A.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,10 @@
using System.Windows;
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]