Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Thick-Common
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘栩锋
Thick-Common
Commits
54881a0a
Commit
54881a0a
authored
Jul 07, 2021
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复 样品界面 绑定 Samples 出错
parent
0ef2225e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
61 deletions
+84
-61
PgGetSample.xaml
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgGetSample.xaml
+0
-1
PgGetSample.xaml.cs
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgGetSample.xaml.cs
+84
-60
No files found.
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgGetSample.xaml
View file @
54881a0a
...
@@ -116,7 +116,6 @@
...
@@ -116,7 +116,6 @@
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Horizontal">
<StackPanel>
<StackPanel>
<StackPanel.Resources>
<StackPanel.Resources>
<CollectionViewSource Source="{Binding Samples}" x:Key="samplesViewSource" />
<sys:Double x:Key="column0_width">50</sys:Double>
<sys:Double x:Key="column0_width">50</sys:Double>
<sys:Double x:Key="column_width">150</sys:Double>
<sys:Double x:Key="column_width">150</sys:Double>
<Style x:Key="TextBlockStyle_header_no" TargetType="TextBlock" BasedOn="{StaticResource Styles.Text.FieldHeader}">
<Style x:Key="TextBlockStyle_header_no" TargetType="TextBlock" BasedOn="{StaticResource Styles.Text.FieldHeader}">
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgGetSample.xaml.cs
View file @
54881a0a
...
@@ -45,6 +45,11 @@ namespace FLY.Thick.Base.UI
...
@@ -45,6 +45,11 @@ namespace FLY.Thick.Base.UI
public
class
PgGetSampleVm
:
INotifyPropertyChanged
public
class
PgGetSampleVm
:
INotifyPropertyChanged
{
{
#
region
Markno
const
int
MARKNO_UPDATE_SAMPLE
=
1
;
const
int
MARKNO_UPDATE_FEATURE
=
2
;
#
endregion
#
region
参数
#
region
参数
/// <summary>
/// <summary>
...
@@ -140,29 +145,44 @@ namespace FLY.Thick.Base.UI
...
@@ -140,29 +145,44 @@ namespace FLY.Thick.Base.UI
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
SearchRange
),
this
,
nameof
(
SearchRange
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
SearchRange
),
this
,
nameof
(
SearchRange
));
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
Samples
),
()=>
{
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
Samples
),
()=>
{
FObjBase
.
PollModule
.
Current
.
Poll_JustOnce
(
updateSamples
,
this
,
MARKNO_UPDATE_SAMPLE
);
});
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
Features
),
()
=>
{
FObjBase
.
PollModule
.
Current
.
Poll_JustOnce
(
updateFeatures
,
this
,
MARKNO_UPDATE_FEATURE
);
});
}
void
updateSamples
()
{
var
samples
=
this
.
getSampleService
.
Samples
;
var
samples
=
this
.
getSampleService
.
Samples
;
if
(
samples
==
null
)
if
(
samples
==
null
)
{
{
Samples
=
null
;
Samples
=
null
;
}
}
else
else
{
{
Sample
s
=
new
SampleCellView
[
samples
.
Count
()];
var
sampleView
s
=
new
SampleCellView
[
samples
.
Count
()];
for
(
int
i
=
0
;
i
<
Sample
s
.
Count
();
i
++)
for
(
int
i
=
0
;
i
<
sampleView
s
.
Count
();
i
++)
{
{
Samples
[
i
]
=
new
SampleCellView
()
{
Name
=
i
.
ToString
()
};
sampleViews
[
i
]
=
new
SampleCellView
()
{
Name
=
i
.
ToString
()
};
var
sampleView
=
Samples
[
i
];
var
sampleView
=
sampleViews
[
i
];
Misc
.
BindingOperations
.
SetBinding
(
samples
[
i
],
nameof
(
SampleCell
.
Enable
),
sampleView
,
nameof
(
SampleCellView
.
Enable
));
var
sample
=
samples
[
i
];
Misc
.
BindingOperations
.
SetBinding
(
samples
[
i
],
nameof
(
SampleCell
.
JustForCheck
),
sampleView
,
nameof
(
SampleCellView
.
JustForCheck
));
Misc
.
BindingOperations
.
SetBinding
(
sample
,
nameof
(
SampleCell
.
Enable
),
sampleView
,
nameof
(
SampleCellView
.
Enable
));
Misc
.
BindingOperations
.
SetBinding
(
samples
[
i
],
nameof
(
SampleCell
.
OrgAD
),
sampleView
,
nameof
(
SampleCellView
.
OrgAD
));
Misc
.
BindingOperations
.
SetBinding
(
sample
,
nameof
(
SampleCell
.
JustForCheck
),
sampleView
,
nameof
(
SampleCellView
.
JustForCheck
));
Misc
.
BindingOperations
.
SetBinding
(
samples
[
i
],
nameof
(
SampleCell
.
Position
),
sampleView
,
nameof
(
SampleCellView
.
Position
));
Misc
.
BindingOperations
.
SetBinding
(
sample
,
nameof
(
SampleCell
.
OrgAD
),
sampleView
,
nameof
(
SampleCellView
.
OrgAD
));
Misc
.
BindingOperations
.
SetBinding
(
sample
,
nameof
(
SampleCell
.
Position
),
sampleView
,
nameof
(
SampleCellView
.
Position
));
Misc
.
BindingOperations
.
SetBinding
(
samples
[
i
],
nameof
(
SampleCell
.
AD
),
sampleView
,
nameof
(
SampleCellView
.
AD
));
Misc
.
BindingOperations
.
SetBinding
(
samples
[
i
],
nameof
(
SampleCell
.
SampleValue
),
sampleView
,
nameof
(
SampleCellView
.
SampleValue
));
Misc
.
BindingOperations
.
SetBinding
(
sample
,
nameof
(
SampleCell
.
AD
),
sampleView
,
nameof
(
SampleCellView
.
AD
));
Misc
.
BindingOperations
.
SetBinding
(
sample
,
nameof
(
SampleCell
.
SampleValue
),
sampleView
,
nameof
(
SampleCellView
.
SampleValue
));
}
}
updateSampleCellViewVisible
(
sampleViews
);
updateSampleCellViewVisible
();
Samples
=
sampleViews
;
for
(
int
i
=
0
;
i
<
Samples
.
Count
();
i
++)
{
for
(
int
i
=
0
;
i
<
Samples
.
Count
();
i
++)
{
var
sampleView
=
Samples
[
i
];
var
sampleView
=
Samples
[
i
];
sampleView
.
PropertyChanged
+=
(
s
,
e
)
=>
sampleView
.
PropertyChanged
+=
(
s
,
e
)
=>
{
{
...
@@ -173,9 +193,9 @@ namespace FLY.Thick.Base.UI
...
@@ -173,9 +193,9 @@ namespace FLY.Thick.Base.UI
};
};
}
}
}
}
});
}
void
updateFeatures
()
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
Features
),
()
=>
{
{
var
features
=
this
.
getSampleService
.
Features
;
var
features
=
this
.
getSampleService
.
Features
;
if
(
features
==
null
)
if
(
features
==
null
)
{
{
...
@@ -184,41 +204,45 @@ namespace FLY.Thick.Base.UI
...
@@ -184,41 +204,45 @@ namespace FLY.Thick.Base.UI
else
else
{
{
int
cnt
=
Math
.
Min
(
features
.
Count
(),
2
);
int
cnt
=
Math
.
Min
(
features
.
Count
(),
2
);
Feature
s
=
new
SampleFeatureView
[
cnt
];
var
featureView
s
=
new
SampleFeatureView
[
cnt
];
for
(
int
i
=
0
;
i
<
Feature
s
.
Count
();
i
++)
for
(
int
i
=
0
;
i
<
featureView
s
.
Count
();
i
++)
{
{
Feature
s
[
i
]
=
new
SampleFeatureView
();
featureView
s
[
i
]
=
new
SampleFeatureView
();
var
featureView
=
Feature
s
[
i
];
var
featureView
=
featureView
s
[
i
];
if
(
i
==
0
)
if
(
i
==
0
)
featureView
.
Name
=
"正向"
;
featureView
.
Name
=
"正向"
;
else
else
featureView
.
Name
=
"反向"
;
featureView
.
Name
=
"反向"
;
var
feature
=
features
[
i
];
Misc
.
BindingOperations
.
SetBinding
(
feature
,
nameof
(
SampleFeature
.
Enable
),
featureView
,
nameof
(
SampleFeatureView
.
Enable
));
Misc
.
BindingOperations
.
SetBinding
(
feature
,
nameof
(
SampleFeature
.
StartPos
),
featureView
,
nameof
(
SampleFeatureView
.
StartPos
));
Misc
.
BindingOperations
.
SetBinding
(
feature
,
nameof
(
SampleFeature
.
EndPos
),
featureView
,
nameof
(
SampleFeatureView
.
EndPos
));
Misc
.
BindingOperations
.
SetBinding
(
features
[
i
],
nameof
(
SampleFeature
.
Enable
),
featureView
,
nameof
(
SampleFeatureView
.
Enable
));
Misc
.
BindingOperations
.
SetBinding
(
feature
,
nameof
(
SampleFeature
.
MaxRelevancy
),
featureView
,
nameof
(
SampleFeatureView
.
MaxRelevancy
));
Misc
.
BindingOperations
.
SetBinding
(
features
[
i
],
nameof
(
SampleFeature
.
StartPos
),
featureView
,
nameof
(
SampleFeatureView
.
StartPos
));
Misc
.
BindingOperations
.
SetBinding
(
feature
,
nameof
(
SampleFeature
.
MaxOffset
),
featureView
,
nameof
(
SampleFeatureView
.
MaxOffset
));
Misc
.
BindingOperations
.
SetBinding
(
features
[
i
],
nameof
(
SampleFeature
.
EndPos
),
featureView
,
nameof
(
SampleFeatureView
.
EndPos
));
Misc
.
BindingOperations
.
SetBinding
(
features
[
i
],
nameof
(
SampleFeature
.
MaxRelevancy
),
featureView
,
nameof
(
SampleFeatureView
.
MaxRelevancy
));
Misc
.
BindingOperations
.
SetBinding
(
features
[
i
],
nameof
(
SampleFeature
.
MaxOffset
),
featureView
,
nameof
(
SampleFeatureView
.
MaxOffset
));
}
}
Features
=
featureViews
;
}
}
});
}
}
protected
void
updateSampleCellViewVisible
()
protected
void
updateSampleCellViewVisible
(
SampleCellView
[]
sampleViews
)
{
{
if
(
Sample
s
==
null
)
if
(
sampleView
s
==
null
)
return
;
return
;
for
(
int
i
=
0
;
i
<
Sample
s
.
Count
();
i
++)
{
for
(
int
i
=
0
;
i
<
sampleView
s
.
Count
();
i
++)
{
if
(
i
==
0
)
if
(
i
==
0
)
Sample
s
[
i
].
IsVisible
=
true
;
sampleView
s
[
i
].
IsVisible
=
true
;
else
else
{
{
Samples
[
i
].
IsVisible
=
Sample
s
[
i
-
1
].
Enable
;
sampleViews
[
i
].
IsVisible
=
sampleView
s
[
i
-
1
].
Enable
;
}
}
}
}
}
}
protected
void
updateSampleCellViewVisible
()
{
updateSampleCellViewVisible
(
Samples
);
}
private
void
Apply
()
private
void
Apply
()
{
{
if
(!
WdPassword
.
Authorize
(
"GetSample"
))
if
(!
WdPassword
.
Authorize
(
"GetSample"
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment