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
5d631bd5
Commit
5d631bd5
authored
Mar 21, 2020
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev6.0' of
http://private.flyautomation.net:82/panruising/thick_public
into dev6.0
parents
3d9c1da0
e1cebe18
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
24 deletions
+51
-24
PropertiesManager.cs
Project.FLY.Misc/MISC/PropertiesManager.cs
+39
-0
PgErrorAllTable.xaml
...Thick.Base/FLY.Thick.Base.UI/PgError/PgErrorAllTable.xaml
+12
-24
No files found.
Project.FLY.Misc/MISC/PropertiesManager.cs
View file @
5d631bd5
...
...
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using
System.Linq
;
using
System.Reflection
;
using
System.Text
;
using
System.Text.RegularExpressions
;
namespace
Misc
{
...
...
@@ -28,6 +29,8 @@ namespace Misc
/// <param name="v"></param>
public
static
void
SetValue
(
object
obj
,
string
propertyName
,
object
v
)
{
//if (!getRootProperty(ref obj, ref propertyName))
// return;
PropertyInfo
property
=
obj
.
GetType
().
GetProperty
(
propertyName
);
if
(
property
!=
null
)
{
...
...
@@ -35,6 +38,36 @@ namespace Misc
}
}
static
bool
getRootProperty
(
ref
object
obj
,
ref
string
propertyName
)
{
Regex
r
=
new
Regex
(
@"(\S+)\[(\d+)\]"
);
string
[]
lvs
=
propertyName
.
Split
(
'.'
);
if
(
lvs
.
Count
()
>
1
)
{
//这个是多级的
for
(
int
i
=
0
;
i
<
lvs
.
Count
()
-
1
;
i
++)
{
PropertyInfo
property
;
string
name
=
lvs
[
i
];
int
index
=
0
;
var
match
=
r
.
Match
(
name
);
if
(
match
.
Success
)
{
name
=
match
.
Groups
[
1
].
Value
;
index
=
int
.
Parse
(
match
.
Groups
[
2
].
Value
);
}
property
=
obj
.
GetType
().
GetProperty
(
name
);
if
(
property
==
null
)
return
false
;
//异常
if
(
match
.
Success
)
obj
=
property
.
GetValue
(
obj
,
new
object
[]
{
index
});
else
obj
=
property
.
GetValue
(
obj
);
}
propertyName
=
lvs
.
Last
();
}
return
true
;
}
/// <summary>
/// 设定参数(属性)的值,触发属性值变化“通知”,writeVal
/// </summary>
...
...
@@ -43,6 +76,9 @@ namespace Misc
/// <param name="val"></param>
public
static
void
SetValue
(
object
obj
,
string
propertyName
,
string
val
)
{
//if (!getRootProperty(ref obj, ref propertyName))
// return;
PropertyInfo
property
=
obj
.
GetType
().
GetProperty
(
propertyName
);
if
(
property
!=
null
)
{
...
...
@@ -59,6 +95,9 @@ namespace Misc
/// <returns></returns>
public
static
object
GetValue
(
object
obj
,
string
propertyName
)
{
//if (!getRootProperty(ref obj, ref propertyName))
// return null;
PropertyInfo
property
=
obj
.
GetType
().
GetProperty
(
propertyName
);
if
(
property
!=
null
)
{
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgError/PgErrorAllTable.xaml
View file @
5d631bd5
...
...
@@ -13,6 +13,10 @@
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Converter/Dictionary_MyConv.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style TargetType="DataGridCell" >
<Setter Property="FontSize" Value="16"/>
</Style>
</ResourceDictionary>
</Page.Resources>
<Grid Name="root_grid" >
...
...
@@ -41,28 +45,14 @@
</Button>
</StackPanel>
</Grid>
<Grid x:Name="grid_window" Grid.Row="1">
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border Style="{StaticResource BorderStyle_paramSection}" >
<TextBlock Text="历史报警
列表" />
</Border>
<Grid Grid.Column="1" x:Name="grid_window">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="751*"/>
<ColumnDefinition Width="54*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid
Grid.ColumnSpan="2"
>
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
...
...
@@ -94,12 +84,10 @@
</StackPanel>
</Grid>
<DataGrid Grid.Row="1" ItemsSource="{Binding Record}" AutoGenerateColumns="False" IsReadOnly="True" Grid.ColumnSpan="2" AlternationCount="5" >
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="FontSize" Value="20"/>
</Style>
</DataGrid.CellStyle>
<DataGrid Grid.Row="1" ItemsSource="{Binding Record}" AutoGenerateColumns="False" IsReadOnly="True" Grid.ColumnSpan="2"
AlternationCount="5" AlternatingRowBackground="LightGray"
>
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Time,StringFormat={}{0:MM/dd HH:mm}}" >
<DataGridTextColumn.Header>
...
...
@@ -133,7 +121,7 @@
</DataGrid>
</Grid>
</Grid>
...
...
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