Compare commits
410 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55d3d59309 | ||
|
|
f3561bcc12 | ||
|
|
bf021b88c8 | ||
|
|
fb2f0be991 | ||
|
|
9469506161 | ||
|
|
27f1cfefe0 | ||
|
|
331cbf339f | ||
|
|
683d1029ac | ||
|
|
ffd6015b47 | ||
|
|
3afc0081cf | ||
|
|
45ef4a3cc2 | ||
|
|
da8f77510b | ||
|
|
a184dce650 | ||
|
|
9e6000f278 | ||
|
|
2b8fe03f25 | ||
|
|
0badb714a0 | ||
|
|
2f12bfa829 | ||
|
|
b83f4fad7f | ||
|
|
2ffc7b3e52 | ||
|
|
476d0c57d3 | ||
|
|
d50ec045ea | ||
|
|
045a724ee2 | ||
|
|
3859713cc1 | ||
|
|
d4c347b19e | ||
|
|
a896426adc | ||
|
|
dc16828247 | ||
|
|
a562137d9e | ||
|
|
77c8a9bdfd | ||
|
|
b08e13b93e | ||
|
|
268404d1e8 | ||
|
|
38e0981bb9 | ||
|
|
67d995bb27 | ||
|
|
7692bb9398 | ||
|
|
e76a50f6e5 | ||
|
|
a696312936 | ||
|
|
872526f575 | ||
|
|
d68fe22a05 | ||
|
|
9485ce6684 | ||
|
|
8f7a43accd | ||
|
|
fe3e8b9ae1 | ||
|
|
25993fd3a9 | ||
|
|
25cd232579 | ||
|
|
5ee23157e4 | ||
|
|
5559a18c8e | ||
|
|
fe38c57e53 | ||
|
|
15b7596515 | ||
|
|
91d45b10f6 | ||
|
|
4efb9a2c36 | ||
|
|
dcd2cc44a3 | ||
|
|
55678e72ed | ||
|
|
14735f78dc | ||
|
|
36413e2349 | ||
|
|
d0214cc1b3 | ||
|
|
2d345fb076 | ||
|
|
e34f7fd5a3 | ||
|
|
b6e095293c | ||
|
|
8ab43ecae1 | ||
|
|
661b235f57 | ||
|
|
a862f94c50 | ||
|
|
3193b538f9 | ||
|
|
9b4e98ece4 | ||
|
|
39d991da0f | ||
|
|
2c9804513f | ||
|
|
ebf003b20b | ||
|
|
515ce1944b | ||
|
|
954aeee87e | ||
|
|
380c126e33 | ||
|
|
49b95ba881 | ||
|
|
88a315c3f0 | ||
|
|
0fbfb485a7 | ||
|
|
6710d0f48d | ||
|
|
a71e15d778 | ||
|
|
4b82ca7c49 | ||
|
|
0ef78d917e | ||
|
|
cb40c941cd | ||
|
|
7b4d9db7bb | ||
|
|
b476fd4eb5 | ||
|
|
be7a99e651 | ||
|
|
953a7bd9aa | ||
|
|
bfb6d163c4 | ||
|
|
5b79ee6010 | ||
|
|
4d097b4e05 | ||
|
|
8dd882390b | ||
|
|
7a4ba0c1f7 | ||
|
|
2cc55cb1c0 | ||
|
|
4f8243184c | ||
|
|
89c7da0811 | ||
|
|
a1e2ff3f74 | ||
|
|
3ec68b7b63 | ||
|
|
e20d1f7e59 | ||
|
|
1f20aad2c7 | ||
|
|
a4ea9f334e | ||
|
|
d2e00c6149 | ||
|
|
6995fe1476 | ||
|
|
4968bbb5e7 | ||
|
|
ace3d631f5 | ||
|
|
7f857c3464 | ||
|
|
82500f86a6 | ||
|
|
4870a2fd0e | ||
|
|
b946c2df93 | ||
|
|
af1cacc846 | ||
|
|
0b0f81faac | ||
|
|
56545ece4b | ||
|
|
bdf7385a39 | ||
|
|
56c3aac8e8 | ||
|
|
1dd09a2240 | ||
|
|
207523eb16 | ||
|
|
0f7a5b0308 | ||
|
|
efec06f853 | ||
|
|
7a0630bbc8 | ||
|
|
78558a305f | ||
|
|
5a9bcc03f3 | ||
|
|
fcd7beb193 | ||
|
|
538898d238 | ||
|
|
4674b8904b | ||
|
|
8b8e4741c6 | ||
|
|
01131dde47 | ||
|
|
b11d39024a | ||
|
|
fde899cfa9 | ||
|
|
2fd8321363 | ||
|
|
4ae8b383d8 | ||
|
|
e437245ff5 | ||
|
|
1f40f1c75c | ||
|
|
a22279bec2 | ||
|
|
6427c96c86 | ||
|
|
c6dd5ecafd | ||
|
|
853551982f | ||
|
|
6a9d31c29d | ||
|
|
e3de3a6fe7 | ||
|
|
e18d808d49 | ||
|
|
117a500f72 | ||
|
|
25f680a960 | ||
|
|
9e8981176a | ||
|
|
65e18759c9 | ||
|
|
19ba2736ab | ||
|
|
d5b712f275 | ||
|
|
da9cdb55c9 | ||
|
|
40f81b7209 | ||
|
|
58359c36d4 | ||
|
|
9ade5a0fda | ||
|
|
8003cebf99 | ||
|
|
bc551d2fe9 | ||
|
|
4c642db9b2 | ||
|
|
147a84cf91 | ||
|
|
f995722828 | ||
|
|
2045c5e45c | ||
|
|
adf1ee0805 | ||
|
|
f19d6c20ef | ||
|
|
e61b505dd3 | ||
|
|
c3342ced13 | ||
|
|
4a1d25fdf0 | ||
|
|
940512589c | ||
|
|
071490f5ee | ||
|
|
5c21e97caa | ||
|
|
ce69c85b6b | ||
|
|
96f10c2cb0 | ||
|
|
6ab92947a2 | ||
|
|
88953fe4b6 | ||
|
|
28af997749 | ||
|
|
cc65902b02 | ||
|
|
40b935ed03 | ||
|
|
107c88ff0e | ||
|
|
f2580bcdfa | ||
|
|
7e66a5a6a3 | ||
|
|
656722e04c | ||
|
|
ea2e2f45dd | ||
|
|
9902ca2af2 | ||
|
|
c877192b1d | ||
|
|
10679295c0 | ||
|
|
07bf962aa4 | ||
|
|
b9210cb6d9 | ||
|
|
c462d110ff | ||
|
|
c135a7f144 | ||
|
|
6b13f51814 | ||
|
|
ed22b9daa3 | ||
|
|
1536e5018d | ||
|
|
6de36f2473 | ||
|
|
06c3ddde7e | ||
|
|
f52895a8a8 | ||
|
|
a66e9239fe | ||
|
|
f73dd637ee | ||
|
|
36c5b956c3 | ||
|
|
6fa78893ee | ||
|
|
508de7a7d9 | ||
|
|
4a1fc12c52 | ||
|
|
48555edbc6 | ||
|
|
4a3f278a97 | ||
|
|
f4268b9fc2 | ||
|
|
7d8b19e4e0 | ||
|
|
48314acbd5 | ||
|
|
aa8ab61e37 | ||
|
|
dea5a5341c | ||
|
|
d38f11e758 | ||
|
|
e5d187d8c8 | ||
|
|
1cef64c7c8 | ||
|
|
997ccde257 | ||
|
|
fe8ecdfc32 | ||
|
|
9a39d6caf8 | ||
|
|
af5ac77496 | ||
|
|
ff012a1380 | ||
|
|
f7f05a002f | ||
|
|
3605ce9223 | ||
|
|
bd1741b572 | ||
|
|
77932a4175 | ||
|
|
13cede06cf | ||
|
|
5963c2c29f | ||
|
|
21467e26f5 | ||
|
|
dfc299689a | ||
|
|
87f31fa79d | ||
|
|
f8340b5885 | ||
|
|
451df2d5de | ||
|
|
033bebb6bc | ||
|
|
81f91f3f35 | ||
|
|
cbfbf96033 | ||
|
|
4b8a03afb6 | ||
|
|
5dee3a9907 | ||
|
|
f05654309b | ||
|
|
488e23ea57 | ||
|
|
c6bc57140f | ||
|
|
ce2e44fe49 | ||
|
|
429d7b1e24 | ||
|
|
21009fc383 | ||
|
|
fae7826577 | ||
|
|
2ef5b7a1ed | ||
|
|
8ad42aec49 | ||
|
|
fa96573cbd | ||
|
|
2edb4ffb14 | ||
|
|
5e7dd6c5e5 | ||
|
|
a0485601c1 | ||
|
|
78da8f4852 | ||
|
|
347488e8e9 | ||
|
|
afea559325 | ||
|
|
e0a26a76d2 | ||
|
|
c513bd0f64 | ||
|
|
5935a58541 | ||
|
|
eccf798818 | ||
|
|
f9b9b0fb2d | ||
|
|
b3f99f5dfd | ||
|
|
0fd8c217f4 | ||
|
|
3dc7b25d95 | ||
|
|
b04028c893 | ||
|
|
88ae871b64 | ||
|
|
fccac1da23 | ||
|
|
4c54318b9a | ||
|
|
a3fbb2d8ad | ||
|
|
7835b422ff | ||
|
|
0701f25519 | ||
|
|
02ebd056b3 | ||
|
|
f80a67ff10 | ||
|
|
ca7abe6fd5 | ||
|
|
b4d7f13111 | ||
|
|
72da084f15 | ||
|
|
43b5d82fae | ||
|
|
90e94a7ec0 | ||
|
|
5e5da021ab | ||
|
|
b36bd4b228 | ||
|
|
8a2c742ec4 | ||
|
|
5ff4376674 | ||
|
|
3c8120aa15 | ||
|
|
2c6b3cc285 | ||
|
|
07ac28965e | ||
|
|
c2f4d3c706 | ||
|
|
8d87f61c07 | ||
|
|
9b3c2633a7 | ||
|
|
d97938cc2b | ||
|
|
70dac7d41c | ||
|
|
035a725da3 | ||
|
|
31872222bc | ||
|
|
414eb28867 | ||
|
|
f22d6dd3f1 | ||
|
|
e2753b0bff | ||
|
|
fb7858fe74 | ||
|
|
84f413320f | ||
|
|
5cfb32bb19 | ||
|
|
b3c7e1efec | ||
|
|
e4f6335224 | ||
|
|
c80923d19c | ||
|
|
f48838f54a | ||
|
|
f042f95ee0 | ||
|
|
152c6a8c22 | ||
|
|
cd20abd7fe | ||
|
|
79f4896fbd | ||
|
|
9061146139 | ||
|
|
9966656269 | ||
|
|
84d4035e6d | ||
|
|
a015f9208b | ||
|
|
511636ebd7 | ||
|
|
73176a00d9 | ||
|
|
6464cad46e | ||
|
|
f8c2115f03 | ||
|
|
298ec29dd9 | ||
|
|
3a744ecaf7 | ||
|
|
6d1f2a83fa | ||
|
|
c227076076 | ||
|
|
71ed33f881 | ||
|
|
58c18db12f | ||
|
|
c053396fa0 | ||
|
|
ca1ac13a1f | ||
|
|
08a4fddfdc | ||
|
|
968adb0635 | ||
|
|
debd7e711d | ||
|
|
3ef7434f5b | ||
|
|
38cb0fae85 | ||
|
|
d6e84d40c0 | ||
|
|
dfe76438c2 | ||
|
|
4d36eac218 | ||
|
|
934357c87c | ||
|
|
2f3b622c4c | ||
|
|
1c03c0f055 | ||
|
|
4d2c7a282a | ||
|
|
bd6c8ad223 | ||
|
|
da2d8cd9b3 | ||
|
|
98392f377b | ||
|
|
8a50854868 | ||
|
|
f99fd93b3f | ||
|
|
59bfed341d | ||
|
|
86082cb788 | ||
|
|
a928ae1ddd | ||
|
|
9ea83dda6f | ||
|
|
cf1bfc7482 | ||
|
|
18b6bd7e71 | ||
|
|
2a3004a9c6 | ||
|
|
09b3ec41de | ||
|
|
d53cd2bd6a | ||
|
|
f5bca4d87d | ||
|
|
b40fb78c70 | ||
|
|
e2a65ff57f | ||
|
|
c1d4c5c58f | ||
|
|
24c392a8a4 | ||
|
|
69c56c681b | ||
|
|
9ccbfb7760 | ||
|
|
7f5bea55a8 | ||
|
|
5b513370ff | ||
|
|
285c015e83 | ||
|
|
e8f91abd68 | ||
|
|
0d6debe87f | ||
|
|
bf5717cf25 | ||
|
|
8bec9b446f | ||
|
|
848121ffa2 | ||
|
|
da8cf08051 | ||
|
|
bd90d55ca8 | ||
|
|
2fde666182 | ||
|
|
397ebcfac2 | ||
|
|
527dbd98e4 | ||
|
|
50eab5e091 | ||
|
|
5ee0c1ce26 | ||
|
|
ba9e3bdf58 | ||
|
|
4feddf8392 | ||
|
|
6d1960a8df | ||
|
|
e8bd6faa21 | ||
|
|
72e3efb052 | ||
|
|
64ea56f01e | ||
|
|
04db0ef13b | ||
|
|
b5867c148e | ||
|
|
9bb6c6d321 | ||
|
|
f11a4170d8 | ||
|
|
b857151bdc | ||
|
|
b7af3534a2 | ||
|
|
4c5d535aad | ||
|
|
40590bf98d | ||
|
|
a01eb8825a | ||
|
|
a5005ac083 | ||
|
|
66d3a6685b | ||
|
|
1a291411e6 | ||
|
|
8dbe05636d | ||
|
|
f39a57b3e5 | ||
|
|
2b4662ed37 | ||
|
|
c4f8a40b5c | ||
|
|
2c76aacc66 | ||
|
|
bb2882c618 | ||
|
|
4c37fb9772 | ||
|
|
ad227aee0c | ||
|
|
2e396d687b | ||
|
|
c4ab1a6355 | ||
|
|
f8a0b29d5f | ||
|
|
718d8c01e9 | ||
|
|
5bdf10445f | ||
|
|
7d77864311 | ||
|
|
717cc43827 | ||
|
|
6a4c31106a | ||
|
|
5d7717cc2b | ||
|
|
8fc69bc96d | ||
|
|
93ca2859ba | ||
|
|
4e2e68acdf | ||
|
|
4b798f75a0 | ||
|
|
02f428d61a | ||
|
|
9f91fbcdd3 | ||
|
|
9a8d4c95f0 | ||
|
|
194eb9b104 | ||
|
|
0487857d7b | ||
|
|
dc42f75610 | ||
|
|
1abeefcc66 | ||
|
|
503b92f40e | ||
|
|
992a4bb83b | ||
|
|
13f30f23d8 | ||
|
|
513937c1d6 | ||
|
|
334297b074 | ||
|
|
c443603cfd | ||
|
|
179f8a45cc | ||
|
|
8bec38e040 | ||
|
|
e9c043ae3a | ||
|
|
b0c9855d05 | ||
|
|
5a1f869141 | ||
|
|
d11a3ef2fd | ||
|
|
9063ca5950 | ||
|
|
831256336f | ||
|
|
0b8258003f | ||
|
|
9a0e85e1a9 | ||
|
|
336249f313 | ||
|
|
87be7a8021 |
135
.editorconfig
Normal file
@@ -0,0 +1,135 @@
|
||||
# Rules in this file were initially inferred by Visual Studio IntelliCode from the F:\AIStudio.Wpf.Controls codebase based on best match to current usage at 2022/1/23
|
||||
# You can modify the rules from these initially generated values to suit your own policies
|
||||
# You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
|
||||
[*.cs]
|
||||
|
||||
|
||||
#Core editorconfig formatting - indentation
|
||||
|
||||
#use soft tabs (spaces) for indentation
|
||||
indent_style = space
|
||||
|
||||
#Formatting - indentation options
|
||||
|
||||
#indent switch case contents.
|
||||
csharp_indent_case_contents = true
|
||||
#csharp_indent_case_contents_when_block
|
||||
csharp_indent_case_contents_when_block = true
|
||||
#indent switch labels
|
||||
csharp_indent_switch_labels = true
|
||||
|
||||
#Formatting - new line options
|
||||
|
||||
#place catch statements on a new line
|
||||
csharp_new_line_before_catch = true
|
||||
#place else statements on a new line
|
||||
csharp_new_line_before_else = true
|
||||
#require finally statements to be on a new line after the closing brace
|
||||
csharp_new_line_before_finally = true
|
||||
#require members of object intializers to be on separate lines
|
||||
csharp_new_line_before_members_in_object_initializers = true
|
||||
#require braces to be on a new line for types, control_blocks, methods, properties, object_collection_array_initializers, and accessors (also known as "Allman" style)
|
||||
csharp_new_line_before_open_brace = types, control_blocks, methods, properties, object_collection_array_initializers, accessors
|
||||
|
||||
#Formatting - organize using options
|
||||
|
||||
#sort System.* using directives alphabetically, and place them before other usings
|
||||
dotnet_sort_system_directives_first = true
|
||||
|
||||
#Formatting - spacing options
|
||||
|
||||
#require NO space between a cast and the value
|
||||
csharp_space_after_cast = false
|
||||
#require a space before the colon for bases or interfaces in a type declaration
|
||||
csharp_space_after_colon_in_inheritance_clause = true
|
||||
#require a space after a keyword in a control flow statement such as a for loop
|
||||
csharp_space_after_keywords_in_control_flow_statements = true
|
||||
#require a space before the colon for bases or interfaces in a type declaration
|
||||
csharp_space_before_colon_in_inheritance_clause = true
|
||||
#remove space within empty argument list parentheses
|
||||
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||
#remove space between method call name and opening parenthesis
|
||||
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||
#do not place space characters after the opening parenthesis and before the closing parenthesis of a method call
|
||||
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||
#remove space within empty parameter list parentheses for a method declaration
|
||||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||
#place a space character after the opening parenthesis and before the closing parenthesis of a method declaration parameter list.
|
||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||
|
||||
#Formatting - wrapping options
|
||||
|
||||
#leave code block on separate lines
|
||||
csharp_preserve_single_line_blocks = false
|
||||
#leave statements and member declarations on the same line
|
||||
csharp_preserve_single_line_statements = true
|
||||
|
||||
#Style - Code block preferences
|
||||
|
||||
#prefer curly braces even for one line of code
|
||||
csharp_prefer_braces = true:suggestion
|
||||
|
||||
#Style - expression bodied member options
|
||||
|
||||
#prefer block bodies for accessors
|
||||
csharp_style_expression_bodied_accessors = false:suggestion
|
||||
#prefer block bodies for constructors
|
||||
csharp_style_expression_bodied_constructors = false:suggestion
|
||||
#prefer block bodies for methods
|
||||
csharp_style_expression_bodied_methods = false:suggestion
|
||||
#prefer block bodies for properties
|
||||
csharp_style_expression_bodied_properties = false:suggestion
|
||||
|
||||
#Style - expression level options
|
||||
|
||||
#prefer out variables to be declared inline in the argument list of a method call when possible
|
||||
csharp_style_inlined_variable_declaration = true:suggestion
|
||||
#prefer the language keyword for member access expressions, instead of the type name, for types that have a keyword to represent them
|
||||
dotnet_style_predefined_type_for_member_access = true:suggestion
|
||||
|
||||
#Style - Expression-level preferences
|
||||
|
||||
#prefer default(T) over default
|
||||
csharp_prefer_simple_default_expression = false:suggestion
|
||||
#prefer objects to be initialized using object initializers when possible
|
||||
dotnet_style_object_initializer = true:suggestion
|
||||
|
||||
#Style - implicit and explicit types
|
||||
|
||||
#prefer explicit type over var in all cases, unless overridden by another code style rule
|
||||
csharp_style_var_elsewhere = false:suggestion
|
||||
#prefer explicit type over var to declare variables with built-in system types such as int
|
||||
csharp_style_var_for_built_in_types = false:suggestion
|
||||
#prefer explicit type over var when the type is already mentioned on the right-hand side of a declaration
|
||||
csharp_style_var_when_type_is_apparent = false:suggestion
|
||||
|
||||
#Style - language keyword and framework type options
|
||||
|
||||
#prefer the language keyword for local variables, method parameters, and class members, instead of the type name, for types that have a keyword to represent them
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
|
||||
|
||||
#Style - modifier options
|
||||
|
||||
#prefer accessibility modifiers to be declared except for public interface members. This will currently not differ from always and will act as future proofing for if C# adds default interface methods.
|
||||
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
|
||||
|
||||
#Style - Modifier preferences
|
||||
|
||||
#when this rule is set to a list of modifiers, prefer the specified ordering.
|
||||
csharp_preferred_modifier_order = public,private,protected,internal,static,readonly,override,virtual,new,async:suggestion
|
||||
|
||||
#Style - Pattern matching
|
||||
|
||||
#prefer is expression with type casts instead of pattern matching
|
||||
csharp_style_pattern_matching_over_as_with_null_check = false:suggestion
|
||||
|
||||
#Style - qualification options
|
||||
|
||||
#prefer events to be prefaced with this. in C# or Me. in Visual Basic
|
||||
dotnet_style_qualification_for_event = true:suggestion
|
||||
#prefer fields not to be prefaced with this. or Me. in Visual Basic
|
||||
dotnet_style_qualification_for_field = false:suggestion
|
||||
#prefer methods not to be prefaced with this. or Me. in Visual Basic
|
||||
dotnet_style_qualification_for_method = false:suggestion
|
||||
#prefer properties not to be prefaced with this. or Me. in Visual Basic
|
||||
dotnet_style_qualification_for_property = false:suggestion
|
||||
@@ -1,15 +0,0 @@
|
||||
<Application x:Class="AIStudio.Wpf.ADiagram.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:AIStudio.Wpf.ADiagram"
|
||||
StartupUri="Views/MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Fluent;component/Themes/Generic.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/Dragablz;component/Themes/Generic.xaml" />
|
||||
<ResourceDictionary Source="/AIStudio.Wpf.ADiagram;component/Themes/Generic.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
{
|
||||
public class CancelRoutedEventArgs : RoutedEventArgs
|
||||
{
|
||||
public CancelRoutedEventArgs(RoutedEvent routedEvent, object source) : base(routedEvent, source)
|
||||
{
|
||||
}
|
||||
|
||||
public bool Cancel { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// 带上下文菜单的切换按钮
|
||||
/// </summary>
|
||||
public class ContextMenuToggleButton : ToggleButton
|
||||
{
|
||||
public ContextMenu Menu { get; set; }
|
||||
|
||||
protected override void OnClick()
|
||||
{
|
||||
base.OnClick();
|
||||
if (Menu != null)
|
||||
{
|
||||
if (IsChecked == true)
|
||||
{
|
||||
Menu.PlacementTarget = this;
|
||||
Menu.IsOpen = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Menu.IsOpen = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,228 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for PropertiesView.xaml
|
||||
/// </summary>
|
||||
public partial class PropertiesView : UserControl
|
||||
{
|
||||
#region SelectedObject
|
||||
|
||||
public static readonly DependencyProperty SelectedObjectProperty = DependencyProperty.Register("SelectedObject", typeof(object), typeof(PropertiesView), new UIPropertyMetadata(null, OnSelectedObjectChanged));
|
||||
public object SelectedObject
|
||||
{
|
||||
get
|
||||
{
|
||||
return (object)GetValue(SelectedObjectProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(SelectedObjectProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnSelectedObjectChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
PropertiesView propertyInspector = o as PropertiesView;
|
||||
if (propertyInspector != null)
|
||||
propertyInspector.OnSelectedObjectChanged((object)e.OldValue, (object)e.NewValue);
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
public static readonly DependencyProperty NeedBrowsableProperty = DependencyProperty.Register("NeedBrowsable", typeof(bool), typeof(PropertiesView), new UIPropertyMetadata(true));
|
||||
public bool NeedBrowsable
|
||||
{
|
||||
get
|
||||
{
|
||||
return (bool)GetValue(NeedBrowsableProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(NeedBrowsableProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
public PropertiesView()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Loaded += PropertiesView_Loaded;
|
||||
}
|
||||
|
||||
private void PropertiesView_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
DisplayProperties();
|
||||
}
|
||||
|
||||
void PropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
DisplayProperties();
|
||||
}
|
||||
|
||||
private void DisplayProperties()
|
||||
{
|
||||
_panel.Children.Clear();
|
||||
ClearGrid();
|
||||
if (SelectedObject != null)
|
||||
{
|
||||
int row = 0;
|
||||
foreach (var prop in SelectedObject.GetType().GetProperties())
|
||||
{
|
||||
var attr = prop.GetCustomAttributes(typeof(BrowsableAttribute), true);
|
||||
if (NeedBrowsable == false && (attr.Length == 0 || (attr[0] as BrowsableAttribute).Browsable))
|
||||
{
|
||||
DisplayProperty(prop, row);
|
||||
row++;
|
||||
}
|
||||
else if(NeedBrowsable == true && (attr.Length > 0 && (attr[0] as BrowsableAttribute).Browsable))
|
||||
{
|
||||
DisplayProperty(prop, row);
|
||||
row++;
|
||||
}
|
||||
}
|
||||
_panel.Children.Add(_gridContainer);
|
||||
}
|
||||
else
|
||||
{
|
||||
_panel.Children.Add(_label);
|
||||
}
|
||||
}
|
||||
|
||||
private void ClearGrid()
|
||||
{
|
||||
_grid.RowDefinitions.Clear();
|
||||
for (int i = _grid.Children.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (_grid.Children[i] != _vLine && _grid.Children[i] != _splitter)
|
||||
_grid.Children.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
private void DisplayProperty(PropertyInfo prop, int row)
|
||||
{
|
||||
var rowDef = new RowDefinition();
|
||||
rowDef.Height = new GridLength(Math.Max(20, this.FontSize * 2));
|
||||
_grid.RowDefinitions.Add(rowDef);
|
||||
|
||||
var tb = new TextBlock() { Text = prop.Name };
|
||||
var displayAttr = prop.GetCustomAttributes(typeof(DisplayNameAttribute), true);
|
||||
if (displayAttr.Length > 0 )
|
||||
{
|
||||
tb.Text = (displayAttr[0] as DisplayNameAttribute).DisplayName;
|
||||
}
|
||||
tb.Margin = new Thickness(4);
|
||||
tb.VerticalAlignment = VerticalAlignment.Center;
|
||||
Grid.SetColumn(tb, 0);
|
||||
Grid.SetRow(tb, _grid.RowDefinitions.Count - 1);
|
||||
_grid.Children.Add(tb);
|
||||
|
||||
var line = new Line();
|
||||
line.Style = (Style)border.Resources["gridHorizontalLineStyle"];
|
||||
Grid.SetRow(line, row);
|
||||
_grid.Children.Add(line);
|
||||
|
||||
Style style = null;
|
||||
var styleNameAttr = prop.GetCustomAttributes(typeof(StyleNameAttribute), true);
|
||||
if (styleNameAttr.Length > 0)
|
||||
{
|
||||
style = this.FindResource((styleNameAttr[0] as StyleNameAttribute).Name) as Style;
|
||||
if (style != null)
|
||||
{
|
||||
ContentControl content = new ContentControl();
|
||||
content.Style = style;
|
||||
content.DataContext = SelectedObject;
|
||||
|
||||
Grid.SetColumn(content, 1);
|
||||
Grid.SetRow(content, _grid.RowDefinitions.Count - 1);
|
||||
|
||||
_grid.Children.Add(content);
|
||||
}
|
||||
}
|
||||
|
||||
if (style == null)
|
||||
{
|
||||
var ed = new TextBox();
|
||||
ed.PreviewKeyDown += new KeyEventHandler(ed_KeyDown);
|
||||
ed.Margin = new Thickness(0);
|
||||
ed.VerticalAlignment = VerticalAlignment.Center;
|
||||
ed.BorderThickness = new Thickness(0);
|
||||
Grid.SetColumn(ed, 1);
|
||||
Grid.SetRow(ed, _grid.RowDefinitions.Count - 1);
|
||||
|
||||
var binding = new Binding(prop.Name);
|
||||
binding.Source = SelectedObject;
|
||||
binding.ValidatesOnExceptions = true;
|
||||
binding.Mode = BindingMode.OneWay;
|
||||
if (prop.CanWrite)
|
||||
{
|
||||
var mi = prop.GetSetMethod();
|
||||
if (mi != null && mi.IsPublic)
|
||||
binding.Mode = BindingMode.TwoWay;
|
||||
}
|
||||
ed.SetBinding(TextBox.TextProperty, binding);
|
||||
|
||||
var template = (ControlTemplate)border.Resources["validationErrorTemplate"];
|
||||
Validation.SetErrorTemplate(ed, template);
|
||||
|
||||
_grid.Children.Add(ed);
|
||||
}
|
||||
}
|
||||
|
||||
void ed_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
var ed = sender as TextBox;
|
||||
if (ed != null)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
ed.GetBindingExpression(TextBox.TextProperty).UpdateSource();
|
||||
e.Handled = true;
|
||||
}
|
||||
else if (e.Key == Key.Escape)
|
||||
ed.GetBindingExpression(TextBox.TextProperty).UpdateTarget();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class StyleNameAttribute : Attribute
|
||||
{
|
||||
private string _name;
|
||||
public StyleNameAttribute(string name)
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:sys="clr-namespace:System;assembly=System.Runtime"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.ADiagram.Controls">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Util.Controls.Handy;component/Style/Themes/ScrollViewer.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<ControlTemplate x:Key="ScrollViewerBaseControlTemplate" TargetType="controls:ScrollViewer">
|
||||
<ControlTemplate.Resources>
|
||||
<Storyboard x:Key="Storyboard1">
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_VerticalScrollBar">
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:.1" Value=".8"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_HorizontalScrollBar">
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:.1" Value=".8"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
<Storyboard x:Key="Storyboard2">
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_VerticalScrollBar">
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:.2" Value="0"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_HorizontalScrollBar">
|
||||
<EasingDoubleKeyFrame KeyTime="0:0:.2" Value="0"/>
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</ControlTemplate.Resources>
|
||||
<Grid x:Name="Grid" Background="{TemplateBinding Background}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter" Grid.RowSpan="2" Grid.ColumnSpan="2" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
|
||||
<ScrollBar x:Name="PART_VerticalScrollBar" Opacity="0" Style="{StaticResource ScrollBarBaseStyle}" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/>
|
||||
<ScrollBar x:Name="PART_HorizontalScrollBar" Opacity="0" Style="{StaticResource ScrollBarBaseStyle}" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding IsMouseOver,RelativeSource={RelativeSource Self}}" Value="True">
|
||||
<DataTrigger.EnterActions>
|
||||
<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
|
||||
</DataTrigger.EnterActions>
|
||||
<DataTrigger.ExitActions>
|
||||
<BeginStoryboard Storyboard="{StaticResource Storyboard2}"/>
|
||||
</DataTrigger.ExitActions>
|
||||
</DataTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="ScrollViewerBaseStyle" TargetType="controls:ScrollViewer">
|
||||
<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
|
||||
<Setter Property="Focusable" Value="False"/>
|
||||
<Setter Property="Template" Value="{StaticResource ScrollViewerBaseControlTemplate}"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
@@ -1,237 +0,0 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
{
|
||||
public class ScrollViewer : System.Windows.Controls.ScrollViewer
|
||||
{
|
||||
private double _totalVerticalOffset;
|
||||
|
||||
private double _totalHorizontalOffset;
|
||||
|
||||
private bool _isRunning;
|
||||
|
||||
/// <summary>
|
||||
/// 滚动方向
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register(
|
||||
"Orientation", typeof(Orientation), typeof(ScrollViewer), new PropertyMetadata(Orientation.Vertical));
|
||||
|
||||
/// <summary>
|
||||
/// 滚动方向
|
||||
/// </summary>
|
||||
public Orientation Orientation
|
||||
{
|
||||
get => (Orientation)GetValue(OrientationProperty);
|
||||
set => SetValue(OrientationProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否响应鼠标滚轮操作
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty CanMouseWheelProperty = DependencyProperty.Register(
|
||||
"CanMouseWheel", typeof(bool), typeof(ScrollViewer), new PropertyMetadata(true));
|
||||
|
||||
/// <summary>
|
||||
/// 是否响应鼠标滚轮操作
|
||||
/// </summary>
|
||||
public bool CanMouseWheel
|
||||
{
|
||||
get => (bool)GetValue(CanMouseWheelProperty);
|
||||
set => SetValue(CanMouseWheelProperty, value);
|
||||
}
|
||||
|
||||
protected override void OnMouseWheel(MouseWheelEventArgs e)
|
||||
{
|
||||
if (!CanMouseWheel) return;
|
||||
|
||||
if (!IsInertiaEnabled)
|
||||
{
|
||||
if (Orientation == Orientation.Vertical)
|
||||
{
|
||||
base.OnMouseWheel(e);
|
||||
}
|
||||
else
|
||||
{
|
||||
_totalHorizontalOffset = HorizontalOffset;
|
||||
CurrentHorizontalOffset = HorizontalOffset;
|
||||
_totalHorizontalOffset = Math.Min(Math.Max(0, _totalHorizontalOffset - e.Delta), ScrollableWidth);
|
||||
CurrentHorizontalOffset = _totalHorizontalOffset;
|
||||
}
|
||||
return;
|
||||
}
|
||||
e.Handled = true;
|
||||
|
||||
if (Orientation == Orientation.Vertical)
|
||||
{
|
||||
if (!_isRunning)
|
||||
{
|
||||
_totalVerticalOffset = VerticalOffset;
|
||||
CurrentVerticalOffset = VerticalOffset;
|
||||
}
|
||||
_totalVerticalOffset = Math.Min(Math.Max(0, _totalVerticalOffset - e.Delta), ScrollableHeight);
|
||||
ScrollToVerticalOffsetInternal(_totalVerticalOffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_isRunning)
|
||||
{
|
||||
_totalHorizontalOffset = HorizontalOffset;
|
||||
CurrentHorizontalOffset = HorizontalOffset;
|
||||
}
|
||||
_totalHorizontalOffset = Math.Min(Math.Max(0, _totalHorizontalOffset - e.Delta), ScrollableWidth);
|
||||
ScrollToHorizontalOffsetInternal(_totalHorizontalOffset);
|
||||
}
|
||||
}
|
||||
|
||||
internal void ScrollToTopInternal(double milliseconds = 500)
|
||||
{
|
||||
if (!_isRunning)
|
||||
{
|
||||
_totalVerticalOffset = VerticalOffset;
|
||||
CurrentVerticalOffset = VerticalOffset;
|
||||
}
|
||||
ScrollToVerticalOffsetInternal(0, milliseconds);
|
||||
}
|
||||
|
||||
internal void ScrollToVerticalOffsetInternal(double offset, double milliseconds = 500)
|
||||
{
|
||||
var animation = AnimationHelper.CreateAnimation(offset, milliseconds);
|
||||
animation.EasingFunction = new CubicEase
|
||||
{
|
||||
EasingMode = EasingMode.EaseOut
|
||||
};
|
||||
animation.FillBehavior = FillBehavior.Stop;
|
||||
animation.Completed += (s, e1) =>
|
||||
{
|
||||
CurrentVerticalOffset = offset;
|
||||
_isRunning = false;
|
||||
};
|
||||
_isRunning = true;
|
||||
|
||||
BeginAnimation(CurrentVerticalOffsetProperty, animation, HandoffBehavior.Compose);
|
||||
}
|
||||
|
||||
internal void ScrollToHorizontalOffsetInternal(double offset, double milliseconds = 500)
|
||||
{
|
||||
var animation = AnimationHelper.CreateAnimation(offset, milliseconds);
|
||||
animation.EasingFunction = new CubicEase
|
||||
{
|
||||
EasingMode = EasingMode.EaseOut
|
||||
};
|
||||
animation.FillBehavior = FillBehavior.Stop;
|
||||
animation.Completed += (s, e1) =>
|
||||
{
|
||||
CurrentHorizontalOffset = offset;
|
||||
_isRunning = false;
|
||||
};
|
||||
_isRunning = true;
|
||||
|
||||
BeginAnimation(CurrentHorizontalOffsetProperty, animation, HandoffBehavior.Compose);
|
||||
}
|
||||
|
||||
protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters) =>
|
||||
IsPenetrating ? null : base.HitTestCore(hitTestParameters);
|
||||
|
||||
/// <summary>
|
||||
/// 是否支持惯性
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IsInertiaEnabledProperty = DependencyProperty.RegisterAttached(
|
||||
"IsInertiaEnabled", typeof(bool), typeof(ScrollViewer), new PropertyMetadata(false));
|
||||
|
||||
public static void SetIsInertiaEnabled(DependencyObject element, bool value)
|
||||
{
|
||||
element.SetValue(IsInertiaEnabledProperty, value);
|
||||
}
|
||||
|
||||
public static bool GetIsInertiaEnabled(DependencyObject element)
|
||||
{
|
||||
return (bool)element.GetValue(IsInertiaEnabledProperty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否支持惯性
|
||||
/// </summary>
|
||||
public bool IsInertiaEnabled
|
||||
{
|
||||
get => (bool)GetValue(IsInertiaEnabledProperty);
|
||||
set => SetValue(IsInertiaEnabledProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 控件是否可以穿透点击
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IsPenetratingProperty = DependencyProperty.RegisterAttached(
|
||||
"IsPenetrating", typeof(bool), typeof(ScrollViewer), new PropertyMetadata(false));
|
||||
|
||||
/// <summary>
|
||||
/// 控件是否可以穿透点击
|
||||
/// </summary>
|
||||
public bool IsPenetrating
|
||||
{
|
||||
get => (bool)GetValue(IsPenetratingProperty);
|
||||
set => SetValue(IsPenetratingProperty, value);
|
||||
}
|
||||
|
||||
public static void SetIsPenetrating(DependencyObject element, bool value)
|
||||
{
|
||||
element.SetValue(IsPenetratingProperty, value);
|
||||
}
|
||||
|
||||
public static bool GetIsPenetrating(DependencyObject element)
|
||||
{
|
||||
return (bool)element.GetValue(IsPenetratingProperty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前垂直滚动偏移
|
||||
/// </summary>
|
||||
internal static readonly DependencyProperty CurrentVerticalOffsetProperty = DependencyProperty.Register(
|
||||
"CurrentVerticalOffset", typeof(double), typeof(ScrollViewer), new PropertyMetadata(0d, OnCurrentVerticalOffsetChanged));
|
||||
|
||||
private static void OnCurrentVerticalOffsetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is ScrollViewer ctl && e.NewValue is double v)
|
||||
{
|
||||
ctl.ScrollToVerticalOffset(v);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前垂直滚动偏移
|
||||
/// </summary>
|
||||
internal double CurrentVerticalOffset
|
||||
{
|
||||
// ReSharper disable once UnusedMember.Local
|
||||
get => (double)GetValue(CurrentVerticalOffsetProperty);
|
||||
set => SetValue(CurrentVerticalOffsetProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前水平滚动偏移
|
||||
/// </summary>
|
||||
internal static readonly DependencyProperty CurrentHorizontalOffsetProperty = DependencyProperty.Register(
|
||||
"CurrentHorizontalOffset", typeof(double), typeof(ScrollViewer), new PropertyMetadata(0d, OnCurrentHorizontalOffsetChanged));
|
||||
|
||||
private static void OnCurrentHorizontalOffsetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is ScrollViewer ctl && e.NewValue is double v)
|
||||
{
|
||||
ctl.ScrollToHorizontalOffset(v);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前水平滚动偏移
|
||||
/// </summary>
|
||||
internal double CurrentHorizontalOffset
|
||||
{
|
||||
get => (double)GetValue(CurrentHorizontalOffsetProperty);
|
||||
set => SetValue(CurrentHorizontalOffsetProperty, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:controls="clr-namespace:AIStudio.Wpf.ADiagram.Controls"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
||||
xmlns:interactivity="clr-namespace:Util.Controls.Handy.Interactivity">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Util.Controls.Handy;component/Style/Basic/Paths.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/Util.Controls.Handy;component/Style/Basic/Converters.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/Util.Controls.Handy;component/Style/Themes/Button.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/Util.Controls.Handy;component/Style/Themes/RepeatButton.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/Util.Controls.Handy;component/Style/Themes/ToggleButton.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<ContextMenu x:Key="TabItemMenu" x:Shared="False">
|
||||
<MenuItem Command="interactivity:ControlCommands.Close" Header="Close"/>
|
||||
<MenuItem Command="interactivity:ControlCommands.CloseAll" Header="CloseAll"/>
|
||||
<MenuItem Command="interactivity:ControlCommands.CloseOther" Header="CloseOther"/>
|
||||
</ContextMenu>
|
||||
|
||||
<Style TargetType="controls:TabItem">
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Text}"/>
|
||||
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.ThemeBackground}"/>
|
||||
<Setter Property="BorderThickness" Value="1,0,1,1"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource MahApps.Brushes.Control.Border}"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
<Setter Property="Padding" Value="10,0,0,0"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="Menu" Value="{StaticResource TabItemMenu}"/>
|
||||
<Setter Property="controls:IconElement.Width" Value="16"/>
|
||||
<Setter Property="controls:IconElement.Height" Value="16"/>
|
||||
<Setter Property="HeaderTemplate">
|
||||
<Setter.Value>
|
||||
<DataTemplate>
|
||||
<TextBlock Background="Transparent" Text="{Binding Header,RelativeSource={RelativeSource AncestorType=controls:TabItem}}"/>
|
||||
</DataTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:TabItem">
|
||||
<Grid x:Name="templateRoot" SnapsToDevicePixels="true" ContextMenu="{TemplateBinding Menu}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Grid.ColumnSpan="3" BorderThickness="{TemplateBinding BorderThickness}" x:Name="mainBorder" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Margin="0">
|
||||
<Border Margin="0,0,0,-1" x:Name="innerBorder" Background="{DynamicResource MahApps.Brushes.Gray8}" Visibility="Collapsed"/>
|
||||
</Border>
|
||||
<Path x:Name="PathMain" Margin="10,0,0,0" Grid.Column="0" Width="{TemplateBinding controls:IconElement.Width}" Height="{TemplateBinding controls:IconElement.Height}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding controls:IconElement.Geometry}"/>
|
||||
<ContentPresenter Grid.Column="1" x:Name="contentPresenter" ContentSource="Header" Focusable="False" HorizontalAlignment="Stretch" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
|
||||
<Border Name="BorderMask" Grid.Column="1" HorizontalAlignment="Right" Width="20" Background="{TemplateBinding Background}">
|
||||
<Border.OpacityMask>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="White" Offset="1"/>
|
||||
<GradientStop Offset="0"/>
|
||||
</LinearGradientBrush>
|
||||
</Border.OpacityMask>
|
||||
</Border>
|
||||
<Button Grid.Column="2" Focusable="False" Command="interactivity:ControlCommands.Close" Visibility="{TemplateBinding ShowCloseButton,Converter={StaticResource Boolean2VisibilityConverter}}" Background="Transparent" Style="{StaticResource ButtonCustom}" Width="28">
|
||||
<Path Fill="{DynamicResource MahApps.Brushes.Text}" Width="8" Height="8" Style="{StaticResource ClosePathStyle}"/>
|
||||
</Button>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSelected" Value="true">
|
||||
<Setter Property="Panel.ZIndex" Value="1"/>
|
||||
<Setter Property="Visibility" TargetName="innerBorder" Value="Visible"/>
|
||||
<Setter Property="Background" TargetName="BorderMask" Value="{DynamicResource MahApps.Brushes.Gray8}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="controls:IconElement.Geometry" Value="{x:Null}">
|
||||
<Setter Property="Visibility" Value="Collapsed" TargetName="PathMain"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<ControlTemplate x:Key="TabControlPlusTemplate" TargetType="controls:TabControl">
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
|
||||
<Grid x:Name="templateRoot" ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition x:Name="ColumnDefinition0"/>
|
||||
<ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Background="{TemplateBinding Background}" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource MahApps.Brushes.Control.Border}">
|
||||
<controls:TabPanel MinHeight="{TemplateBinding TabItemHeight}" TabItemHeight="{TemplateBinding TabItemHeight}" TabItemWidth="{TemplateBinding TabItemWidth}" IsTabFillEnabled="{TemplateBinding IsTabFillEnabled}" Margin="0,0,-1,-1" x:Name="PART_HeaderPanel" HorizontalAlignment="Left" Background="{DynamicResource SecondaryTextBrush}" IsItemsHost="true" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1">
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<interactivity:FluidMoveBehavior AppliesTo="Children" Duration="{Binding FluidMoveDuration,ElementName=PART_HeaderPanel}">
|
||||
<interactivity:FluidMoveBehavior.EaseX>
|
||||
<CubicEase EasingMode="EaseOut"/>
|
||||
</interactivity:FluidMoveBehavior.EaseX>
|
||||
</interactivity:FluidMoveBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</controls:TabPanel>
|
||||
</Border>
|
||||
<Border x:Name="contentPanel" Background="{DynamicResource MahApps.Brushes.ThemeBackground}" Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
|
||||
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Border>
|
||||
<Border Visibility="{Binding Visibility,ElementName=PART_OverflowButton}" Margin="0,-1,0,0" Grid.Row="0" Grid.Column="0" BorderThickness="1,0,0,1" BorderBrush="{DynamicResource MahApps.Brushes.Control.Border}" Background="{DynamicResource MahApps.Brushes.Gray8}" HorizontalAlignment="Right">
|
||||
<controls:ContextMenuToggleButton x:Name="PART_OverflowButton" Visibility="Collapsed" Style="{StaticResource ToggleButtonIconTransparent}" controls:IconSwitchElement.Geometry="{StaticResource DownGeometry}" controls:IconSwitchElement.GeometrySelected="{StaticResource UpGeometry}"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTemplate x:Key="TabControlPlusScrollableTemplate" TargetType="controls:TabControl">
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
|
||||
<Grid x:Name="templateRoot" ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Visibility="{TemplateBinding ShowScrollButton,Converter={StaticResource Boolean2VisibilityConverter}}" Margin="0,-1,0,0" Grid.Row="0" Grid.Column="0" BorderThickness="0,0,1,1" BorderBrush="{DynamicResource MahApps.Brushes.Control.Border}" Background="{DynamicResource MahApps.Brushes.Gray8}" HorizontalAlignment="Left" Panel.ZIndex="2">
|
||||
<Border.CacheMode>
|
||||
<BitmapCache SnapsToDevicePixels="True"/>
|
||||
</Border.CacheMode>
|
||||
<RepeatButton Focusable="False" Style="{StaticResource RepeatButtonIcon}" Padding="8" controls:IconElement.Geometry="{StaticResource LeftGeometry}" Foreground="{DynamicResource MahApps.Brushes.Text}" Background="{DynamicResource MahApps.Brushes.ThemeBackground}" x:Name="PART_ScrollButtonLeft"/>
|
||||
</Border>
|
||||
<controls:ScrollViewer HorizontalScrollBarVisibility="Hidden" CanMouseWheel="True" Orientation="Horizontal" IsInertiaEnabled="True" Grid.Row="0" Grid.Column="1" IsDeferredScrollingEnabled="True" x:Name="PART_OverflowScrollviewer">
|
||||
<Border Background="{TemplateBinding Background}" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource MahApps.Brushes.Control.Border}" Name="PART_HeaderBorder">
|
||||
<controls:TabPanel MinHeight="{TemplateBinding TabItemHeight}" TabItemHeight="{TemplateBinding TabItemHeight}" TabItemWidth="{TemplateBinding TabItemWidth}" IsTabFillEnabled="{TemplateBinding IsTabFillEnabled}" Margin="0,0,-1,-1" x:Name="PART_HeaderPanel" HorizontalAlignment="Left" Background="{DynamicResource SecondaryTextBrush}" IsItemsHost="true" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1">
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<interactivity:FluidMoveBehavior AppliesTo="Children" Duration="{Binding FluidMoveDuration,ElementName=PART_HeaderPanel}">
|
||||
<interactivity:FluidMoveBehavior.EaseX>
|
||||
<CubicEase EasingMode="EaseOut"/>
|
||||
</interactivity:FluidMoveBehavior.EaseX>
|
||||
</interactivity:FluidMoveBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
</controls:TabPanel>
|
||||
</Border>
|
||||
</controls:ScrollViewer>
|
||||
<Border Margin="0,-1,0,0" Grid.Row="0" Grid.Column="2" BorderThickness="1,0,0,1" BorderBrush="{DynamicResource MahApps.Brushes.Control.Border}" Background="{DynamicResource MahApps.Brushes.Gray8}" HorizontalAlignment="Right">
|
||||
<Border.CacheMode>
|
||||
<BitmapCache SnapsToDevicePixels="True"/>
|
||||
</Border.CacheMode>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<RepeatButton Focusable="False" Visibility="{TemplateBinding ShowScrollButton,Converter={StaticResource Boolean2VisibilityConverter}}" Style="{StaticResource RepeatButtonIcon}" BorderBrush="{DynamicResource MahApps.Brushes.Control.Border}" Padding="8" controls:IconElement.Geometry="{StaticResource RightGeometry}" Foreground="{DynamicResource MahApps.Brushes.Text}" Background="{DynamicResource MahApps.Brushes.ThemeBackground}" x:Name="PART_ScrollButtonRight"/>
|
||||
<Border Visibility="{Binding Visibility,ElementName=PART_OverflowButton}" Width="1" Background="{DynamicResource MahApps.Brushes.Control.Border}"/>
|
||||
<controls:ContextMenuToggleButton x:Name="PART_OverflowButton" Visibility="Collapsed" Style="{StaticResource ToggleButtonIconTransparent}" controls:IconSwitchElement.Geometry="{StaticResource DownGeometry}" controls:IconSwitchElement.GeometrySelected="{StaticResource UpGeometry}"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border x:Name="contentPanel" Background="{DynamicResource MahApps.Brushes.ThemeBackground}" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
|
||||
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
|
||||
<Style TargetType="controls:TabControl">
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Gray8}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource MahApps.Brushes.Control.Border}"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Template" Value="{StaticResource TabControlPlusTemplate}"/>
|
||||
<Style.Triggers>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsScrollable" Value="True"/>
|
||||
<Condition Property="IsTabFillEnabled" Value="False"/>
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter Property="Template" Value="{StaticResource TabControlPlusScrollableTemplate}"/>
|
||||
</MultiTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -1,443 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
{
|
||||
[TemplatePart(Name = OverflowButtonKey, Type = typeof(ContextMenuToggleButton))]
|
||||
[TemplatePart(Name = HeaderPanelKey, Type = typeof(TabPanel))]
|
||||
[TemplatePart(Name = OverflowScrollviewer, Type = typeof(ScrollViewer))]
|
||||
[TemplatePart(Name = ScrollButtonLeft, Type = typeof(ButtonBase))]
|
||||
[TemplatePart(Name = ScrollButtonRight, Type = typeof(ButtonBase))]
|
||||
[TemplatePart(Name = HeaderBorder, Type = typeof(System.Windows.Controls.Border))]
|
||||
public class TabControl : System.Windows.Controls.TabControl
|
||||
{
|
||||
private const string OverflowButtonKey = "PART_OverflowButton";
|
||||
|
||||
private const string HeaderPanelKey = "PART_HeaderPanel";
|
||||
|
||||
private const string OverflowScrollviewer = "PART_OverflowScrollviewer";
|
||||
|
||||
private const string ScrollButtonLeft = "PART_ScrollButtonLeft";
|
||||
|
||||
private const string ScrollButtonRight = "PART_ScrollButtonRight";
|
||||
|
||||
private const string HeaderBorder = "PART_HeaderBorder";
|
||||
|
||||
private ContextMenuToggleButton _buttonOverflow;
|
||||
|
||||
internal TabPanel HeaderPanel { get; private set; }
|
||||
|
||||
private ScrollViewer _scrollViewerOverflow;
|
||||
|
||||
private ButtonBase _buttonScrollLeft;
|
||||
|
||||
private ButtonBase _buttonScrollRight;
|
||||
|
||||
private System.Windows.Controls.Border _headerBorder;
|
||||
|
||||
/// <summary>
|
||||
/// 是否为内部操作
|
||||
/// </summary>
|
||||
internal bool IsInternalAction;
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用动画
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IsAnimationEnabledProperty = DependencyProperty.Register(
|
||||
"IsAnimationEnabled", typeof(bool), typeof(TabControl), new PropertyMetadata(false));
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用动画
|
||||
/// </summary>
|
||||
public bool IsAnimationEnabled
|
||||
{
|
||||
get => (bool)GetValue(IsAnimationEnabledProperty);
|
||||
set => SetValue(IsAnimationEnabledProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否可以拖动
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IsDraggableProperty = DependencyProperty.Register(
|
||||
"IsDraggable", typeof(bool), typeof(TabControl), new PropertyMetadata(false));
|
||||
|
||||
/// <summary>
|
||||
/// 是否可以拖动
|
||||
/// </summary>
|
||||
public bool IsDraggable
|
||||
{
|
||||
get => (bool)GetValue(IsDraggableProperty);
|
||||
set => SetValue(IsDraggableProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示关闭按钮
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty ShowCloseButtonProperty = DependencyProperty.RegisterAttached(
|
||||
"ShowCloseButton", typeof(bool), typeof(TabControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.Inherits));
|
||||
|
||||
public static void SetShowCloseButton(DependencyObject element, bool value)
|
||||
=> element.SetValue(ShowCloseButtonProperty, value);
|
||||
|
||||
public static bool GetShowCloseButton(DependencyObject element)
|
||||
=> (bool) element.GetValue(ShowCloseButtonProperty);
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示关闭按钮
|
||||
/// </summary>
|
||||
public bool ShowCloseButton
|
||||
{
|
||||
get => (bool)GetValue(ShowCloseButtonProperty);
|
||||
set => SetValue(ShowCloseButtonProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示上下文菜单
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty ShowContextMenuProperty = DependencyProperty.RegisterAttached(
|
||||
"ShowContextMenu", typeof(bool), typeof(TabControl), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.Inherits));
|
||||
|
||||
public static void SetShowContextMenu(DependencyObject element, bool value)
|
||||
=> element.SetValue(ShowContextMenuProperty, value);
|
||||
|
||||
public static bool GetShowContextMenu(DependencyObject element)
|
||||
=> (bool) element.GetValue(ShowContextMenuProperty);
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示上下文菜单
|
||||
/// </summary>
|
||||
public bool ShowContextMenu
|
||||
{
|
||||
get => (bool)GetValue(ShowContextMenuProperty);
|
||||
set => SetValue(ShowContextMenuProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否将标签填充
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IsTabFillEnabledProperty = DependencyProperty.Register(
|
||||
"IsTabFillEnabled", typeof(bool), typeof(TabControl), new PropertyMetadata(false));
|
||||
|
||||
/// <summary>
|
||||
/// 是否将标签填充
|
||||
/// </summary>
|
||||
public bool IsTabFillEnabled
|
||||
{
|
||||
get => (bool)GetValue(IsTabFillEnabledProperty);
|
||||
set => SetValue(IsTabFillEnabledProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 标签宽度
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty TabItemWidthProperty = DependencyProperty.Register(
|
||||
"TabItemWidth", typeof(double), typeof(TabControl), new PropertyMetadata(200.0));
|
||||
|
||||
/// <summary>
|
||||
/// 标签宽度
|
||||
/// </summary>
|
||||
public double TabItemWidth
|
||||
{
|
||||
get => (double)GetValue(TabItemWidthProperty);
|
||||
set => SetValue(TabItemWidthProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 标签高度
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty TabItemHeightProperty = DependencyProperty.Register(
|
||||
"TabItemHeight", typeof(double), typeof(TabControl), new PropertyMetadata(30.0));
|
||||
|
||||
/// <summary>
|
||||
/// 标签高度
|
||||
/// </summary>
|
||||
public double TabItemHeight
|
||||
{
|
||||
get => (double)GetValue(TabItemHeightProperty);
|
||||
set => SetValue(TabItemHeightProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否可以滚动
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IsScrollableProperty = DependencyProperty.Register(
|
||||
"IsScrollable", typeof(bool), typeof(TabControl), new PropertyMetadata(false));
|
||||
|
||||
/// <summary>
|
||||
/// 是否可以滚动
|
||||
/// </summary>
|
||||
public bool IsScrollable
|
||||
{
|
||||
get => (bool) GetValue(IsScrollableProperty);
|
||||
set => SetValue(IsScrollableProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示溢出按钮
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty ShowOverflowButtonProperty = DependencyProperty.Register(
|
||||
"ShowOverflowButton", typeof(bool), typeof(TabControl), new PropertyMetadata(true));
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示溢出按钮
|
||||
/// </summary>
|
||||
public bool ShowOverflowButton
|
||||
{
|
||||
get => (bool) GetValue(ShowOverflowButtonProperty);
|
||||
set => SetValue(ShowOverflowButtonProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示滚动按钮
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty ShowScrollButtonProperty = DependencyProperty.Register(
|
||||
"ShowScrollButton", typeof(bool), typeof(TabControl), new PropertyMetadata(false));
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示滚动按钮
|
||||
/// </summary>
|
||||
public bool ShowScrollButton
|
||||
{
|
||||
get => (bool) GetValue(ShowScrollButtonProperty);
|
||||
set => SetValue(ShowScrollButtonProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 可见的标签数量
|
||||
/// </summary>
|
||||
private int _itemShowCount;
|
||||
|
||||
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
base.OnItemsChanged(e);
|
||||
|
||||
if (HeaderPanel == null)
|
||||
{
|
||||
IsInternalAction = false;
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateOverflowButton();
|
||||
|
||||
if (IsInternalAction)
|
||||
{
|
||||
IsInternalAction = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsAnimationEnabled)
|
||||
{
|
||||
HeaderPanel.SetCurrentValue(TabPanel.FluidMoveDurationProperty, new Duration(TimeSpan.FromMilliseconds(200)));
|
||||
}
|
||||
else
|
||||
{
|
||||
HeaderPanel.FluidMoveDuration = new Duration(TimeSpan.FromSeconds(0));
|
||||
}
|
||||
|
||||
if (e.Action == NotifyCollectionChangedAction.Add)
|
||||
{
|
||||
for (var i = 0; i < Items.Count; i++)
|
||||
{
|
||||
if (!(ItemContainerGenerator.ContainerFromIndex(i) is TabItem item)) return;
|
||||
item.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
|
||||
item.TabPanel = HeaderPanel;
|
||||
}
|
||||
}
|
||||
|
||||
_headerBorder?.InvalidateMeasure();
|
||||
|
||||
IsInternalAction = false;
|
||||
}
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
if (_buttonOverflow != null)
|
||||
{
|
||||
if (_buttonOverflow.Menu != null)
|
||||
{
|
||||
_buttonOverflow.Menu.Closed -= Menu_Closed;
|
||||
_buttonOverflow.Menu = null;
|
||||
}
|
||||
|
||||
_buttonOverflow.Click -= ButtonOverflow_Click;
|
||||
}
|
||||
|
||||
if (_buttonScrollLeft != null) _buttonScrollLeft.Click -= ButtonScrollLeft_Click;
|
||||
if (_buttonScrollRight != null) _buttonScrollRight.Click -= ButtonScrollRight_Click;
|
||||
|
||||
base.OnApplyTemplate();
|
||||
HeaderPanel = GetTemplateChild(HeaderPanelKey) as TabPanel;
|
||||
|
||||
if (IsTabFillEnabled) return;
|
||||
|
||||
_buttonOverflow = GetTemplateChild(OverflowButtonKey) as ContextMenuToggleButton;
|
||||
_scrollViewerOverflow = GetTemplateChild(OverflowScrollviewer) as ScrollViewer;
|
||||
_buttonScrollLeft = GetTemplateChild(ScrollButtonLeft) as ButtonBase;
|
||||
_buttonScrollRight = GetTemplateChild(ScrollButtonRight) as ButtonBase;
|
||||
_headerBorder = GetTemplateChild(HeaderBorder) as System.Windows.Controls.Border;
|
||||
|
||||
if (_buttonScrollLeft != null) _buttonScrollLeft.Click += ButtonScrollLeft_Click;
|
||||
if (_buttonScrollRight != null) _buttonScrollRight.Click += ButtonScrollRight_Click;
|
||||
|
||||
if (_buttonOverflow != null)
|
||||
{
|
||||
var menu = new System.Windows.Controls.ContextMenu
|
||||
{
|
||||
Placement = PlacementMode.Bottom,
|
||||
PlacementTarget = _buttonOverflow
|
||||
};
|
||||
menu.Closed += Menu_Closed;
|
||||
_buttonOverflow.Menu = menu;
|
||||
_buttonOverflow.Click += ButtonOverflow_Click;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
|
||||
{
|
||||
base.OnRenderSizeChanged(sizeInfo);
|
||||
UpdateOverflowButton();
|
||||
}
|
||||
|
||||
private void UpdateOverflowButton()
|
||||
{
|
||||
if (!IsTabFillEnabled)
|
||||
{
|
||||
_itemShowCount = (int)(ActualWidth / TabItemWidth);
|
||||
if (_buttonOverflow != null)
|
||||
{
|
||||
_buttonOverflow.Visibility = (ShowOverflowButton && Items.Count > 0 && Items.Count >= _itemShowCount) ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Menu_Closed(object sender, RoutedEventArgs e) => _buttonOverflow.IsChecked = false;
|
||||
|
||||
private void ButtonScrollRight_Click(object sender, RoutedEventArgs e) =>
|
||||
_scrollViewerOverflow.ScrollToHorizontalOffsetInternal(Math.Min(
|
||||
_scrollViewerOverflow.CurrentHorizontalOffset + TabItemWidth, _scrollViewerOverflow.ScrollableWidth));
|
||||
|
||||
private void ButtonScrollLeft_Click(object sender, RoutedEventArgs e) =>
|
||||
_scrollViewerOverflow.ScrollToHorizontalOffsetInternal(Math.Max(
|
||||
_scrollViewerOverflow.CurrentHorizontalOffset - TabItemWidth, 0));
|
||||
|
||||
private void ButtonOverflow_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_buttonOverflow.IsChecked == true)
|
||||
{
|
||||
_buttonOverflow.Menu.Items.Clear();
|
||||
for (var i = 0; i < Items.Count; i++)
|
||||
{
|
||||
if(!(ItemContainerGenerator.ContainerFromIndex(i) is TabItem item)) continue;
|
||||
|
||||
var menuItem = new System.Windows.Controls.MenuItem
|
||||
{
|
||||
HeaderStringFormat = ItemStringFormat,
|
||||
HeaderTemplate = ItemTemplate,
|
||||
HeaderTemplateSelector = ItemTemplateSelector,
|
||||
Header = item.Header,
|
||||
Width = TabItemWidth,
|
||||
IsChecked = item.IsSelected,
|
||||
IsCheckable = true
|
||||
};
|
||||
|
||||
menuItem.Click += delegate
|
||||
{
|
||||
_buttonOverflow.IsChecked = false;
|
||||
|
||||
var list = GetActualList();
|
||||
if (list == null) return;
|
||||
|
||||
var actualItem = ItemContainerGenerator.ItemFromContainer(item);
|
||||
if (actualItem == null) return;
|
||||
|
||||
var index = list.IndexOf(actualItem);
|
||||
if (index >= _itemShowCount)
|
||||
{
|
||||
list.Remove(actualItem);
|
||||
list.Insert(0, actualItem);
|
||||
if (IsAnimationEnabled)
|
||||
{
|
||||
HeaderPanel.SetCurrentValue(TabPanel.FluidMoveDurationProperty, new Duration(TimeSpan.FromMilliseconds(200)));
|
||||
}
|
||||
else
|
||||
{
|
||||
HeaderPanel.FluidMoveDuration = new Duration(TimeSpan.FromSeconds(0));
|
||||
}
|
||||
HeaderPanel.ForceUpdate = true;
|
||||
HeaderPanel.Measure(new Size(HeaderPanel.DesiredSize.Width, ActualHeight));
|
||||
HeaderPanel.ForceUpdate = false;
|
||||
SetCurrentValue(SelectedIndexProperty, 0);
|
||||
}
|
||||
|
||||
item.IsSelected = true;
|
||||
};
|
||||
_buttonOverflow.Menu.Items.Add(menuItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal double GetHorizontalOffset() => _scrollViewerOverflow?.CurrentHorizontalOffset ?? 0;
|
||||
|
||||
internal void UpdateScroll() => _scrollViewerOverflow?.RaiseEvent(new MouseWheelEventArgs(Mouse.PrimaryDevice, Environment.TickCount, 0)
|
||||
{
|
||||
RoutedEvent = MouseWheelEvent
|
||||
});
|
||||
|
||||
internal void CloseAllItems() => CloseOtherItems(null);
|
||||
|
||||
internal void CloseOtherItems(TabItem currentItem)
|
||||
{
|
||||
var actualItem = currentItem != null ? ItemContainerGenerator.ItemFromContainer(currentItem) : null;
|
||||
|
||||
var list = GetActualList();
|
||||
if (list == null) return;
|
||||
|
||||
IsInternalAction = true;
|
||||
|
||||
for (var i = 0; i < Items.Count; i++)
|
||||
{
|
||||
var item = list[i];
|
||||
if (!Equals(item, actualItem) && item != null)
|
||||
{
|
||||
var argsClosing = new CancelRoutedEventArgs(TabItem.ClosingEvent, item);
|
||||
|
||||
if (!(ItemContainerGenerator.ContainerFromItem(item) is TabItem tabItem)) continue;
|
||||
|
||||
tabItem.RaiseEvent(argsClosing);
|
||||
if (argsClosing.Cancel) return;
|
||||
|
||||
tabItem.RaiseEvent(new RoutedEventArgs(TabItem.ClosedEvent, item));
|
||||
list.Remove(item);
|
||||
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
SetCurrentValue(SelectedIndexProperty, Items.Count == 0 ? -1 : 0);
|
||||
}
|
||||
|
||||
internal IList GetActualList()
|
||||
{
|
||||
IList list;
|
||||
if (ItemsSource != null)
|
||||
{
|
||||
list = ItemsSource as IList;
|
||||
}
|
||||
else
|
||||
{
|
||||
list = Items;
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
protected override bool IsItemItsOwnContainerOverride(object item) => item is TabItem;
|
||||
|
||||
protected override DependencyObject GetContainerForItemOverride() => new TabItem();
|
||||
}
|
||||
}
|
||||
@@ -1,467 +0,0 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
{
|
||||
public class TabItem : System.Windows.Controls.TabItem
|
||||
{
|
||||
/// <summary>
|
||||
/// 动画速度
|
||||
/// </summary>
|
||||
private const int AnimationSpeed = 150;
|
||||
|
||||
/// <summary>
|
||||
/// 选项卡是否处于拖动状态
|
||||
/// </summary>
|
||||
private static bool ItemIsDragging;
|
||||
|
||||
/// <summary>
|
||||
/// 选项卡是否等待被拖动
|
||||
/// </summary>
|
||||
private bool _isWaiting;
|
||||
|
||||
/// <summary>
|
||||
/// 拖动中的选项卡坐标
|
||||
/// </summary>
|
||||
private Point _dragPoint;
|
||||
|
||||
/// <summary>
|
||||
/// 鼠标按下时选项卡位置
|
||||
/// </summary>
|
||||
private int _mouseDownIndex;
|
||||
|
||||
/// <summary>
|
||||
/// 鼠标按下时选项卡横向偏移
|
||||
/// </summary>
|
||||
private double _mouseDownOffsetX;
|
||||
|
||||
/// <summary>
|
||||
/// 鼠标按下时的坐标
|
||||
/// </summary>
|
||||
private Point _mouseDownPoint;
|
||||
|
||||
/// <summary>
|
||||
/// 右侧可移动的最大值
|
||||
/// </summary>
|
||||
private double _maxMoveRight;
|
||||
|
||||
/// <summary>
|
||||
/// 左侧可移动的最大值
|
||||
/// </summary>
|
||||
private double _maxMoveLeft;
|
||||
|
||||
/// <summary>
|
||||
/// 选项卡宽度
|
||||
/// </summary>
|
||||
public double ItemWidth { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选项卡拖动等待距离(在鼠标移动了超过20个像素无关单位后,选项卡才开始被拖动)
|
||||
/// </summary>
|
||||
private const double WaitLength = 20;
|
||||
|
||||
/// <summary>
|
||||
/// 选项卡是否处于拖动状态
|
||||
/// </summary>
|
||||
private bool _isDragging;
|
||||
|
||||
/// <summary>
|
||||
/// 选项卡是否已经被拖动
|
||||
/// </summary>
|
||||
private bool _isDragged;
|
||||
|
||||
/// <summary>
|
||||
/// 目标横向位移
|
||||
/// </summary>
|
||||
internal double TargetOffsetX { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前编号
|
||||
/// </summary>
|
||||
private int _currentIndex;
|
||||
|
||||
/// <summary>
|
||||
/// 标签容器横向滚动距离
|
||||
/// </summary>
|
||||
private double _scrollHorizontalOffset;
|
||||
|
||||
private TabPanel _tabPanel;
|
||||
|
||||
/// <summary>
|
||||
/// 标签容器
|
||||
/// </summary>
|
||||
internal TabPanel TabPanel
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_tabPanel == null && TabControlParent != null)
|
||||
{
|
||||
_tabPanel = TabControlParent.HeaderPanel;
|
||||
}
|
||||
|
||||
return _tabPanel;
|
||||
}
|
||||
set => _tabPanel = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前编号
|
||||
/// </summary>
|
||||
internal int CurrentIndex
|
||||
{
|
||||
get => _currentIndex;
|
||||
set
|
||||
{
|
||||
if (_currentIndex == value || value < 0) return;
|
||||
var oldIndex = _currentIndex;
|
||||
_currentIndex = value;
|
||||
UpdateItemOffsetX(oldIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示关闭按钮
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty ShowCloseButtonProperty =
|
||||
TabControl.ShowCloseButtonProperty.AddOwner(typeof(TabItem));
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示关闭按钮
|
||||
/// </summary>
|
||||
public bool ShowCloseButton
|
||||
{
|
||||
get => (bool)GetValue(ShowCloseButtonProperty);
|
||||
set => SetValue(ShowCloseButtonProperty, value);
|
||||
}
|
||||
|
||||
public static void SetShowCloseButton(DependencyObject element, bool value)
|
||||
=> element.SetValue(ShowCloseButtonProperty, value);
|
||||
|
||||
public static bool GetShowCloseButton(DependencyObject element)
|
||||
=> (bool)element.GetValue(ShowCloseButtonProperty);
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示上下文菜单
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty ShowContextMenuProperty =
|
||||
TabControl.ShowContextMenuProperty.AddOwner(typeof(TabItem), new FrameworkPropertyMetadata(OnShowContextMenuChanged));
|
||||
|
||||
private static void OnShowContextMenuChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var ctl = (TabItem) d;
|
||||
if (ctl.Menu != null)
|
||||
{
|
||||
var show = (bool)e.NewValue;
|
||||
ctl.Menu.IsEnabled = show;
|
||||
ctl.Menu.Show(show);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示上下文菜单
|
||||
/// </summary>
|
||||
public bool ShowContextMenu
|
||||
{
|
||||
get => (bool) GetValue(ShowContextMenuProperty);
|
||||
set => SetValue(ShowContextMenuProperty, value);
|
||||
}
|
||||
|
||||
public static void SetShowContextMenu(DependencyObject element, bool value)
|
||||
=> element.SetValue(ShowContextMenuProperty, value);
|
||||
|
||||
public static bool GetShowContextMenu(DependencyObject element)
|
||||
=> (bool)element.GetValue(ShowContextMenuProperty);
|
||||
|
||||
public static readonly DependencyProperty MenuProperty = DependencyProperty.Register(
|
||||
"Menu", typeof(System.Windows.Controls.ContextMenu), typeof(TabItem), new PropertyMetadata(default(System.Windows.Controls.ContextMenu), OnMenuChanged));
|
||||
|
||||
private static void OnMenuChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var ctl = (TabItem) d;
|
||||
ctl.OnMenuChanged(e.NewValue as System.Windows.Controls.ContextMenu);
|
||||
}
|
||||
|
||||
private void OnMenuChanged(System.Windows.Controls.ContextMenu menu)
|
||||
{
|
||||
if (IsLoaded && menu != null)
|
||||
{
|
||||
var parent = TabControlParent;
|
||||
if (parent == null) return;
|
||||
|
||||
var item = parent.ItemContainerGenerator.ItemFromContainer(this);
|
||||
|
||||
menu.DataContext = item;
|
||||
menu.SetBinding(IsEnabledProperty, new Binding(ShowContextMenuProperty.Name)
|
||||
{
|
||||
Source = this
|
||||
});
|
||||
menu.SetBinding(VisibilityProperty, new Binding(ShowContextMenuProperty.Name)
|
||||
{
|
||||
Source = this,
|
||||
Converter = ResourceHelper.GetResource<IValueConverter>("Boolean2VisibilityConverter")
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public System.Windows.Controls.ContextMenu Menu
|
||||
{
|
||||
get => (System.Windows.Controls.ContextMenu) GetValue(MenuProperty);
|
||||
set => SetValue(MenuProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新选项卡横向偏移
|
||||
/// </summary>
|
||||
/// <param name="oldIndex"></param>
|
||||
private void UpdateItemOffsetX(int oldIndex)
|
||||
{
|
||||
if (!_isDragging) return;
|
||||
var moveItem = TabPanel.ItemDic[CurrentIndex];
|
||||
moveItem.CurrentIndex -= CurrentIndex - oldIndex;
|
||||
var offsetX = moveItem.TargetOffsetX;
|
||||
var resultX = offsetX + (oldIndex - CurrentIndex) * ItemWidth;
|
||||
TabPanel.ItemDic[CurrentIndex] = this;
|
||||
TabPanel.ItemDic[moveItem.CurrentIndex] = moveItem;
|
||||
moveItem.CreateAnimation(offsetX, resultX);
|
||||
}
|
||||
|
||||
public TabItem()
|
||||
{
|
||||
CommandBindings.Add(new CommandBinding(ControlCommands.Close, (s, e) => Close()));
|
||||
CommandBindings.Add(new CommandBinding(ControlCommands.CloseAll,
|
||||
(s, e) => { TabControlParent.CloseAllItems(); }));
|
||||
CommandBindings.Add(new CommandBinding(ControlCommands.CloseOther,
|
||||
(s, e) => { TabControlParent.CloseOtherItems(this); }));
|
||||
|
||||
Loaded += (s, e) => OnMenuChanged(Menu);
|
||||
}
|
||||
|
||||
private Util.Controls.Handy.TabControls.TabControl TabControlParent => System.Windows.Controls.ItemsControl.ItemsControlFromItemContainer(this) as TabControl;
|
||||
|
||||
protected override void OnMouseRightButtonDown(MouseButtonEventArgs e)
|
||||
{
|
||||
base.OnMouseRightButtonDown(e);
|
||||
IsSelected = true;
|
||||
Focus();
|
||||
}
|
||||
|
||||
protected override void OnHeaderChanged(object oldHeader, object newHeader)
|
||||
{
|
||||
base.OnHeaderChanged(oldHeader, newHeader);
|
||||
|
||||
if (TabPanel != null)
|
||||
{
|
||||
TabPanel.ForceUpdate = true;
|
||||
InvalidateMeasure();
|
||||
TabPanel.ForceUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
internal void Close()
|
||||
{
|
||||
var parent = TabControlParent;
|
||||
if (parent == null) return;
|
||||
|
||||
var item = parent.ItemContainerGenerator.ItemFromContainer(this);
|
||||
|
||||
var argsClosing = new CancelRoutedEventArgs(ClosingEvent, item);
|
||||
RaiseEvent(argsClosing);
|
||||
if (argsClosing.Cancel) return;
|
||||
|
||||
TabPanel.SetCurrentValue(TabPanel.FluidMoveDurationProperty, parent.IsAnimationEnabled
|
||||
? new Duration(TimeSpan.FromMilliseconds(200))
|
||||
: new Duration(TimeSpan.FromMilliseconds(1)));
|
||||
|
||||
parent.IsInternalAction = true;
|
||||
RaiseEvent(new RoutedEventArgs(ClosedEvent, item));
|
||||
|
||||
var list = parent.GetActualList();
|
||||
list?.Remove(item);
|
||||
}
|
||||
|
||||
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
|
||||
{
|
||||
base.OnMouseLeftButtonDown(e);
|
||||
|
||||
var parent = TabControlParent;
|
||||
if (parent == null) return;
|
||||
|
||||
if (parent.IsDraggable && !ItemIsDragging && !_isDragging)
|
||||
{
|
||||
parent.UpdateScroll();
|
||||
TabPanel.FluidMoveDuration = new Duration(TimeSpan.FromSeconds(0));
|
||||
_mouseDownOffsetX = RenderTransform.Value.OffsetX;
|
||||
_scrollHorizontalOffset = parent.GetHorizontalOffset();
|
||||
var mx = TranslatePoint(new Point(), parent).X + _scrollHorizontalOffset;
|
||||
_mouseDownIndex = CalLocationIndex(mx);
|
||||
var subIndex = _mouseDownIndex - CalLocationIndex(_scrollHorizontalOffset);
|
||||
_maxMoveLeft = -subIndex * ItemWidth;
|
||||
_maxMoveRight = parent.ActualWidth - ActualWidth + _maxMoveLeft;
|
||||
|
||||
_isDragging = true;
|
||||
ItemIsDragging = true;
|
||||
_isWaiting = true;
|
||||
_dragPoint = e.GetPosition(parent);
|
||||
_dragPoint = new Point(_dragPoint.X + _scrollHorizontalOffset, _dragPoint.Y);
|
||||
_mouseDownPoint = _dragPoint;
|
||||
CaptureMouse();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
|
||||
if (ItemIsDragging && _isDragging)
|
||||
{
|
||||
var parent = TabControlParent;
|
||||
if (parent == null) return;
|
||||
|
||||
var subX = TranslatePoint(new Point(), parent).X + _scrollHorizontalOffset;
|
||||
CurrentIndex = CalLocationIndex(subX);
|
||||
|
||||
var p = e.GetPosition(parent);
|
||||
p = new Point(p.X + _scrollHorizontalOffset, p.Y);
|
||||
|
||||
var subLeft = p.X - _dragPoint.X;
|
||||
var totalLeft = p.X - _mouseDownPoint.X;
|
||||
|
||||
if (Math.Abs(subLeft) <= WaitLength && _isWaiting) return;
|
||||
|
||||
_isWaiting = false;
|
||||
_isDragged = true;
|
||||
|
||||
var left = subLeft + RenderTransform.Value.OffsetX;
|
||||
if (totalLeft < _maxMoveLeft)
|
||||
{
|
||||
left = _maxMoveLeft + _mouseDownOffsetX;
|
||||
}
|
||||
else if (totalLeft > _maxMoveRight)
|
||||
{
|
||||
left = _maxMoveRight + _mouseDownOffsetX;
|
||||
}
|
||||
|
||||
var t = new TranslateTransform(left, 0);
|
||||
RenderTransform = t;
|
||||
_dragPoint = p;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
|
||||
{
|
||||
base.OnMouseLeftButtonUp(e);
|
||||
|
||||
ReleaseMouseCapture();
|
||||
|
||||
if (_isDragged)
|
||||
{
|
||||
var parent = TabControlParent;
|
||||
if (parent == null) return;
|
||||
|
||||
var subX = TranslatePoint(new Point(), parent).X + _scrollHorizontalOffset;
|
||||
var index = CalLocationIndex(subX);
|
||||
var left = index * ItemWidth;
|
||||
var offsetX = RenderTransform.Value.OffsetX;
|
||||
CreateAnimation(offsetX, offsetX - subX + left, index);
|
||||
}
|
||||
|
||||
_isDragging = false;
|
||||
ItemIsDragging = false;
|
||||
_isDragged = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建动画
|
||||
/// </summary>
|
||||
internal void CreateAnimation(double offsetX, double resultX, int index = -1)
|
||||
{
|
||||
var parent = TabControlParent;
|
||||
|
||||
void AnimationCompleted()
|
||||
{
|
||||
RenderTransform = new TranslateTransform(resultX, 0);
|
||||
if (index == -1) return;
|
||||
|
||||
var list = parent.GetActualList();
|
||||
if (list == null) return;
|
||||
|
||||
var item = parent.ItemContainerGenerator.ItemFromContainer(this);
|
||||
if (item == null) return;
|
||||
|
||||
TabPanel.CanUpdate = false;
|
||||
parent.IsInternalAction = true;
|
||||
|
||||
list.Remove(item);
|
||||
parent.IsInternalAction = true;
|
||||
list.Insert(index, item);
|
||||
TabPanel.CanUpdate = true;
|
||||
TabPanel.ForceUpdate = true;
|
||||
TabPanel.Measure(new Size(TabPanel.DesiredSize.Width, ActualHeight));
|
||||
TabPanel.ForceUpdate = false;
|
||||
|
||||
Focus();
|
||||
IsSelected = true;
|
||||
|
||||
if (!IsMouseCaptured)
|
||||
{
|
||||
parent.SetCurrentValue(Selector.SelectedIndexProperty, _currentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
TargetOffsetX = resultX;
|
||||
if (!parent.IsAnimationEnabled)
|
||||
{
|
||||
AnimationCompleted();
|
||||
return;
|
||||
}
|
||||
|
||||
var animation = AnimationHelper.CreateAnimation(resultX, AnimationSpeed);
|
||||
animation.FillBehavior = FillBehavior.Stop;
|
||||
animation.Completed += (s1, e1) => AnimationCompleted();
|
||||
var f = new TranslateTransform(offsetX, 0);
|
||||
RenderTransform = f;
|
||||
f.BeginAnimation(TranslateTransform.XProperty, animation, HandoffBehavior.Compose);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算选项卡当前合适的位置编号
|
||||
/// </summary>
|
||||
/// <param name="left"></param>
|
||||
/// <returns></returns>
|
||||
private int CalLocationIndex(double left)
|
||||
{
|
||||
if (_isWaiting)
|
||||
{
|
||||
return CurrentIndex;
|
||||
}
|
||||
|
||||
var maxIndex = TabControlParent.Items.Count - 1;
|
||||
var div = (int)(left / ItemWidth);
|
||||
var rest = left % ItemWidth;
|
||||
var result = rest / ItemWidth > .5 ? div + 1 : div;
|
||||
|
||||
return result > maxIndex ? maxIndex : result;
|
||||
}
|
||||
|
||||
public static readonly RoutedEvent ClosingEvent = EventManager.RegisterRoutedEvent("Closing", RoutingStrategy.Bubble, typeof(EventHandler), typeof(TabItem));
|
||||
|
||||
public event EventHandler Closing
|
||||
{
|
||||
add => AddHandler(ClosingEvent, value);
|
||||
remove => RemoveHandler(ClosingEvent, value);
|
||||
}
|
||||
|
||||
public static readonly RoutedEvent ClosedEvent = EventManager.RegisterRoutedEvent("Closed", RoutingStrategy.Bubble, typeof(EventHandler), typeof(TabItem));
|
||||
|
||||
public event EventHandler Closed
|
||||
{
|
||||
add => AddHandler(ClosedEvent, value);
|
||||
remove => RemoveHandler(ClosedEvent, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,172 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Controls
|
||||
{
|
||||
public class TabPanel : System.Windows.Controls.Panel
|
||||
{
|
||||
private int _itemCount;
|
||||
|
||||
/// <summary>
|
||||
/// 是否可以更新
|
||||
/// </summary>
|
||||
internal bool CanUpdate = true;
|
||||
|
||||
/// <summary>
|
||||
/// 选项卡字典
|
||||
/// </summary>
|
||||
internal Dictionary<int, TabItem> ItemDic = new Dictionary<int, TabItem>();
|
||||
|
||||
/// <summary>
|
||||
/// 流式行为持续时间
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty FluidMoveDurationProperty = DependencyProperty.Register(
|
||||
"FluidMoveDuration", typeof(Duration), typeof(TabPanel), new PropertyMetadata(new Duration(TimeSpan.FromMilliseconds(200))));
|
||||
|
||||
/// <summary>
|
||||
/// 流式行为持续时间
|
||||
/// </summary>
|
||||
public Duration FluidMoveDuration
|
||||
{
|
||||
get => (Duration)GetValue(FluidMoveDurationProperty);
|
||||
set => SetValue(FluidMoveDurationProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否将标签填充
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IsTabFillEnabledProperty = DependencyProperty.Register(
|
||||
"IsTabFillEnabled", typeof(bool), typeof(TabPanel), new PropertyMetadata(ValueBoxes.FalseBox));
|
||||
|
||||
/// <summary>
|
||||
/// 是否将标签填充
|
||||
/// </summary>
|
||||
public bool IsTabFillEnabled
|
||||
{
|
||||
get => (bool)GetValue(IsTabFillEnabledProperty);
|
||||
set => SetValue(IsTabFillEnabledProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 标签宽度
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty TabItemWidthProperty = DependencyProperty.Register(
|
||||
"TabItemWidth", typeof(double), typeof(TabPanel), new PropertyMetadata(200.0));
|
||||
|
||||
/// <summary>
|
||||
/// 标签宽度
|
||||
/// </summary>
|
||||
public double TabItemWidth
|
||||
{
|
||||
get => (double)GetValue(TabItemWidthProperty);
|
||||
set => SetValue(TabItemWidthProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 标签高度
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty TabItemHeightProperty = DependencyProperty.Register(
|
||||
"TabItemHeight", typeof(double), typeof(TabPanel), new PropertyMetadata(30.0));
|
||||
|
||||
/// <summary>
|
||||
/// 标签高度
|
||||
/// </summary>
|
||||
public double TabItemHeight
|
||||
{
|
||||
get => (double)GetValue(TabItemHeightProperty);
|
||||
set => SetValue(TabItemHeightProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否可以强制更新
|
||||
/// </summary>
|
||||
internal bool ForceUpdate;
|
||||
|
||||
private Size _oldSize;
|
||||
|
||||
/// <summary>
|
||||
/// 是否已经加载
|
||||
/// </summary>
|
||||
private bool _isLoaded;
|
||||
|
||||
protected override Size MeasureOverride(Size constraint)
|
||||
{
|
||||
if ((_itemCount == InternalChildren.Count || !CanUpdate) && !ForceUpdate) return _oldSize;
|
||||
constraint.Height = TabItemHeight;
|
||||
_itemCount = InternalChildren.Count;
|
||||
|
||||
var size = new Size();
|
||||
|
||||
ItemDic.Clear();
|
||||
|
||||
var count = InternalChildren.Count;
|
||||
if (count == 0)
|
||||
{
|
||||
_oldSize = new Size();
|
||||
return _oldSize;
|
||||
}
|
||||
constraint.Width += InternalChildren.Count;
|
||||
|
||||
var itemWidth = .0;
|
||||
var arr = new int[count];
|
||||
|
||||
if (!IsTabFillEnabled)
|
||||
{
|
||||
itemWidth = TabItemWidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (TemplatedParent is TabControl tabControl)
|
||||
{
|
||||
arr = ArithmeticHelper.DivideInt2Arr((int)tabControl.ActualWidth + InternalChildren.Count, count);
|
||||
}
|
||||
}
|
||||
|
||||
for (var index = 0; index < count; index++)
|
||||
{
|
||||
if (IsTabFillEnabled)
|
||||
{
|
||||
itemWidth = arr[index];
|
||||
}
|
||||
if (InternalChildren[index] is TabItem tabItem)
|
||||
{
|
||||
tabItem.RenderTransform = new TranslateTransform();
|
||||
tabItem.MaxWidth = itemWidth;
|
||||
var rect = new Rect
|
||||
{
|
||||
X = size.Width - tabItem.BorderThickness.Left,
|
||||
Width = itemWidth,
|
||||
Height = TabItemHeight
|
||||
};
|
||||
tabItem.Arrange(rect);
|
||||
tabItem.ItemWidth = itemWidth - tabItem.BorderThickness.Left;
|
||||
tabItem.CurrentIndex = index;
|
||||
tabItem.TargetOffsetX = 0;
|
||||
ItemDic[index] = tabItem;
|
||||
size.Width += tabItem.ItemWidth;
|
||||
}
|
||||
}
|
||||
size.Height = constraint.Height;
|
||||
_oldSize = size;
|
||||
return _oldSize;
|
||||
}
|
||||
|
||||
public TabPanel()
|
||||
{
|
||||
Loaded += (s, e) =>
|
||||
{
|
||||
if (_isLoaded) return;
|
||||
ForceUpdate = true;
|
||||
Measure(new Size(DesiredSize.Width, ActualHeight));
|
||||
ForceUpdate = false;
|
||||
foreach (var item in ItemDic.Values)
|
||||
{
|
||||
item.TabPanel = this;
|
||||
}
|
||||
_isLoaded = true;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using AIStudio.Wpf.ADiagram.Controls;
|
||||
using Util.DiagramDesigner;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Converters
|
||||
{
|
||||
public class CountShiftConverter : IMultiValueConverter
|
||||
{
|
||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (values != null && values.Length > 2)
|
||||
{
|
||||
var diagram = values[0] as Util.DiagramDesigner.DiagramControl;
|
||||
var zoomValue = (double)values[1];
|
||||
var pageunit = (PageUnit)values[2];
|
||||
var unit = Unit.Cm;
|
||||
if (pageunit > PageUnit.km)
|
||||
{
|
||||
unit = Unit.Inch;
|
||||
}
|
||||
Vector vector = System.Windows.Media.VisualTreeHelper.GetOffset(diagram);
|
||||
|
||||
if (parameter?.ToString() == "Y")
|
||||
{
|
||||
var value = 0 - (unit == Unit.Cm? DipHelper.DipToCm(vector.Y - 20) : DipHelper.DipToInch(vector.Y - 20))/ zoomValue;
|
||||
return value;
|
||||
}
|
||||
else
|
||||
{
|
||||
var value = 0 - (unit == Unit.Cm ? DipHelper.DipToCm(vector.X - 20) : DipHelper.DipToInch(vector.X - 20)) / zoomValue;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
using AIStudio.Wpf.ADiagram.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Util.DiagramDesigner;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Flowchart
|
||||
{
|
||||
public class FlowchartViewModel : DiagramsViewModel
|
||||
{
|
||||
public FlowchartViewModel(MainWindowViewModel mainWindowViewModel, string title, string status, DiagramType diagramType) : base(mainWindowViewModel, title, status, diagramType)
|
||||
{
|
||||
|
||||
}
|
||||
public FlowchartViewModel(MainWindowViewModel mainWindowViewModel, string filename) : base(mainWindowViewModel, filename)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void InitDiagramViewModel()
|
||||
{
|
||||
base.InitDiagramViewModel();
|
||||
|
||||
DiagramViewModel.ShowGrid = true;
|
||||
DiagramViewModel.GridCellSize = new Size(100, 100);
|
||||
DiagramViewModel.CellHorizontalAlignment = CellHorizontalAlignment.Center;
|
||||
DiagramViewModel.CellVerticalAlignment = CellVerticalAlignment.Center;
|
||||
}
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
DesignerItemViewModelBase start = new StartFlowNode() { Left = 100, Top = 0, Color = Colors.Yellow.ToString() };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(start);
|
||||
|
||||
DesignerItemViewModelBase middle1 = new MiddleFlowNode() { Left = 100, Top = 100, Color = Colors.Yellow.ToString(), Text = "主管审批", UserIds= new List<string> { "操作员1", "操作员2" }, ActType = "or" };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(middle1);
|
||||
|
||||
DesignerItemViewModelBase decide = new DecideFlowNode() { Left = 100, Top = 200, Color = Colors.Yellow.ToString(), Text = "5" };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(decide);
|
||||
|
||||
DesignerItemViewModelBase middle2 = new MiddleFlowNode() { Left = 200, Top = 300, Color = Colors.Yellow.ToString(), Text = "分管领导", UserIds = new List<string> { "操作员1", "操作员2" }, ActType = "and" };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(middle2);
|
||||
|
||||
DesignerItemViewModelBase cobegin = new COBeginFlowNode() { Left = 100, Top = 400, Color = Colors.Yellow.ToString() };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(cobegin);
|
||||
|
||||
DesignerItemViewModelBase middle3 = new MiddleFlowNode() { Left = 100, Top = 500, Color = Colors.Yellow.ToString(), Text = "财务审批", UserIds = new List<string> { "Admin" }, ActType = "or" };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(middle3);
|
||||
|
||||
DesignerItemViewModelBase middle4 = new MiddleFlowNode() { Left = 200, Top = 500, Color = Colors.Yellow.ToString(), Text = "人力审批", RoleIds = new List<string> { "操作员", "管理员" }, ActType = "or" };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(middle4);
|
||||
|
||||
DesignerItemViewModelBase coend = new COEndFlowNode() { Left = 100, Top = 600, Color = Colors.Yellow.ToString() };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(coend);
|
||||
|
||||
DesignerItemViewModelBase end = new EndFlowNode() { Left = 100, Top = 700, Color = Colors.Yellow.ToString() };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(end);
|
||||
|
||||
ConnectorViewModel connector1 = new ConnectorViewModel(start.BottomConnector, middle1.TopConnector);
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector1);
|
||||
|
||||
ConnectorViewModel connector2 = new ConnectorViewModel(middle1.BottomConnector, decide.TopConnector);
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector2);
|
||||
|
||||
ConnectorViewModel connector3 = new ConnectorViewModel(decide.RightConnector, middle2.TopConnector);
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector3);
|
||||
connector3.AddText(">=3");
|
||||
|
||||
ConnectorViewModel connector4 = new ConnectorViewModel(middle2.BottomConnector, cobegin.TopConnector);
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector4);
|
||||
|
||||
ConnectorViewModel connector5 = new ConnectorViewModel(decide.BottomConnector, cobegin.TopConnector);
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector5);
|
||||
connector5.AddText("<3");
|
||||
|
||||
ConnectorViewModel connector6 = new ConnectorViewModel(cobegin.BottomConnector, middle3.TopConnector);
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector6);
|
||||
|
||||
ConnectorViewModel connector7 = new ConnectorViewModel(cobegin.BottomConnector, middle4.TopConnector);
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector7);
|
||||
|
||||
ConnectorViewModel connector8 = new ConnectorViewModel(middle3.BottomConnector, coend.TopConnector);
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector8);
|
||||
|
||||
ConnectorViewModel connector9 = new ConnectorViewModel(middle4.BottomConnector, coend.TopConnector);
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector9);
|
||||
|
||||
ConnectorViewModel connector10 = new ConnectorViewModel(coend.BottomConnector, end.TopConnector);
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector10);
|
||||
|
||||
DiagramViewModel.ClearSelectedItems();
|
||||
|
||||
FlowchartService.InitOAData(DiagramViewModel.Items.OfType<FlowNode>().ToList(), DiagramViewModel.Items.OfType<ConnectorViewModel>().ToList());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
using System.Xml.Serialization;
|
||||
using Util.DiagramDesigner;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Flowchart
|
||||
{
|
||||
public class FlowNodeDesignerItem : DesignerItemBase
|
||||
{
|
||||
public FlowNodeDesignerItem()
|
||||
{
|
||||
|
||||
}
|
||||
public FlowNodeDesignerItem(FlowNode item) : base(item)
|
||||
{
|
||||
if (item is MiddleFlowNode middleFlow)
|
||||
{
|
||||
UserIds = middleFlow.UserIds;
|
||||
RoleIds = middleFlow.RoleIds;
|
||||
ActType = middleFlow.ActType;
|
||||
}
|
||||
Color = item.Color;
|
||||
Kind = item.Kind;
|
||||
StateImage = item.StateImage;
|
||||
}
|
||||
|
||||
[XmlArray]
|
||||
public List<string> UserIds { get; set; }
|
||||
|
||||
[XmlArray]
|
||||
public List<string> RoleIds { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public string ActType { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public string Color { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public NodeKinds Kind { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public string StateImage { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,169 +0,0 @@
|
||||
using AIStudio.Wpf.ADiagram.Helpers;
|
||||
using AIStudio.Wpf.ADiagram.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using Util.DiagramDesigner;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Flowchart
|
||||
{
|
||||
public class FlowNode : DesignerItemViewModelBase
|
||||
{
|
||||
protected IUIVisualizerService visualiserService;
|
||||
|
||||
public FlowNode(NodeKinds kind) : base()
|
||||
{
|
||||
Kind = kind;
|
||||
Text = Kind.GetDescription();
|
||||
ItemWidth = 80;
|
||||
ItemHeight = 40;
|
||||
|
||||
}
|
||||
|
||||
public FlowNode(IDiagramViewModel parent, DesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
ShowRotate = false;
|
||||
ShowText = true;
|
||||
IsReadOnlyText = true;
|
||||
|
||||
visualiserService = ApplicationServicesProvider.Instance.Provider.VisualizerService;
|
||||
}
|
||||
|
||||
protected override void LoadDesignerItemViewModel(IDiagramViewModel parent, SelectableDesignerItemBase designerbase)
|
||||
{
|
||||
base.LoadDesignerItemViewModel(parent, designerbase);
|
||||
|
||||
FlowNodeDesignerItem designer = designerbase as FlowNodeDesignerItem;
|
||||
this.Color = designer.Color;
|
||||
this.Kind = designer.Kind;
|
||||
this.StateImage = designer.StateImage;
|
||||
|
||||
if (this is MiddleFlowNode middle)
|
||||
{
|
||||
middle.UserIds = designer.UserIds;
|
||||
middle.RoleIds = designer.RoleIds;
|
||||
middle.ActType = designer.ActType;
|
||||
}
|
||||
}
|
||||
|
||||
private string _color;
|
||||
[Browsable(true)]
|
||||
public string Color
|
||||
{
|
||||
get { return _color; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref _color, value);
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public NodeKinds Kind { get; set; }
|
||||
|
||||
[Browsable(false)]
|
||||
public string StateImage { get; set; }
|
||||
|
||||
#region 没有存起来,仅仅测试使用,实际这些代码应该都在服务端
|
||||
private int _status;
|
||||
|
||||
public int Status
|
||||
{
|
||||
get { return _status; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref _status, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string _remark;
|
||||
public string Remark
|
||||
{
|
||||
get { return _remark; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref _remark, value);
|
||||
}
|
||||
}
|
||||
|
||||
public List<string> PreStepId { get; set; }
|
||||
public string NextStepId { get; set; }
|
||||
public Dictionary<string, string> SelectNextStep { get; set; } = new Dictionary<string, string>();
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class StartFlowNode : FlowNode
|
||||
{
|
||||
public StartFlowNode() : base(NodeKinds.Start)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public StartFlowNode(IDiagramViewModel parent, DesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class EndFlowNode : FlowNode
|
||||
{
|
||||
public EndFlowNode() : base(NodeKinds.End)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public EndFlowNode(IDiagramViewModel parent, DesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class DecideFlowNode : FlowNode
|
||||
{
|
||||
public DecideFlowNode() : base(NodeKinds.Decide)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public DecideFlowNode(IDiagramViewModel parent, DesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class COBeginFlowNode : FlowNode
|
||||
{
|
||||
public COBeginFlowNode() : base(NodeKinds.COBegin)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public COBeginFlowNode(IDiagramViewModel parent, DesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class COEndFlowNode : FlowNode
|
||||
{
|
||||
public COEndFlowNode() : base(NodeKinds.COEnd)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public COEndFlowNode(IDiagramViewModel parent, DesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
using AIStudio.Wpf.ADiagram.Controls;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using Util.DiagramDesigner;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Flowchart
|
||||
{
|
||||
public class MiddleFlowNode : FlowNode
|
||||
{
|
||||
public MiddleFlowNode() : base(NodeKinds.Middle)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public MiddleFlowNode(IDiagramViewModel parent, DesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private List<string> _userIds = new List<string>();
|
||||
[Browsable(true)]
|
||||
[StyleName("UserIdsStyle")]
|
||||
public List<string> UserIds
|
||||
{
|
||||
get { return _userIds; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref _userIds, value);
|
||||
}
|
||||
}
|
||||
|
||||
private List<string> _roleIds = new List<string>();
|
||||
[Browsable(true)]
|
||||
[StyleName("RoleIdsStyle")]
|
||||
public List<string> RoleIds
|
||||
{
|
||||
get { return _roleIds; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref _roleIds, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string _actType;
|
||||
[Browsable(true)]
|
||||
[StyleName("ActTypeStyle")]
|
||||
public string ActType
|
||||
{
|
||||
get { return _actType; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref _actType, value);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ExecuteEditCommand(object param)
|
||||
{
|
||||
if (IsReadOnly == true) return;
|
||||
|
||||
if (Status == 1)
|
||||
{
|
||||
MiddleFlowNodeData data = new MiddleFlowNodeData();
|
||||
if (visualiserService.ShowDialog(data) == true)
|
||||
{
|
||||
FlowchartService.Approve(this, data.Status, data.Remark);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("该节点不能进行审批!!!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,416 +0,0 @@
|
||||
using AIStudio.Wpf.ADiagram.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using Util.DiagramDesigner;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Logical
|
||||
{
|
||||
public class LogicalViewModel : DiagramsViewModel
|
||||
{
|
||||
public LogicalViewModel(MainWindowViewModel mainWindowViewModel, string title, string status, DiagramType diagramType) : base(mainWindowViewModel, title, status, diagramType)
|
||||
{
|
||||
|
||||
}
|
||||
public LogicalViewModel(MainWindowViewModel mainWindowViewModel, string filename) : base(mainWindowViewModel, filename)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void InitDiagramViewModel()
|
||||
{
|
||||
base.InitDiagramViewModel();
|
||||
|
||||
DiagramViewModel.ShowGrid = true;
|
||||
DiagramViewModel.GridCellSize = new Size(150, 100);
|
||||
DiagramViewModel.PageSizeOrientation = PageSizeOrientation.Horizontal;
|
||||
DiagramViewModel.CellHorizontalAlignment = CellHorizontalAlignment.Left;
|
||||
DiagramViewModel.CellVerticalAlignment = CellVerticalAlignment.None;
|
||||
|
||||
DiagramViewModel.Items.CollectionChanged += Items_CollectionChanged;
|
||||
}
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
TimerDesignerItemViewModel timer = new TimerDesignerItemViewModel() { Left = 0, Top = 10 };
|
||||
timer.Value = 0.5;
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(timer);
|
||||
|
||||
InputItemViewModel in1 = new InputItemViewModel() { Left = 0, Top = 50 };
|
||||
in1.LinkPoint = LogicalService.LinkPoint[0];
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(in1);
|
||||
|
||||
InputItemViewModel in2 = new InputItemViewModel() { Left = 0, Top = 80 };
|
||||
in2.LinkPoint = LogicalService.LinkPoint[1];
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(in2);
|
||||
|
||||
AddGateItemViewModel item1 = new AddGateItemViewModel() { Left = 150, Top = 50 };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(item1);
|
||||
|
||||
ConstantDesignerItemViewModel constant = new ConstantDesignerItemViewModel() { Left = 150, Top = 118 };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(constant);
|
||||
|
||||
GTGateItemViewModel gTGate = new GTGateItemViewModel() { Left = 300, Top = 50 };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(gTGate);
|
||||
|
||||
InputItemViewModel in3 = new InputItemViewModel() { Left = 300, Top = 118 };
|
||||
in3.LinkPoint = LogicalService.LinkPoint[2];
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(in3);
|
||||
|
||||
InputItemViewModel in4 = new InputItemViewModel() { Left = 300, Top = 148 };
|
||||
in4.LinkPoint = LogicalService.LinkPoint[3];
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(in4);
|
||||
|
||||
SELGateItemViewModel sELGate = new SELGateItemViewModel() { Left = 450, Top = 50 };
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(sELGate);
|
||||
|
||||
OutputItemViewModel out1 = new OutputItemViewModel() { Left = 600, Top = 50 };
|
||||
out1.LinkPoint = LogicalService.LinkPoint[4];
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(out1);
|
||||
|
||||
ConnectorViewModel connector1 = new ConnectorViewModel(in1.Output[0], item1.Input[0]);
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector1);
|
||||
|
||||
ConnectorViewModel connector2 = new ConnectorViewModel(in2.Output[0], item1.Input[1]);
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector2);
|
||||
|
||||
ConnectorViewModel connector3 = new ConnectorViewModel(item1.Output[0], gTGate.Input[0]);
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector3);
|
||||
|
||||
ConnectorViewModel connector4 = new ConnectorViewModel(constant.Output[0], gTGate.Input[1]);
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector4);
|
||||
|
||||
ConnectorViewModel connector5 = new ConnectorViewModel(gTGate.Output[0], sELGate.Input[0]);
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector5);
|
||||
|
||||
ConnectorViewModel connector6 = new ConnectorViewModel(in3.Output[0], sELGate.Input[1]);
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector6);
|
||||
|
||||
ConnectorViewModel connector7 = new ConnectorViewModel(in4.Output[0], sELGate.Input[2]);
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector7);
|
||||
|
||||
ConnectorViewModel connector8 = new ConnectorViewModel(sELGate.Output[0], out1.Input[0]);
|
||||
DiagramViewModel.DirectAddItemCommand.Execute(connector8);
|
||||
}
|
||||
|
||||
private void Items_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (e.OldItems != null)
|
||||
{
|
||||
foreach (var item in e.OldItems.OfType<TimerDesignerItemViewModel>())
|
||||
{
|
||||
item.Do -= Do;
|
||||
}
|
||||
}
|
||||
if (e.NewItems != null)
|
||||
{
|
||||
foreach (var item in e.NewItems.OfType<TimerDesignerItemViewModel>())
|
||||
{
|
||||
item.Do += Do;
|
||||
}
|
||||
}
|
||||
|
||||
RaisePropertyChanged("Items");
|
||||
}
|
||||
|
||||
protected override bool AddVerify(SelectableDesignerItemViewModelBase arg)
|
||||
{
|
||||
if (base.AddVerify(arg) == false)
|
||||
return false;
|
||||
|
||||
if (arg is ConnectorViewModel connector)
|
||||
{
|
||||
if (connector.SinkConnectorInfo is FullyCreatedConnectorInfo fully)
|
||||
{
|
||||
if (DiagramViewModel.Items.OfType<ConnectorViewModel>().Any(p => p.SinkConnectorInfo == fully))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void Do()
|
||||
{
|
||||
foreach (var item in DiagramViewModel.Items.OfType<ConstantDesignerItemViewModel>())
|
||||
{
|
||||
foreach (var output in item.Output)
|
||||
{
|
||||
output.Value.ConnectorValue = item.Value;
|
||||
output.Value.ColorViewModel.FillColor.Color = Colors.Green;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in DiagramViewModel.Items.OfType<InputItemViewModel>())
|
||||
{
|
||||
if (item.LinkPoint != null)
|
||||
{
|
||||
foreach (var output in item.Output)
|
||||
{
|
||||
output.Value.ConnectorValue = item.LinkPoint.Value;
|
||||
output.Value.ColorViewModel.FillColor.Color = Colors.Green;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in DiagramViewModel.Items.OfType<LogicalGateItemViewModelBase>().OrderBy(p => p.OrderNumber))
|
||||
{
|
||||
if (item.LogicalType != LogicalType.None)
|
||||
{
|
||||
foreach (var input in item.Input)
|
||||
{
|
||||
var connector = GetSourceItem(input.Value);
|
||||
if (connector == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (connector.SourceConnectorInfo.DataItem is LogicalGateItemViewModelBase)
|
||||
{
|
||||
input.Value.ConnectorValue = connector.SourceConnectorInfo.ConnectorValue;
|
||||
|
||||
input.Value.ColorViewModel.FillColor.Color = connector.SourceConnectorInfo.ColorViewModel.FillColor.Color;
|
||||
connector.ColorViewModel.LineColor.Color = connector.SourceConnectorInfo.ColorViewModel.FillColor.Color;
|
||||
|
||||
if (item.LogicalType == LogicalType.Output)
|
||||
{
|
||||
input.Value.ValueTypePoint = connector.SourceConnectorInfo.ValueTypePoint;
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.NOT)
|
||||
{
|
||||
input.Value.ValueTypePoint = (connector.SourceConnectorInfo.ValueTypePoint == ValueTypePoint.Bool) ? ValueTypePoint.Bool : ValueTypePoint.Int;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var output in item.Output)
|
||||
{
|
||||
if (item.LogicalType == LogicalType.Output)
|
||||
{
|
||||
var first = item.Input.Values.FirstOrDefault();
|
||||
output.Value.ConnectorValue = first.ConnectorValue;
|
||||
output.Value.ValueTypePoint = first.ValueTypePoint;
|
||||
(item as OutputItemViewModel).Value = first.ConnectorValue;
|
||||
(item as OutputItemViewModel).LinkPoint.Value = first.ConnectorValue;
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.ADD)
|
||||
{
|
||||
output.Value.ConnectorValue = item.Input.Values.Select(p => p.ConnectorValue).Sum();
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.SUB)
|
||||
{
|
||||
var first = item.Input.Values.Select(p => p.ConnectorValue).FirstOrDefault();
|
||||
var second = item.Input.Values.Where((value, index) => index != 0).Select(p => p.ConnectorValue).Sum();
|
||||
output.Value.ConnectorValue = first - second;
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.MUL)
|
||||
{
|
||||
double result = 0;
|
||||
foreach (var input in item.Input.Values)
|
||||
{
|
||||
if (result == 0)
|
||||
{
|
||||
result = 1;
|
||||
}
|
||||
result *= input.ConnectorValue;
|
||||
}
|
||||
output.Value.ConnectorValue = result;
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.DIV)
|
||||
{
|
||||
double result = item.Input.Values.Select(p => p.ConnectorValue).FirstOrDefault();
|
||||
foreach (var input in item.Input.Values.Where((value, index) => index != 0))
|
||||
{
|
||||
result /= input.ConnectorValue;
|
||||
}
|
||||
output.Value.ConnectorValue = result;
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.AVE)
|
||||
{
|
||||
output.Value.ConnectorValue = item.Input.Values.Select(p => p.ConnectorValue).Average();
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.MOD)
|
||||
{
|
||||
output.Value.ConnectorValue = item.Input[0].ConnectorValue % item.Input[1].ConnectorValue;
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.AND)
|
||||
{
|
||||
output.Value.ConnectorValue = Convert.ToInt32(item.Input[0].ConnectorValue) & Convert.ToInt32(item.Input[1].ConnectorValue);
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.OR)
|
||||
{
|
||||
output.Value.ConnectorValue = Convert.ToInt32(item.Input[0].ConnectorValue) | Convert.ToInt32(item.Input[1].ConnectorValue);
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.XOR)
|
||||
{
|
||||
output.Value.ConnectorValue = Convert.ToInt32(Convert.ToInt32(item.Input[0].ConnectorValue) ^ Convert.ToInt32(item.Input[1].ConnectorValue));
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.NOT)
|
||||
{
|
||||
if (item.Input[0].ValueTypePoint == ValueTypePoint.Bool)
|
||||
{
|
||||
output.Value.ConnectorValue = Convert.ToInt32(!Convert.ToBoolean(item.Input[0].ConnectorValue));
|
||||
output.Value.ValueTypePoint = ValueTypePoint.Bool;
|
||||
}
|
||||
else
|
||||
{
|
||||
output.Value.ConnectorValue = ~Convert.ToInt32(item.Input[0].ConnectorValue);
|
||||
output.Value.ValueTypePoint = ValueTypePoint.Int;
|
||||
}
|
||||
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.SHL)
|
||||
{
|
||||
output.Value.ConnectorValue = Convert.ToInt32(item.Input[0].ConnectorValue) << Convert.ToInt32(item.Input[1].ConnectorValue);
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.SHR)
|
||||
{
|
||||
output.Value.ConnectorValue = Convert.ToInt32(item.Input[0].ConnectorValue) >> Convert.ToInt32(item.Input[1].ConnectorValue);
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.ROL)
|
||||
{
|
||||
output.Value.ConnectorValue = (Convert.ToInt32(item.Input[0].ConnectorValue) << Convert.ToInt32(item.Input[1].ConnectorValue)) | (Convert.ToInt32(item.Input[0].ConnectorValue) >> 32 - Convert.ToInt32(item.Input[1].ConnectorValue));
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.ROR)
|
||||
{
|
||||
output.Value.ConnectorValue = (Convert.ToInt32(item.Input[0].ConnectorValue) >> Convert.ToInt32(item.Input[1].ConnectorValue)) | (Convert.ToInt32(item.Input[0].ConnectorValue) << 32 - Convert.ToInt32(item.Input[1].ConnectorValue));
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.SEL)
|
||||
{
|
||||
output.Value.ConnectorValue = (item.Input[0].ConnectorValue == output.Key) ? item.Input[1].ConnectorValue : item.Input[2].ConnectorValue;
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.MAX)
|
||||
{
|
||||
output.Value.ConnectorValue = item.Input.Values.Select(p => p.ConnectorValue).Max();
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.MIN)
|
||||
{
|
||||
output.Value.ConnectorValue = item.Input.Values.Select(p => p.ConnectorValue).Min();
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.LIMIT)
|
||||
{
|
||||
output.Value.ConnectorValue = (item.Input[0].ConnectorValue > item.Input[1].ConnectorValue) ? item.Input[1].ConnectorValue : item.Input[0].ConnectorValue;
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.GT)
|
||||
{
|
||||
output.Value.ConnectorValue = (item.Input[0].ConnectorValue > item.Input[1].ConnectorValue) ? 1 : 0;
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.LT)
|
||||
{
|
||||
output.Value.ConnectorValue = (item.Input[0].ConnectorValue < item.Input[1].ConnectorValue) ? 1 : 0;
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.GE)
|
||||
{
|
||||
output.Value.ConnectorValue = (item.Input[0].ConnectorValue >= item.Input[1].ConnectorValue) ? 1 : 0;
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.LE)
|
||||
{
|
||||
output.Value.ConnectorValue = (item.Input[0].ConnectorValue <= item.Input[1].ConnectorValue) ? 1 : 0;
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.EQ)
|
||||
{
|
||||
output.Value.ConnectorValue = (item.Input[0].ConnectorValue == item.Input[1].ConnectorValue) ? 1 : 0;
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.NE)
|
||||
{
|
||||
output.Value.ConnectorValue = (item.Input[0].ConnectorValue != item.Input[1].ConnectorValue) ? 1 : 0;
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.ABS)
|
||||
{
|
||||
output.Value.ConnectorValue = Math.Abs(item.Input[0].ConnectorValue);
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.SQRT)
|
||||
{
|
||||
output.Value.ConnectorValue = Math.Sqrt(item.Input[0].ConnectorValue);
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.LN)
|
||||
{
|
||||
output.Value.ConnectorValue = Math.Log10(item.Input[0].ConnectorValue);
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.LOG)
|
||||
{
|
||||
output.Value.ConnectorValue = Math.Log(item.Input[0].ConnectorValue);
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.EXP)
|
||||
{
|
||||
output.Value.ConnectorValue = Math.Exp(item.Input[0].ConnectorValue);
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.SIN)
|
||||
{
|
||||
output.Value.ConnectorValue = Math.Sin(item.Input[0].ConnectorValue);
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.COS)
|
||||
{
|
||||
output.Value.ConnectorValue = Math.Cos(item.Input[0].ConnectorValue);
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.TAN)
|
||||
{
|
||||
output.Value.ConnectorValue = Math.Tan(item.Input[0].ConnectorValue);
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.ASIN)
|
||||
{
|
||||
output.Value.ConnectorValue = Math.Asin(item.Input[0].ConnectorValue);
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.ACOS)
|
||||
{
|
||||
output.Value.ConnectorValue = Math.Acos(item.Input[0].ConnectorValue);
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.ATAN)
|
||||
{
|
||||
output.Value.ConnectorValue = Math.Atan(item.Input[0].ConnectorValue);
|
||||
}
|
||||
else if (item.LogicalType == LogicalType.EXPT)
|
||||
{
|
||||
output.Value.ConnectorValue = Math.Exp(item.Input[0].ConnectorValue);
|
||||
}
|
||||
|
||||
if (output.Value.ValueTypePoint == ValueTypePoint.Bool)
|
||||
{
|
||||
if (output.Value.ConnectorValue == 0)
|
||||
{
|
||||
output.Value.ColorViewModel.FillColor.Color = Colors.Red;
|
||||
if (item.LogicalType == LogicalType.Output)
|
||||
{
|
||||
item.ColorViewModel.FillColor.Color = Colors.Red;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
output.Value.ColorViewModel.FillColor.Color = Colors.Green;
|
||||
if (item.LogicalType == LogicalType.Output)
|
||||
{
|
||||
item.ColorViewModel.FillColor.Color = Colors.Green;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
output.Value.ColorViewModel.FillColor.Color = Colors.Green;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ConnectorViewModel GetSourceItem(FullyCreatedConnectorInfo sinkConnector)
|
||||
{
|
||||
foreach (var connector in DiagramViewModel.Items.OfType<ConnectorViewModel>())
|
||||
{
|
||||
if (connector.SinkConnectorInfo == sinkConnector)
|
||||
{
|
||||
return connector;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,745 +0,0 @@
|
||||
using AIStudio.Wpf.ADiagram.Services;
|
||||
using Util.DiagramDesigner;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Logical
|
||||
{
|
||||
public class LogicalGateItemViewModel : LogicalGateItemViewModelBase
|
||||
{
|
||||
protected IUIVisualizerService visualiserService;
|
||||
public LogicalGateItemViewModel(LogicalType logicalType) : base(logicalType)
|
||||
{
|
||||
ColorViewModel.FillColor.Color = Colors.Orange;
|
||||
}
|
||||
|
||||
public LogicalGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
visualiserService = ApplicationServicesProvider.Instance.Provider.VisualizerService;
|
||||
}
|
||||
|
||||
protected override void LoadDesignerItemViewModel(IDiagramViewModel parent, SelectableDesignerItemBase designerbase)
|
||||
{
|
||||
base.LoadDesignerItemViewModel(parent, designerbase);
|
||||
|
||||
LogicalGateDesignerItemBase designer = designerbase as LogicalGateDesignerItemBase;
|
||||
this.Value = designer.Value;
|
||||
}
|
||||
|
||||
|
||||
protected override void ExecuteEditCommand(object parameter)
|
||||
{
|
||||
if (LogicalType == LogicalType.Constant)
|
||||
{
|
||||
ValueDesignerItemData data = new ValueDesignerItemData(Value);
|
||||
if (visualiserService.ShowDialog(data) == true)
|
||||
{
|
||||
this.Value = data.Value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogicalGateItemData data = new LogicalGateItemData(Input.Values);
|
||||
if (visualiserService.ShowDialog(data) == true)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class AddGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public AddGateItemViewModel() : base(LogicalType.ADD)
|
||||
{
|
||||
}
|
||||
|
||||
public AddGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class SubtractGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public SubtractGateItemViewModel() : base(LogicalType.SUB)
|
||||
{
|
||||
}
|
||||
|
||||
public SubtractGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class MultiplyGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public MultiplyGateItemViewModel() : base(LogicalType.MUL)
|
||||
{
|
||||
}
|
||||
|
||||
public MultiplyGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class DivideGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
|
||||
public DivideGateItemViewModel() : base(LogicalType.DIV)
|
||||
{
|
||||
}
|
||||
|
||||
public DivideGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class AverageGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public AverageGateItemViewModel() : base(LogicalType.AVE)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public AverageGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class MODGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public MODGateItemViewModel() : base(LogicalType.MOD)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public MODGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class ANDGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public ANDGateItemViewModel() : base(LogicalType.AND)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ANDGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class ORGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public ORGateItemViewModel() : base(LogicalType.OR)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ORGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class XORGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public XORGateItemViewModel() : base(LogicalType.XOR)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public XORGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class NOTGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public NOTGateItemViewModel() : base(LogicalType.NOT)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public NOTGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class SHLGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public SHLGateItemViewModel() : base(LogicalType.SHL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public SHLGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class SHRGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public SHRGateItemViewModel() : base(LogicalType.SHR)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public SHRGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class ROLGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public ROLGateItemViewModel() : base(LogicalType.ROL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ROLGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class RORGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public RORGateItemViewModel() : base(LogicalType.ROR)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public RORGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class SELGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public SELGateItemViewModel() : base(LogicalType.SEL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public SELGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class MAXGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public MAXGateItemViewModel() : base(LogicalType.MAX)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public MAXGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class MINGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public MINGateItemViewModel() : base(LogicalType.MIN)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public MINGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class LIMITGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public LIMITGateItemViewModel() : base(LogicalType.LIMIT)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public LIMITGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class GTGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public GTGateItemViewModel() : base(LogicalType.GT)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public GTGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class LTGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public LTGateItemViewModel() : base(LogicalType.GT)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public LTGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class GEGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public GEGateItemViewModel() : base(LogicalType.GE)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public GEGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class LEGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public LEGateItemViewModel() : base(LogicalType.LE)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public LEGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class EQGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public EQGateItemViewModel() : base(LogicalType.LE)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public EQGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class NEGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public NEGateItemViewModel() : base(LogicalType.NE)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public NEGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class ABSGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public ABSGateItemViewModel() : base(LogicalType.ABS)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ABSGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class SQRTGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public SQRTGateItemViewModel() : base(LogicalType.SQRT)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public SQRTGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class LNGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public LNGateItemViewModel() : base(LogicalType.LN)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public LNGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class LOGGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public LOGGateItemViewModel() : base(LogicalType.LOG)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public LOGGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class EXPGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public EXPGateItemViewModel() : base(LogicalType.EXP)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public EXPGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class SINGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public SINGateItemViewModel() : base(LogicalType.SIN)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public SINGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class COSGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public COSGateItemViewModel() : base(LogicalType.COS)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public COSGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class TANGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public TANGateItemViewModel() : base(LogicalType.TAN)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public TANGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class ASINGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public ASINGateItemViewModel() : base(LogicalType.ASIN)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ASINGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class ACOSGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public ACOSGateItemViewModel() : base(LogicalType.ACOS)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ACOSGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class ATANGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public ATANGateItemViewModel() : base(LogicalType.ATAN)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ATANGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class EXPTGateItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public EXPTGateItemViewModel() : base(LogicalType.EXPT)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public EXPTGateItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class ConstantDesignerItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public ConstantDesignerItemViewModel() : base(LogicalType.Constant)
|
||||
{
|
||||
ItemHeight = 28;
|
||||
}
|
||||
|
||||
public ConstantDesignerItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class InputItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public InputItemViewModel() : base(LogicalType.Input)
|
||||
{
|
||||
ItemHeight = 28;
|
||||
}
|
||||
|
||||
public InputItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void LoadDesignerItemViewModel(IDiagramViewModel parent, SelectableDesignerItemBase designerbase)
|
||||
{
|
||||
base.LoadDesignerItemViewModel(parent, designerbase);
|
||||
|
||||
LogicalGateDesignerItemBase designer = designerbase as LogicalGateDesignerItemBase;
|
||||
this.Value = designer.Value;
|
||||
LinkPoint = LogicalService.LinkPoint.FirstOrDefault(p => p.Id.ToString() == designer.Icon); //不想新增字段了,就用这个Icon保存自定义测点的Id吧。
|
||||
if (LinkPoint != null)
|
||||
{
|
||||
LinkPoint.Value = designer.Value;
|
||||
}
|
||||
}
|
||||
|
||||
private LinkPoint _linkPoint;
|
||||
public LinkPoint LinkPoint
|
||||
{
|
||||
get { return _linkPoint; }
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _linkPoint, value))
|
||||
{
|
||||
Icon = _linkPoint?.Id.ToString();//不想新增字段了,就用这个Icon保存自定义测点的Id吧。
|
||||
Text = _linkPoint?.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ExecuteEditCommand(object parameter)
|
||||
{
|
||||
LinkPointDesignerItemData data = new LinkPointDesignerItemData(LinkPoint);
|
||||
if (visualiserService.ShowDialog(data) == true)
|
||||
{
|
||||
this.LinkPoint = data.LinkPoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class OutputItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
public OutputItemViewModel() : base(LogicalType.Output)
|
||||
{
|
||||
ItemHeight = 28;
|
||||
}
|
||||
|
||||
public OutputItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void LoadDesignerItemViewModel(IDiagramViewModel parent, SelectableDesignerItemBase designerbase)
|
||||
{
|
||||
base.LoadDesignerItemViewModel(parent, designerbase);
|
||||
|
||||
LogicalGateDesignerItemBase designer = designerbase as LogicalGateDesignerItemBase;
|
||||
this.Value = designer.Value;
|
||||
LinkPoint = LogicalService.LinkPoint.FirstOrDefault(p => p.Id.ToString() == designer.Icon); //不想新增字段了,就用这个Icon保存自定义测点的Id吧。
|
||||
if (LinkPoint != null)
|
||||
{
|
||||
LinkPoint.Value = designer.Value;
|
||||
}
|
||||
}
|
||||
|
||||
private LinkPoint _linkPoint;
|
||||
public LinkPoint LinkPoint
|
||||
{
|
||||
get { return _linkPoint; }
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _linkPoint, value))
|
||||
{
|
||||
Icon = _linkPoint?.Id.ToString();//不想新增字段了,就用这个Icon保存自定义测点的Id吧。
|
||||
Text = _linkPoint?.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ExecuteEditCommand(object parameter)
|
||||
{
|
||||
LinkPointDesignerItemData data = new LinkPointDesignerItemData(LinkPoint);
|
||||
if (visualiserService.ShowDialog(data) == true)
|
||||
{
|
||||
this.LinkPoint = data.LinkPoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class TimerDesignerItemViewModel : LogicalGateItemViewModel
|
||||
{
|
||||
private System.Timers.Timer readDataTimer = new System.Timers.Timer();
|
||||
public Action Do;
|
||||
|
||||
public TimerDesignerItemViewModel() : base(LogicalType.Time)
|
||||
{
|
||||
ItemHeight = 32;
|
||||
ItemWidth = 32;
|
||||
Value = 1;
|
||||
Start();
|
||||
BuildMenuOptions();
|
||||
}
|
||||
|
||||
public TimerDesignerItemViewModel(IDiagramViewModel parent, LogicalGateDesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
BuildMenuOptions();
|
||||
}
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
MenuItemCommand = new SimpleCommand(ExecuteMenuItemCommand);
|
||||
base.Init();
|
||||
|
||||
readDataTimer.Elapsed += timeCycle;
|
||||
readDataTimer.Interval = 1000;
|
||||
}
|
||||
|
||||
protected override void LoadDesignerItemViewModel(IDiagramViewModel parent, SelectableDesignerItemBase designerbase)
|
||||
{
|
||||
base.LoadDesignerItemViewModel(parent, designerbase);
|
||||
|
||||
if (IsEnabled)
|
||||
{
|
||||
Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
IsEnabled = true;
|
||||
Output[0].ColorViewModel.FillColor.Color = Colors.Green;
|
||||
readDataTimer.Start();
|
||||
}
|
||||
|
||||
private void Stop()
|
||||
{
|
||||
IsEnabled = false;
|
||||
Output[0].ColorViewModel.FillColor.Color = Colors.Red;
|
||||
readDataTimer.Stop();
|
||||
}
|
||||
|
||||
private void ExecuteMenuItemCommand(object obj)
|
||||
{
|
||||
if ((obj as CinchMenuItem).IsChecked == true)
|
||||
{
|
||||
Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
}
|
||||
|
||||
public SimpleCommand MenuItemCommand { get; private set; }
|
||||
private void BuildMenuOptions()
|
||||
{
|
||||
menuOptions = new ObservableCollection<CinchMenuItem>();
|
||||
CinchMenuItem menuItem = new CinchMenuItem();
|
||||
menuItem.Text = "启动";
|
||||
menuItem.IsCheckable = true;
|
||||
menuItem.IsChecked = IsEnabled;
|
||||
menuItem.Command = MenuItemCommand;
|
||||
menuItem.CommandParameter = menuItem;
|
||||
menuOptions.Add(menuItem);
|
||||
}
|
||||
|
||||
protected override void ExecuteEditCommand(object parameter)
|
||||
{
|
||||
ValueDesignerItemData data = new ValueDesignerItemData(Value);
|
||||
if (visualiserService.ShowDialog(data) == true)
|
||||
{
|
||||
this.Value = data.Value;
|
||||
readDataTimer.Interval = this.Value * 1000;
|
||||
}
|
||||
}
|
||||
|
||||
private void timeCycle(object sender, EventArgs e)
|
||||
{
|
||||
Output.FirstOrDefault().Value.ConnectorValue += Value;
|
||||
if (Do != null)
|
||||
{
|
||||
Do();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
|
||||
readDataTimer.Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
using AIStudio.Wpf.ADiagram.Services;
|
||||
using Util.DiagramDesigner;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows;
|
||||
using System.Globalization;
|
||||
using ZXing;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Others
|
||||
{
|
||||
public class BarcodeDesignerItemViewModel : DesignerItemViewModelBase
|
||||
{
|
||||
private IUIVisualizerService visualiserService;
|
||||
|
||||
public BarcodeDesignerItemViewModel() : base()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public BarcodeDesignerItemViewModel(IDiagramViewModel parent, DesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
base.Init();
|
||||
visualiserService = ApplicationServicesProvider.Instance.Provider.VisualizerService;
|
||||
|
||||
}
|
||||
|
||||
protected override void LoadDesignerItemViewModel(IDiagramViewModel parent, SelectableDesignerItemBase designerbase)
|
||||
{
|
||||
base.LoadDesignerItemViewModel(parent, designerbase);
|
||||
|
||||
Format = (BarcodeFormat)Enum.Parse(typeof(BarcodeFormat), (designerbase as DesignerItemBase).Reserve.ToString());
|
||||
ShowText = false;
|
||||
}
|
||||
|
||||
public void AutoSize()
|
||||
{
|
||||
ItemWidth = 140;
|
||||
ItemHeight = 140;
|
||||
}
|
||||
|
||||
protected override void ExecuteEditCommand(object parameter)
|
||||
{
|
||||
EditData();
|
||||
}
|
||||
|
||||
public override bool InitData()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Icon))
|
||||
return EditData();
|
||||
return true;
|
||||
}
|
||||
|
||||
public BarcodeFormat Format { get; set; } = BarcodeFormat.QR_CODE;
|
||||
|
||||
public override bool EditData()
|
||||
{
|
||||
if (IsReadOnly == true) return false;
|
||||
|
||||
BarcodeDesignerItemData data = new BarcodeDesignerItemData(this);
|
||||
if (visualiserService.ShowDialog(data) == true)
|
||||
{
|
||||
bool needauto = Text == null;
|
||||
Text = data.Text;
|
||||
ShowText = false;
|
||||
Icon = data.Icon;
|
||||
Margin = data.Margin;
|
||||
if (needauto)
|
||||
{
|
||||
AutoSize();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using Util.DiagramDesigner;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Others
|
||||
{
|
||||
public class PathItemViewModel : DesignerItemViewModelBase
|
||||
{
|
||||
public PathItemViewModel() : base()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public PathItemViewModel(IDiagramViewModel parent, DesignerItemBase designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
this.ShowConnectors = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
using AIStudio.Wpf.ADiagram.Services;
|
||||
using Util.DiagramDesigner;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Others
|
||||
{
|
||||
public class PersistDesignerItemViewModel : DesignerItemViewModelBase
|
||||
{
|
||||
private IUIVisualizerService visualiserService;
|
||||
|
||||
public PersistDesignerItemViewModel(IDiagramViewModel parent, PersistDesignerItem designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public PersistDesignerItemViewModel() : base()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
visualiserService = ApplicationServicesProvider.Instance.Provider.VisualizerService;
|
||||
this.ShowConnectors = false;
|
||||
}
|
||||
|
||||
protected override void LoadDesignerItemViewModel(IDiagramViewModel parent, SelectableDesignerItemBase designerbase)
|
||||
{
|
||||
base.LoadDesignerItemViewModel(parent, designerbase);
|
||||
|
||||
PersistDesignerItem designer = designerbase as PersistDesignerItem;
|
||||
this.HostUrl = designer.HostUrl;
|
||||
}
|
||||
|
||||
|
||||
public string HostUrl { get; set; }
|
||||
|
||||
protected override void ExecuteEditCommand(object parameter)
|
||||
{
|
||||
PersistDesignerItemData data = new PersistDesignerItemData(HostUrl);
|
||||
if (visualiserService.ShowDialog(data) == true)
|
||||
{
|
||||
this.HostUrl = data.HostUrl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
using AIStudio.Wpf.ADiagram.Services;
|
||||
using Util.DiagramDesigner;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Others
|
||||
{
|
||||
public class SettingsDesignerItemViewModel : DesignerItemViewModelBase
|
||||
{
|
||||
private IUIVisualizerService visualiserService;
|
||||
|
||||
public SettingsDesignerItemViewModel(IDiagramViewModel parent, SettingsDesignerItem designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public SettingsDesignerItemViewModel() : base()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
visualiserService = ApplicationServicesProvider.Instance.Provider.VisualizerService;
|
||||
this.ShowConnectors = false;
|
||||
}
|
||||
|
||||
protected override void LoadDesignerItemViewModel(IDiagramViewModel parent, SelectableDesignerItemBase designerbase)
|
||||
{
|
||||
base.LoadDesignerItemViewModel(parent, designerbase);
|
||||
|
||||
SettingsDesignerItem designer = designerbase as SettingsDesignerItem;
|
||||
this.Setting = designer.Setting;
|
||||
}
|
||||
|
||||
public String Setting{ get; set; }
|
||||
|
||||
protected override void ExecuteEditCommand(object parameter)
|
||||
{
|
||||
SettingsDesignerItemData data = new SettingsDesignerItemData(Setting);
|
||||
if (visualiserService.ShowDialog(data) == true)
|
||||
{
|
||||
this.Setting = data.Setting1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Util.DiagramDesigner;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Demos.Others
|
||||
{
|
||||
public class SvgDesignerItemViewModel: MediaItemViewModel
|
||||
{
|
||||
protected override string Filter { get; set; } = "Svg|*.svg";
|
||||
|
||||
public SvgDesignerItemViewModel() : base()
|
||||
{
|
||||
}
|
||||
|
||||
public SvgDesignerItemViewModel(IDiagramViewModel parent, MediaDesignerItem designer) : base(parent, designer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,172 +0,0 @@
|
||||
{
|
||||
"Title": null,
|
||||
"DiagramType": 0,
|
||||
"DiagramItems": [
|
||||
{
|
||||
"Name": null,
|
||||
"DiagramType": 0,
|
||||
"DesignerItems": [
|
||||
],
|
||||
"PersistDesignerItems": [
|
||||
],
|
||||
"SettingsDesignerItems": [
|
||||
],
|
||||
"PathDesignerItems": [
|
||||
{
|
||||
"Left": 132.80000000000007,
|
||||
"Top": 101.26000022888184,
|
||||
"ScaleX": 1,
|
||||
"ScaleY": 1,
|
||||
"Margin": 0.0,
|
||||
"ItemWidth": 65.0,
|
||||
"ItemHeight": 65.0,
|
||||
"Icon": "M 0,0 H 60 V 40 C 30,30 30,50 0,40 Z",
|
||||
"ItemTypeName": "AIStudio.Wpf.ADiagram.Demos.Others.PathItemViewModel",
|
||||
"Id": "da395032-ad9e-4dab-a035-f59bed5cb4c4",
|
||||
"ZIndex": 0,
|
||||
"IsGroup": false,
|
||||
"ParentId": "00000000-0000-0000-0000-000000000000",
|
||||
"Text": "欢迎来到AIStudio画板",
|
||||
"ColorItem": {
|
||||
"LineColor": {
|
||||
"BrushType": 1,
|
||||
"Color": "#FF808080",
|
||||
"GradientStop": null,
|
||||
"Offset": null,
|
||||
"Image": null,
|
||||
"SubType": 0,
|
||||
"StartPoint": "0,0",
|
||||
"EndPoint": "0,0",
|
||||
"Opacity": 1.0,
|
||||
"LinearOrientation": 0,
|
||||
"RadialOrientation": 0,
|
||||
"Angle": 0
|
||||
},
|
||||
"FillColor": {
|
||||
"BrushType": 1,
|
||||
"Color": "#FFFFA500",
|
||||
"GradientStop": null,
|
||||
"Offset": null,
|
||||
"Image": null,
|
||||
"SubType": 0,
|
||||
"StartPoint": "0,0",
|
||||
"EndPoint": "0,0",
|
||||
"Opacity": 1.0,
|
||||
"LinearOrientation": 0,
|
||||
"RadialOrientation": 0,
|
||||
"Angle": 0
|
||||
},
|
||||
"ShadowColor": "#00FFFFFF",
|
||||
"LineWidth": 1.0,
|
||||
"LeftArrowPathStyle": 0,
|
||||
"RightArrowPathStyle": 1,
|
||||
"LeftArrowSizeStyle": 10,
|
||||
"RightArrowSizeStyle": 10
|
||||
},
|
||||
"FontItem": {
|
||||
"FontWeight": "Normal",
|
||||
"FontStyle": "Normal",
|
||||
"FontStretch": "Normal",
|
||||
"Underline": false,
|
||||
"Strikethrough": false,
|
||||
"OverLine": false,
|
||||
"FontColor": "#FF000000",
|
||||
"FontFamily": "Arial",
|
||||
"FontSize": 11.0,
|
||||
"FontObject": "Arial, 11pt",
|
||||
"TextEffectColor": "#00FFFFFF",
|
||||
"HighlightColor": "#00FFFFFF",
|
||||
"FontCase": 0,
|
||||
"HorizontalAlignment": 1,
|
||||
"VerticalAlignment": 1,
|
||||
"LineHeight": 0.0
|
||||
}
|
||||
}
|
||||
],
|
||||
"MediaDesignerItems": [
|
||||
],
|
||||
"ImageDesignerItems": [
|
||||
],
|
||||
"TextDesignerItems": [
|
||||
],
|
||||
"LogicalGateItems": [
|
||||
],
|
||||
"FlowNodeDesignerItems": [
|
||||
],
|
||||
"AllDesignerItems": [
|
||||
{
|
||||
"Left": 132.80000000000007,
|
||||
"Top": 101.26000022888184,
|
||||
"Margin": 0.0,
|
||||
"ItemWidth": 65.0,
|
||||
"ItemHeight": 65.0,
|
||||
"Icon": "M 0,0 H 60 V 40 C 30,30 30,50 0,40 Z",
|
||||
"ItemTypeName": "AIStudio.Wpf.ADiagram.Demos.Others.PathItemViewModel",
|
||||
"Id": "da395032-ad9e-4dab-a035-f59bed5cb4c4",
|
||||
"ZIndex": 0,
|
||||
"IsGroup": false,
|
||||
"ParentId": "00000000-0000-0000-0000-000000000000",
|
||||
"Text": "欢迎来到AIStudio画板",
|
||||
"ColorItem": {
|
||||
"LineColor": {
|
||||
"BrushType": 1,
|
||||
"Color": "#FF808080",
|
||||
"GradientStop": null,
|
||||
"Offset": null,
|
||||
"Image": null,
|
||||
"SubType": 0,
|
||||
"StartPoint": "0,0",
|
||||
"EndPoint": "0,0",
|
||||
"Opacity": 1.0,
|
||||
"LinearOrientation": 0,
|
||||
"RadialOrientation": 0,
|
||||
"Angle": 0
|
||||
},
|
||||
"FillColor": {
|
||||
"BrushType": 1,
|
||||
"Color": "#FFFFA500",
|
||||
"GradientStop": null,
|
||||
"Offset": null,
|
||||
"Image": null,
|
||||
"SubType": 0,
|
||||
"StartPoint": "0,0",
|
||||
"EndPoint": "0,0",
|
||||
"Opacity": 1.0,
|
||||
"LinearOrientation": 0,
|
||||
"RadialOrientation": 0,
|
||||
"Angle": 0
|
||||
},
|
||||
"ShadowColor": "#00FFFFFF",
|
||||
"LineWidth": 1.0,
|
||||
"LeftArrowPathStyle": 0,
|
||||
"RightArrowPathStyle": 1,
|
||||
"LeftArrowSizeStyle": 10,
|
||||
"RightArrowSizeStyle": 10
|
||||
},
|
||||
"FontItem": {
|
||||
"FontWeight": "Normal",
|
||||
"FontStyle": "Normal",
|
||||
"FontStretch": "Normal",
|
||||
"Underline": false,
|
||||
"Strikethrough": false,
|
||||
"OverLine": false,
|
||||
"FontColor": "#FF000000",
|
||||
"FontFamily": "Arial",
|
||||
"FontSize": 11.0,
|
||||
"FontObject": "Arial, 11pt",
|
||||
"TextEffectColor": "#00FFFFFF",
|
||||
"HighlightColor": "#00FFFFFF",
|
||||
"FontCase": 0,
|
||||
"HorizontalAlignment": 1,
|
||||
"VerticalAlignment": 1,
|
||||
"LineHeight": 0.0
|
||||
}
|
||||
}
|
||||
],
|
||||
"ConnectionIds": [
|
||||
],
|
||||
"Connections": [
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,198 +0,0 @@
|
||||
using Util.DiagramDesigner;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using AIStudio.Wpf.ADiagram.Demos.Flowchart;
|
||||
using AIStudio.Wpf.ADiagram.Demos.Others;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class DiagramItem
|
||||
{
|
||||
public DiagramItem()
|
||||
{
|
||||
this.ConnectionIds = new List<Guid>();
|
||||
this.Connections = new List<ConnectionItem>();
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public string Name { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public DiagramType DiagramType { get; set; }
|
||||
|
||||
[XmlArray]
|
||||
public List<DesignerItemBase> DesignerItems { get; set; } = new List<DesignerItemBase>();
|
||||
|
||||
[XmlArray]
|
||||
public List<PersistDesignerItem> PersistDesignerItems { get; set; } = new List<PersistDesignerItem>();
|
||||
|
||||
[XmlArray]
|
||||
public List<SettingsDesignerItem> SettingsDesignerItems { get; set; } = new List<SettingsDesignerItem>();
|
||||
|
||||
[XmlArray]
|
||||
public List<PathDesignerItem> PathDesignerItems { get; set; } = new List<PathDesignerItem>();
|
||||
|
||||
[XmlArray]
|
||||
public List<MediaDesignerItem> MediaDesignerItems { get; set; } = new List<MediaDesignerItem>();
|
||||
|
||||
[XmlArray]
|
||||
public List<ImageDesignerItem> ImageDesignerItems { get; set; } = new List<ImageDesignerItem>();
|
||||
|
||||
[XmlArray]
|
||||
public List<TextDesignerItem> TextDesignerItems { get; set; } = new List<TextDesignerItem>();
|
||||
|
||||
[XmlArray]
|
||||
public List<LogicalGateDesignerItemBase> LogicalGateItems { get; set; } = new List<LogicalGateDesignerItemBase>();
|
||||
|
||||
[XmlArray]
|
||||
public List<FlowNodeDesignerItem> FlowNodeDesignerItems { get; set; } = new List<FlowNodeDesignerItem>();
|
||||
|
||||
[JsonIgnore]
|
||||
[XmlIgnore]
|
||||
public List<DesignerItemBase> AllDesignerItems { get { return
|
||||
DesignerItems.OfType<DesignerItemBase>()
|
||||
.Union(TextDesignerItems.OfType<DesignerItemBase>())
|
||||
.Union(LogicalGateItems.OfType<DesignerItemBase>())
|
||||
.Union(MediaDesignerItems.OfType<DesignerItemBase>())
|
||||
.Union(ImageDesignerItems.OfType<DesignerItemBase>())
|
||||
.Union(PathDesignerItems.OfType<DesignerItemBase>())
|
||||
.Union(PersistDesignerItems.OfType<DesignerItemBase>())
|
||||
.Union(SettingsDesignerItems.OfType<DesignerItemBase>())
|
||||
.Union(FlowNodeDesignerItems.OfType<FlowNodeDesignerItem>())
|
||||
.ToList(); } }
|
||||
|
||||
[XmlArray]
|
||||
public List<Guid> ConnectionIds { get; set; }
|
||||
|
||||
[XmlArray]
|
||||
public List<ConnectionItem> Connections { get; set; }
|
||||
|
||||
public void AddItems(IEnumerable<SelectableDesignerItemViewModelBase> selectedDesignerItems)
|
||||
{
|
||||
foreach (var item in selectedDesignerItems.OfType<DesignerItemViewModelBase>())
|
||||
{
|
||||
if (item is PersistDesignerItemViewModel)
|
||||
{
|
||||
PersistDesignerItems.Add(new PersistDesignerItem(item as PersistDesignerItemViewModel));
|
||||
}
|
||||
else if (item is SettingsDesignerItemViewModel)
|
||||
{
|
||||
SettingsDesignerItems.Add(new SettingsDesignerItem(item as SettingsDesignerItemViewModel));
|
||||
}
|
||||
else if (item is PathItemViewModel)
|
||||
{
|
||||
PathDesignerItems.Add(new PathDesignerItem(item));
|
||||
}
|
||||
else if (item is GifImageItemViewModel)
|
||||
{
|
||||
MediaDesignerItems.Add(new MediaDesignerItem(item as GifImageItemViewModel));
|
||||
}
|
||||
else if (item is MediaItemViewModel)
|
||||
{
|
||||
MediaDesignerItems.Add(new MediaDesignerItem(item as MediaItemViewModel));
|
||||
}
|
||||
else if (item is ImageItemViewModel)
|
||||
{
|
||||
ImageDesignerItems.Add(new ImageDesignerItem(item as ImageItemViewModel));
|
||||
}
|
||||
else if (item is TextDesignerItemViewModel)
|
||||
{
|
||||
TextDesignerItems.Add(new TextDesignerItem(item as TextDesignerItemViewModel));
|
||||
}
|
||||
else if (item is LogicalGateItemViewModelBase)
|
||||
{
|
||||
LogicalGateItems.Add(new LogicalGateDesignerItemBase(item as LogicalGateItemViewModelBase));
|
||||
}
|
||||
else if (item is FlowNode)
|
||||
{
|
||||
FlowNodeDesignerItems.Add(new FlowNodeDesignerItem(item as FlowNode));
|
||||
}
|
||||
else if (item is BarcodeDesignerItemViewModel)
|
||||
{
|
||||
DesignerItems.Add(new DesignerItemBase(item, (item as BarcodeDesignerItemViewModel).Format.ToString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
DesignerItems.Add(new DesignerItemBase(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static DesignerItemBase ToXmlObject(SelectableDesignerItemViewModelBase item)
|
||||
{
|
||||
if (item is PersistDesignerItemViewModel)
|
||||
{
|
||||
return new PersistDesignerItem(item as PersistDesignerItemViewModel);
|
||||
}
|
||||
else if (item is SettingsDesignerItemViewModel)
|
||||
{
|
||||
return new SettingsDesignerItem(item as SettingsDesignerItemViewModel);
|
||||
}
|
||||
else if (item is PathItemViewModel)
|
||||
{
|
||||
return new PathDesignerItem(item as PathItemViewModel);
|
||||
}
|
||||
else if (item is GifImageItemViewModel)
|
||||
{
|
||||
return new MediaDesignerItem(item as GifImageItemViewModel);
|
||||
}
|
||||
else if (item is MediaItemViewModel)
|
||||
{
|
||||
return new MediaDesignerItem(item as MediaItemViewModel);
|
||||
}
|
||||
else if (item is ImageItemViewModel)
|
||||
{
|
||||
return new ImageDesignerItem(item as ImageItemViewModel);
|
||||
}
|
||||
else if (item is TextDesignerItemViewModel)
|
||||
{
|
||||
return new TextDesignerItem(item as TextDesignerItemViewModel);
|
||||
}
|
||||
else if (item is LogicalGateItemViewModelBase)
|
||||
{
|
||||
return new LogicalGateDesignerItemBase(item as LogicalGateItemViewModelBase);
|
||||
}
|
||||
else if (item is FlowNode)
|
||||
{
|
||||
return new FlowNodeDesignerItem(item as FlowNode);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new DesignerItemBase(item as DesignerItemViewModelBase);
|
||||
}
|
||||
}
|
||||
|
||||
public static Type GetTypeOfDiagramItem(DesignerItemViewModelBase vmType)
|
||||
{
|
||||
if (vmType is PersistDesignerItemViewModel)
|
||||
return typeof(PersistDesignerItem);
|
||||
if (vmType is SettingsDesignerItemViewModel)
|
||||
return typeof(SettingsDesignerItem);
|
||||
if (vmType is PathItemViewModel)
|
||||
return typeof(PathToolBoxData);
|
||||
if (vmType is GifImageItemViewModel)
|
||||
return typeof(MediaDesignerItem);
|
||||
if (vmType is MediaItemViewModel)
|
||||
return typeof(MediaDesignerItem);
|
||||
if (vmType is ImageItemViewModel)
|
||||
return typeof(ImageDesignerItem);
|
||||
if (vmType is LogicalGateItemViewModelBase)
|
||||
return typeof(LogicalGateDesignerItemBase);
|
||||
if (vmType is FlowNode)
|
||||
return typeof(FlowNodeDesignerItem);
|
||||
throw new InvalidOperationException(string.Format("Unknown diagram type. Currently only {0} and {1} are supported",
|
||||
typeof(PersistDesignerItem).AssemblyQualifiedName,
|
||||
typeof(SettingsDesignerItemViewModel).AssemblyQualifiedName
|
||||
));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
using Util.DiagramDesigner.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Shapes;
|
||||
using Util.DiagramDesigner;
|
||||
using AIStudio.Wpf.ADiagram.Demos.Flowchart;
|
||||
using AIStudio.Wpf.ADiagram.Helpers;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Models
|
||||
{
|
||||
public class PathToolBoxData : ToolBoxData
|
||||
{
|
||||
public PathToolBoxData(string icon, Type type, double width = 32, double height = 32) : base(null, icon, type, width, height)
|
||||
{
|
||||
ColorViewModel.FillColor.Color = Colors.Orange;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class TextToolBoxData : ToolBoxData
|
||||
{
|
||||
public TextToolBoxData(string text, Type type, double width = 32, double height = 32) : base(text, null, type, width, height)
|
||||
{
|
||||
ColorViewModel.FillColor.Color = Colors.Orange;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class EllipseTextToolBoxData : ToolBoxData
|
||||
{
|
||||
public EllipseTextToolBoxData(string text, Type type, double width = 32, double height = 32) : base(text, null, type, width, height)
|
||||
{
|
||||
ColorViewModel.FillColor.Color = Colors.Orange;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class ImageToolBoxData : ToolBoxData
|
||||
{
|
||||
public ImageToolBoxData(string icon, Type type, double width = 32, double height = 32) : base(null, icon, type, width, height)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class FlowchartToolBoxData : ToolBoxData
|
||||
{
|
||||
public NodeKinds Kind { get; set; }
|
||||
public FlowchartToolBoxData(NodeKinds kind, Type type, double width = 32, double height = 32) : base(kind.GetDescription(), null, type, width, height)
|
||||
{
|
||||
Kind = kind;
|
||||
ColorViewModel.LineColor.Color = Colors.Black;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class DesignerItemToolBoxData : ToolBoxData
|
||||
{
|
||||
public string FileName { get; set; }
|
||||
public DesignerItemViewModelBase DesignerItemViewModel { get; set; }
|
||||
public DesignerItemToolBoxData(DesignerItemBase designerItemBase, string filename, Type type, double width = 32, double height = 32) : base(null, null, type, width, height)
|
||||
{
|
||||
Addition = designerItemBase;
|
||||
DesignerItemViewModel = (DesignerItemViewModelBase)Activator.CreateInstance(type, null, designerItemBase);
|
||||
FileName = filename;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class SvgToolBoxData : ToolBoxData
|
||||
{
|
||||
public SvgToolBoxData(string filename, Type type, double width = 32, double height = 32) : base(null, filename, type, width, height)
|
||||
{
|
||||
ColorViewModel.FillColor.Color = Colors.Blue;
|
||||
}
|
||||
}
|
||||
|
||||
public class MediaToolBoxData : ToolBoxData
|
||||
{
|
||||
public MediaToolBoxData(string icon, Type type, double width = 32, double height = 32) : base(icon, null, type, width, height)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
using AIStudio.Wpf.ADiagram.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace AIStudio.Wpf.ADiagram.Services
|
||||
{
|
||||
public class WPFUIVisualizerService : IUIVisualizerService
|
||||
{
|
||||
|
||||
#region Public Methods
|
||||
/// <summary>
|
||||
/// This method displays a modal dialog associated with the given key.
|
||||
/// </summary>
|
||||
/// <param name="dataContextForPopup">Object state to associate with the dialog</param>
|
||||
/// <returns>True/False if UI is displayed.</returns>
|
||||
public bool? ShowDialog(object dataContextForPopup)
|
||||
{
|
||||
Window win = new PopupWindow();
|
||||
win.DataContext = dataContextForPopup;
|
||||
win.Owner = Application.Current.MainWindow;
|
||||
if (win != null)
|
||||
return win.ShowDialog();
|
||||
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<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:,,,/Util.DiagramDesigner;component/Resources/Styles/ScrollBar.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/Util.DiagramDesigner;component/Resources/Styles/Expander.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/Util.DiagramDesigner;component/Resources/Styles/GroupBox.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/Util.DiagramDesigner;component/Resources/Styles/ToolTip.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/Util.DiagramDesigner;component/Resources/Styles/ScrollViewer.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/Util.DiagramDesigner;component/Resources/Styles/ZoomBox.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/Util.DiagramDesigner;component/Resources/Styles/DesignerItems.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Themes/Styles/Fluent.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Themes/Styles/Expander.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Themes/Styles/ListBox.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Themes/Styles/Slider.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Themes/Styles/TabControl.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Themes/Styles/ToggleButton.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Demos/Flowchart/ViewModels/FlowNode.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Demos/Logical/ViewModels/LogicalGateItemViewModel.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Demos/Others/ViewModels/BarcodeDesignerItemViewModel.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Demos/Others/ViewModels/OutLineTextDesignerItemViewModel.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Demos/Others/ViewModels/PathItemViewModel.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Demos/Others/ViewModels/PersistDesignerItemViewModel.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Demos/Others/ViewModels/SettingsDesignerItemViewModel.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.ADiagram;component/Demos/Others/ViewModels/SvgDesignerItemViewModel.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -1,11 +1,41 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29509.3
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.4.33205.214
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Util.DiagramDesigner", "Util.DiagramDesigner\Util.DiagramDesigner.csproj", "{3FC9F09D-83EA-4914-8980-A6B4C3352836}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AIStudio.Wpf.Flowchart", "Extensions\AIStudio.Wpf.Flowchart\AIStudio.Wpf.Flowchart.csproj", "{86ED5B40-D185-4AFA-B5BD-BC8E78DB8758}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AIStudio.Wpf.ADiagram", "AIStudio.Wpf.ADiagram\AIStudio.Wpf.ADiagram.csproj", "{9D2DCA7D-9E0C-4E6E-ACD9-2CD18C75FE34}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AIStudio.Wpf.Logical", "Extensions\AIStudio.Wpf.Logical\AIStudio.Wpf.Logical.csproj", "{CC68D39D-7935-4079-9CEB-FC2FD498D511}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions", "Extensions", "{4959F170-02FB-4B7F-8F53-93DAF22713F9}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AIStudio.Wpf.SFC", "Extensions\AIStudio.Wpf.SFC\AIStudio.Wpf.SFC.csproj", "{2AB69067-277E-4EE0-9949-8326A145EEE4}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AIStudio.Wpf.DiagramApp", "AIStudio.Wpf.DiagramApp\AIStudio.Wpf.DiagramApp.csproj", "{4408F718-9C14-4404-A63B-9B785F9D4F35}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AIStudio.Wpf.DiagramDesigner", "AIStudio.Wpf.DiagramDesigner\AIStudio.Wpf.DiagramDesigner.csproj", "{EA1D893D-2F50-47AA-80A6-EA297F651CCC}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "解决方案项", "解决方案项", "{425E7DBD-25B9-4019-9C84-C37273A7F5C3}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.editorconfig = .editorconfig
|
||||
Directory.Build.Props = Directory.Build.Props
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2BE1891E-16C9-4191-998A-45AEEEEA1F0D}"
|
||||
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("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AIStudio.Wpf.Mind", "Extensions\AIStudio.Wpf.Mind\AIStudio.Wpf.Mind.csproj", "{85C437B9-16D2-4076-ABCD-52029AC232FC}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AIStudio.Wpf.DiagramDesigner.Serializable", "AIStudio.Wpf.DiagramDesigner.Serializable\AIStudio.Wpf.DiagramDesigner.Serializable.csproj", "{439D0631-D9C2-4D36-BFCE-80DFCCABE9E7}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Demos", "Demos", "{62DC8608-D98F-47BB-9F19-ABB0C60B72FF}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AIStudio.Wpf.DiagramDesigner.Demo", "Demos\AIStudio.Wpf.DiagramDesigner.Demo\AIStudio.Wpf.DiagramDesigner.Demo.csproj", "{FCFC5ABF-8459-4B45-ABA0-9B820C7ED5C6}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AIStudio.Wpf.Script", "Extensions\AIStudio.Wpf.Script\AIStudio.Wpf.Script.csproj", "{27A4C86D-3792-4D14-BAEE-3B103A709872}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AIStudio.Wpf.Block", "Extensions\AIStudio.Wpf.Block\AIStudio.Wpf.Block.csproj", "{C7031E27-57A9-498E-95EE-9C3E7DCCA642}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -13,18 +43,63 @@ Global
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3FC9F09D-83EA-4914-8980-A6B4C3352836}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3FC9F09D-83EA-4914-8980-A6B4C3352836}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3FC9F09D-83EA-4914-8980-A6B4C3352836}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3FC9F09D-83EA-4914-8980-A6B4C3352836}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9D2DCA7D-9E0C-4E6E-ACD9-2CD18C75FE34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9D2DCA7D-9E0C-4E6E-ACD9-2CD18C75FE34}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9D2DCA7D-9E0C-4E6E-ACD9-2CD18C75FE34}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9D2DCA7D-9E0C-4E6E-ACD9-2CD18C75FE34}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{86ED5B40-D185-4AFA-B5BD-BC8E78DB8758}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{86ED5B40-D185-4AFA-B5BD-BC8E78DB8758}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{86ED5B40-D185-4AFA-B5BD-BC8E78DB8758}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{86ED5B40-D185-4AFA-B5BD-BC8E78DB8758}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CC68D39D-7935-4079-9CEB-FC2FD498D511}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CC68D39D-7935-4079-9CEB-FC2FD498D511}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CC68D39D-7935-4079-9CEB-FC2FD498D511}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CC68D39D-7935-4079-9CEB-FC2FD498D511}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2AB69067-277E-4EE0-9949-8326A145EEE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2AB69067-277E-4EE0-9949-8326A145EEE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2AB69067-277E-4EE0-9949-8326A145EEE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2AB69067-277E-4EE0-9949-8326A145EEE4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4408F718-9C14-4404-A63B-9B785F9D4F35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4408F718-9C14-4404-A63B-9B785F9D4F35}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4408F718-9C14-4404-A63B-9B785F9D4F35}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4408F718-9C14-4404-A63B-9B785F9D4F35}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EA1D893D-2F50-47AA-80A6-EA297F651CCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EA1D893D-2F50-47AA-80A6-EA297F651CCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EA1D893D-2F50-47AA-80A6-EA297F651CCC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EA1D893D-2F50-47AA-80A6-EA297F651CCC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{186F34AC-4BC5-40E1-911B-DD3E96AECE6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{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
|
||||
{439D0631-D9C2-4D36-BFCE-80DFCCABE9E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{439D0631-D9C2-4D36-BFCE-80DFCCABE9E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{439D0631-D9C2-4D36-BFCE-80DFCCABE9E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{439D0631-D9C2-4D36-BFCE-80DFCCABE9E7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FCFC5ABF-8459-4B45-ABA0-9B820C7ED5C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FCFC5ABF-8459-4B45-ABA0-9B820C7ED5C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FCFC5ABF-8459-4B45-ABA0-9B820C7ED5C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FCFC5ABF-8459-4B45-ABA0-9B820C7ED5C6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{27A4C86D-3792-4D14-BAEE-3B103A709872}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{27A4C86D-3792-4D14-BAEE-3B103A709872}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{27A4C86D-3792-4D14-BAEE-3B103A709872}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{27A4C86D-3792-4D14-BAEE-3B103A709872}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C7031E27-57A9-498E-95EE-9C3E7DCCA642}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C7031E27-57A9-498E-95EE-9C3E7DCCA642}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C7031E27-57A9-498E-95EE-9C3E7DCCA642}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C7031E27-57A9-498E-95EE-9C3E7DCCA642}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{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}
|
||||
{FCFC5ABF-8459-4B45-ABA0-9B820C7ED5C6} = {62DC8608-D98F-47BB-9F19-ABB0C60B72FF}
|
||||
{27A4C86D-3792-4D14-BAEE-3B103A709872} = {4959F170-02FB-4B7F-8F53-93DAF22713F9}
|
||||
{C7031E27-57A9-498E-95EE-9C3E7DCCA642} = {4959F170-02FB-4B7F-8F53-93DAF22713F9}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {D30FC641-F06C-4E35-AEA5-48A9B6E59CE0}
|
||||
EndGlobalSection
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
|
||||
<UseWPF>true</UseWPF>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -13,16 +13,6 @@
|
||||
<Page Remove="DesignItems\Custom\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Controls\AnimationHelper.cs" />
|
||||
<Compile Remove="Controls\CancelRoutedEventArgs.cs" />
|
||||
<Compile Remove="Controls\ContextMenuToggleButton.cs" />
|
||||
<Compile Remove="Controls\ScrollViewer.xaml.cs" />
|
||||
<Compile Remove="Controls\TabControl.xaml.cs" />
|
||||
<Compile Remove="Controls\TabItem.cs" />
|
||||
<Compile Remove="Controls\TabPanel.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Icons\App.ico" />
|
||||
<None Remove="Images\AlignObjectsBottom.png" />
|
||||
@@ -115,12 +105,16 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Page Remove="Controls\ScrollViewer.xaml" />
|
||||
<Page Remove="Controls\TabControl.xaml" />
|
||||
<Page Remove="Images\VectorIcons.xaml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AIStudio.Wpf.ColorPicker" Version="1.1.2" />
|
||||
<PackageReference Include="AIStudio.Wpf.ComeCapture" Version="1.1.0" />
|
||||
<PackageReference Include="Costura.Fody" Version="5.7.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Dragablz" Version="0.0.3.223" />
|
||||
<PackageReference Include="Fluent.Ribbon" Version="8.0.3" />
|
||||
<PackageReference Include="gong-wpf-dragdrop" Version="2.3.2" />
|
||||
@@ -128,19 +122,54 @@
|
||||
<PackageReference Include="MahApps.Metro.IconPacks" Version="4.8.0" />
|
||||
<PackageReference Include="MahApps.Metro.IconPacks.FontAwesome" Version="4.8.0" />
|
||||
<PackageReference Include="MahApps.Metro.IconPacks.VaadinIcons" Version="4.8.0" />
|
||||
<PackageReference Include="MathParser.org-mXparser" Version="4.4.2" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="Util.Svg2XamlTestExtension" Version="1.2.5" />
|
||||
<PackageReference Include="WpfAnimatedGif" Version="2.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Util.DiagramDesigner\Util.DiagramDesigner.csproj" />
|
||||
<ProjectReference Include="..\AIStudio.Wpf.DiagramDesigner.Additionals\AIStudio.Wpf.DiagramDesigner.Additionals.csproj" />
|
||||
<ProjectReference Include="..\AIStudio.Wpf.DiagramDesigner.Serializable\AIStudio.Wpf.DiagramDesigner.Serializable.csproj" />
|
||||
<ProjectReference Include="..\AIStudio.Wpf.DiagramDesigner\AIStudio.Wpf.DiagramDesigner.csproj" />
|
||||
<ProjectReference Include="..\Extensions\AIStudio.Wpf.Block\AIStudio.Wpf.Block.csproj" />
|
||||
<ProjectReference Include="..\Extensions\AIStudio.Wpf.Flowchart\AIStudio.Wpf.Flowchart.csproj" />
|
||||
<ProjectReference Include="..\Extensions\AIStudio.Wpf.Logical\AIStudio.Wpf.Logical.csproj" />
|
||||
<ProjectReference Include="..\Extensions\AIStudio.Wpf.Mind\AIStudio.Wpf.Mind.csproj" />
|
||||
<ProjectReference Include="..\Extensions\AIStudio.Wpf.Script\AIStudio.Wpf.Script.csproj" />
|
||||
<ProjectReference Include="..\Extensions\AIStudio.Wpf.SFC\AIStudio.Wpf.SFC.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="zxing.core">
|
||||
<HintPath>zxing.core.dll</HintPath>
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0-windows'">
|
||||
<Reference Include="AIStudio.Wpf.Script.Core">
|
||||
<HintPath>..\Extensions\AIStudio.Wpf.Script\Dlls\net5.0-windows\AIStudio.Wpf.Script.Core.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0-windows'">
|
||||
<Reference Include="AIStudio.Wpf.Script.Core">
|
||||
<HintPath>..\Extensions\AIStudio.Wpf.Script\Dlls\net6.0-windows\AIStudio.Wpf.Script.Core.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
|
||||
<Reference Include="AIStudio.Wpf.Script.Core">
|
||||
<HintPath>..\Extensions\AIStudio.Wpf.Script\Dlls\net461\AIStudio.Wpf.Script.Core.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0-windows'">
|
||||
<Reference Include="AIStudio.Wpf.Block.Core">
|
||||
<HintPath>..\Extensions\AIStudio.Wpf.Block\Dlls\net5.0-windows\AIStudio.Wpf.Block.Core.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0-windows'">
|
||||
<Reference Include="AIStudio.Wpf.Block.Core">
|
||||
<HintPath>..\Extensions\AIStudio.Wpf.Block\Dlls\net6.0-windows\AIStudio.Wpf.Block.Core.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
|
||||
<Reference Include="AIStudio.Wpf.Block.Core">
|
||||
<HintPath>..\Extensions\AIStudio.Wpf.Block\Dlls\net461\AIStudio.Wpf.Block.Core.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -239,32 +268,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Page Update="Controls\PopupWindow.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
</Page>
|
||||
<Page Update="Demos\Logical\ViewModels\LogicalGateItemViewModel.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Demos\Others\ViewModels\BarcodeDesignerItemViewModel.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Demos\Others\ViewModels\PersistDesignerItemViewModel.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Demos\Others\ViewModels\SettingsDesignerItemViewModel.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Demos\Others\ViewModels\OutLineTextDesignerItemViewModel.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Demos\Others\ViewModels\PathItemViewModel.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
</Page>
|
||||
<Page Update="Themes\Generic.xaml">
|
||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||
</Page>
|
||||
@@ -274,7 +277,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="DesignItems\Customs\1.json">
|
||||
<None Update="Images\Gifs\car_chase.gif">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Images\Svgs\account-book.svg">
|
||||
24
AIStudio.Wpf.DiagramApp/App.xaml
Normal file
@@ -0,0 +1,24 @@
|
||||
<Application x:Class="AIStudio.Wpf.DiagramApp.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:AIStudio.Wpf.DiagramApp"
|
||||
StartupUri="Views/MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Fluent;component/Themes/Generic.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/Dragablz;component/Themes/Generic.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.DiagramApp;component/Themes/Generic.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Flowchart;component/Themes/FlowNode.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Logical;component/Themes/LogicalGateItemViewModel.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.SFC;component/Themes/SFCNode.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Themes/MindNode.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Mind;component/Themes/Generic.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Script.Core;component/Themes/RoslynScriptViewModel.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Script;component/Themes/ColorBoxFactoryScriptViewModel.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Script;component/Themes/ColorBoxCollectorScriptViewModel.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/AIStudio.Wpf.Block.Core;component/Themes/BlockItemViewModel.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -10,7 +10,7 @@ using System.Windows;
|
||||
//如果是WinForm(假定程序为MyDemo.exe,则需要一个MyDemo.exe.config文件)
|
||||
//如果是WebForm,则从web.config中读取相关信息
|
||||
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
|
||||
namespace AIStudio.Wpf.ADiagram
|
||||
namespace AIStudio.Wpf.DiagramApp
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
1
AIStudio.Wpf.DiagramApp/DesignItems/Customs/1.json
Normal file
@@ -0,0 +1 @@
|
||||
{"Title":null,"DiagramType":0,"DiagramItems":[{"Name":null,"DiagramType":0,"ShowGrid":false,"PhysicalGridCellSize":"0,0","CellHorizontalAlignment":0,"CellVerticalAlignment":0,"PageSizeOrientation":0,"PhysicalPageSize":"0,0","PageSizeType":0,"PhysicalGridMarginSize":"0,0","GridColor":"#00000000","DesignerItems":[{"ModelType":null,"ModelTypeName":"AIStudio.Wpf.DiagramDesigner.DefaultDesignerItemViewModel","SerializableType":null,"SerializableTypeName":"AIStudio.Wpf.DiagramDesigner.DesignerItemBase","SerializableString":"{\"PhysicalLeft\":55.071354166666666,\"PhysicalTop\":10.13635421792666,\"Angle\":0.0,\"ScaleX\":1.0,\"ScaleY\":1.0,\"Margin\":0.0,\"ItemWidth\":14.557291666666666,\"ItemHeight\":14.557291666666666,\"Icon\":null,\"Reserve\":null,\"ItemTypeName\":\"AIStudio.Wpf.DiagramDesigner.DefaultDesignerItemViewModel\",\"ParentId\":\"00000000-0000-0000-0000-000000000000\",\"Id\":\"e400c493-a6e9-4ac6-88b0-387bb35a83bc\",\"ZIndex\":0,\"IsGroup\":false,\"Text\":\"AIStudio\",\"ColorItem\":{\"LineColor\":{\"BrushType\":1,\"Color\":\"#FF808080\",\"GradientStop\":null,\"Offset\":null,\"Image\":null,\"SubType\":0,\"StartPoint\":\"0,0\",\"EndPoint\":\"0,0\",\"Opacity\":1.0,\"LinearOrientation\":0,\"RadialOrientation\":0,\"Angle\":0},\"FillColor\":{\"BrushType\":1,\"Color\":\"#FFFFA500\",\"GradientStop\":null,\"Offset\":null,\"Image\":null,\"SubType\":0,\"StartPoint\":\"0,0\",\"EndPoint\":\"0,0\",\"Opacity\":1.0,\"LinearOrientation\":0,\"RadialOrientation\":0,\"Angle\":0},\"ShadowColor\":\"#00FFFFFF\",\"LineWidth\":1.0,\"LineDashStyle\":0,\"LineAnimation\":0,\"LineAnimationDuration\":1.0},\"FontItem\":{\"FontWeight\":\"Normal\",\"FontStyle\":\"Normal\",\"FontStretch\":\"Normal\",\"Underline\":false,\"Strikethrough\":false,\"OverLine\":false,\"FontColor\":\"#FF000000\",\"FontFamily\":\"Arial\",\"FontSize\":12.0,\"FontObject\":\"Arial, 12pt\",\"TextEffectColor\":\"#00FFFFFF\",\"HighlightColor\":\"#00FFFFFF\",\"FontCase\":0,\"HorizontalAlignment\":1,\"VerticalAlignment\":1,\"LineHeight\":0.0},\"SharpItem\":{\"SourceMarker\":{\"Path\":\"\",\"Width\":10.0,\"Height\":10.0,\"PathStyle\":0,\"SizeStyle\":10},\"SinkMarker\":{\"Path\":\"M 0 -5 10 0 0 5 z\",\"Width\":10.0,\"Height\":10.0,\"PathStyle\":1,\"SizeStyle\":10}}}"}],"Connections":[]}]}
|
||||
3
AIStudio.Wpf.DiagramApp/FodyWeavers.xml
Normal file
@@ -0,0 +1,3 @@
|
||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<Costura />
|
||||
</Weavers>
|
||||
141
AIStudio.Wpf.DiagramApp/FodyWeavers.xsd
Normal file
@@ -0,0 +1,141 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
|
||||
<xs:element name="Weavers">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeRuntimeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="IncludeRuntimeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IncludeRuntimeReferences" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Controls if runtime assemblies are also embedded.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="UseRuntimeReferencePaths" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Controls whether the runtime assemblies are embedded with their full path or only with their assembly name.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="DisableCompression" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="DisableCleanup" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="ExcludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IncludeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="ExcludeRuntimeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="IncludeRuntimeAssemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="PreloadOrder" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="VerifyAssembly" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="GenerateXsd" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 405 B After Width: | Height: | Size: 405 B |
|
Before Width: | Height: | Size: 353 B After Width: | Height: | Size: 353 B |
|
Before Width: | Height: | Size: 365 B After Width: | Height: | Size: 365 B |
|
Before Width: | Height: | Size: 425 B After Width: | Height: | Size: 425 B |
|
Before Width: | Height: | Size: 454 B After Width: | Height: | Size: 454 B |
|
Before Width: | Height: | Size: 413 B After Width: | Height: | Size: 413 B |
|
Before Width: | Height: | Size: 185 B After Width: | Height: | Size: 185 B |
|
Before Width: | Height: | Size: 230 B After Width: | Height: | Size: 230 B |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 556 B After Width: | Height: | Size: 556 B |
|
Before Width: | Height: | Size: 689 B After Width: | Height: | Size: 689 B |
|
Before Width: | Height: | Size: 185 B After Width: | Height: | Size: 185 B |
|
Before Width: | Height: | Size: 230 B After Width: | Height: | Size: 230 B |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 643 B After Width: | Height: | Size: 643 B |
|
Before Width: | Height: | Size: 628 B After Width: | Height: | Size: 628 B |
|
Before Width: | Height: | Size: 743 B After Width: | Height: | Size: 743 B |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 435 B After Width: | Height: | Size: 435 B |
|
Before Width: | Height: | Size: 334 B After Width: | Height: | Size: 334 B |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 1022 B After Width: | Height: | Size: 1022 B |
|
Before Width: | Height: | Size: 4.5 MiB After Width: | Height: | Size: 4.5 MiB |
|
Before Width: | Height: | Size: 185 B After Width: | Height: | Size: 185 B |
|
Before Width: | Height: | Size: 228 B After Width: | Height: | Size: 228 B |
|
Before Width: | Height: | Size: 185 B After Width: | Height: | Size: 185 B |
|
Before Width: | Height: | Size: 229 B After Width: | Height: | Size: 229 B |
|
Before Width: | Height: | Size: 654 B After Width: | Height: | Size: 654 B |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 743 B After Width: | Height: | Size: 743 B |
|
Before Width: | Height: | Size: 185 B After Width: | Height: | Size: 185 B |
|
Before Width: | Height: | Size: 231 B After Width: | Height: | Size: 231 B |
|
Before Width: | Height: | Size: 730 B After Width: | Height: | Size: 730 B |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 185 B After Width: | Height: | Size: 185 B |
|
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 225 B |
|
Before Width: | Height: | Size: 766 B After Width: | Height: | Size: 766 B |
|
Before Width: | Height: | Size: 185 B After Width: | Height: | Size: 185 B |
|
Before Width: | Height: | Size: 229 B After Width: | Height: | Size: 229 B |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 595 B After Width: | Height: | Size: 595 B |
|
Before Width: | Height: | Size: 559 B After Width: | Height: | Size: 559 B |
|
Before Width: | Height: | Size: 586 B After Width: | Height: | Size: 586 B |