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
Hide 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,85 +145,104 @@ namespace FLY.Thick.Base.UI
...
@@ -140,85 +145,104 @@ 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
),
()=>
{
var
samples
=
this
.
getSampleService
.
Samples
;
FObjBase
.
PollModule
.
Current
.
Poll_JustOnce
(
updateSamples
,
this
,
MARKNO_UPDATE_SAMPLE
);
if
(
samples
==
null
)
{
Samples
=
null
;
}
else
{
Samples
=
new
SampleCellView
[
samples
.
Count
()];
for
(
int
i
=
0
;
i
<
Samples
.
Count
();
i
++)
{
Samples
[
i
]
=
new
SampleCellView
()
{
Name
=
i
.
ToString
()
};
var
sampleView
=
Samples
[
i
];
Misc
.
BindingOperations
.
SetBinding
(
samples
[
i
],
nameof
(
SampleCell
.
Enable
),
sampleView
,
nameof
(
SampleCellView
.
Enable
));
Misc
.
BindingOperations
.
SetBinding
(
samples
[
i
],
nameof
(
SampleCell
.
JustForCheck
),
sampleView
,
nameof
(
SampleCellView
.
JustForCheck
));
Misc
.
BindingOperations
.
SetBinding
(
samples
[
i
],
nameof
(
SampleCell
.
OrgAD
),
sampleView
,
nameof
(
SampleCellView
.
OrgAD
));
Misc
.
BindingOperations
.
SetBinding
(
samples
[
i
],
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
));
}
updateSampleCellViewVisible
();
for
(
int
i
=
0
;
i
<
Samples
.
Count
();
i
++)
{
var
sampleView
=
Samples
[
i
];
sampleView
.
PropertyChanged
+=
(
s
,
e
)
=>
{
if
(
e
.
PropertyName
==
nameof
(
SampleCellView
.
Enable
))
{
updateSampleCellViewVisible
();
}
};
}
}
});
});
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
Features
),
()
=>
{
Misc
.
BindingOperations
.
SetBinding
(
this
.
getSampleService
,
nameof
(
this
.
getSampleService
.
Features
),
()
=>
{
var
features
=
this
.
getSampleService
.
Features
;
FObjBase
.
PollModule
.
Current
.
Poll_JustOnce
(
updateFeatures
,
this
,
MARKNO_UPDATE_FEATURE
);
if
(
features
==
null
)
});
}
void
updateSamples
()
{
var
samples
=
this
.
getSampleService
.
Samples
;
if
(
samples
==
null
)
{
Samples
=
null
;
}
else
{
var
sampleViews
=
new
SampleCellView
[
samples
.
Count
()];
for
(
int
i
=
0
;
i
<
sampleViews
.
Count
();
i
++)
{
{
Features
=
null
;
sampleViews
[
i
]
=
new
SampleCellView
()
{
Name
=
i
.
ToString
()
};
var
sampleView
=
sampleViews
[
i
];
var
sample
=
samples
[
i
];
Misc
.
BindingOperations
.
SetBinding
(
sample
,
nameof
(
SampleCell
.
Enable
),
sampleView
,
nameof
(
SampleCellView
.
Enable
));
Misc
.
BindingOperations
.
SetBinding
(
sample
,
nameof
(
SampleCell
.
JustForCheck
),
sampleView
,
nameof
(
SampleCellView
.
JustForCheck
));
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
(
sample
,
nameof
(
SampleCell
.
AD
),
sampleView
,
nameof
(
SampleCellView
.
AD
));
Misc
.
BindingOperations
.
SetBinding
(
sample
,
nameof
(
SampleCell
.
SampleValue
),
sampleView
,
nameof
(
SampleCellView
.
SampleValue
));
}
}
else
updateSampleCellViewVisible
(
sampleViews
);
Samples
=
sampleViews
;
for
(
int
i
=
0
;
i
<
Samples
.
Count
();
i
++)
{
{
int
cnt
=
Math
.
Min
(
features
.
Count
(),
2
);
var
sampleView
=
Samples
[
i
];
Features
=
new
SampleFeatureView
[
cnt
];
sampleView
.
PropertyChanged
+=
(
s
,
e
)
=>
for
(
int
i
=
0
;
i
<
Features
.
Count
();
i
++)
{
{
Features
[
i
]
=
new
SampleFeatureView
();
if
(
e
.
PropertyName
==
nameof
(
SampleCellView
.
Enable
))
var
featureView
=
Features
[
i
];
{
if
(
i
==
0
)
updateSampleCellViewVisible
();
featureView
.
Name
=
"正向"
;
}
else
};
featureView
.
Name
=
"反向"
;
}
}
Misc
.
BindingOperations
.
SetBinding
(
features
[
i
],
nameof
(
SampleFeature
.
Enable
),
featureView
,
nameof
(
SampleFeatureView
.
Enable
));
}
Misc
.
BindingOperations
.
SetBinding
(
features
[
i
],
nameof
(
SampleFeature
.
StartPos
),
featureView
,
nameof
(
SampleFeatureView
.
StartPos
));
void
updateFeatures
()
Misc
.
BindingOperations
.
SetBinding
(
features
[
i
],
nameof
(
SampleFeature
.
EndPos
),
featureView
,
nameof
(
SampleFeatureView
.
EndPos
));
{
var
features
=
this
.
getSampleService
.
Features
;
Misc
.
BindingOperations
.
SetBinding
(
features
[
i
],
nameof
(
SampleFeature
.
MaxRelevancy
),
featureView
,
nameof
(
SampleFeatureView
.
MaxRelevancy
));
if
(
features
==
null
)
Misc
.
BindingOperations
.
SetBinding
(
features
[
i
],
nameof
(
SampleFeature
.
MaxOffset
),
featureView
,
nameof
(
SampleFeatureView
.
MaxOffset
));
{
Features
=
null
;
}
else
{
int
cnt
=
Math
.
Min
(
features
.
Count
(),
2
);
var
featureViews
=
new
SampleFeatureView
[
cnt
];
for
(
int
i
=
0
;
i
<
featureViews
.
Count
();
i
++)
{
featureViews
[
i
]
=
new
SampleFeatureView
();
var
featureView
=
featureViews
[
i
];
if
(
i
==
0
)
featureView
.
Name
=
"正向"
;
else
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
(
feature
,
nameof
(
SampleFeature
.
MaxRelevancy
),
featureView
,
nameof
(
SampleFeatureView
.
MaxRelevancy
));
Misc
.
BindingOperations
.
SetBinding
(
feature
,
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