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
780c96d8
Commit
780c96d8
authored
Feb 26, 2020
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 全部使用 mahapp.metro.iconpacks.material
2. PLC 报警配置,添加 XXX PLC连接断开, XXX可自定义
parent
4d71a26f
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
102 additions
and
11 deletions
+102
-11
FLY.ControlLibrary.csproj
...ntrolLibrary/FLY.ControlLibrary/FLY.ControlLibrary.csproj
+1
-1
IPEndPointJsonConverter.cs
Project.FLY.Misc/MISC/IPEndPointJsonConverter.cs
+86
-0
Misc.csproj
Project.FLY.Misc/MISC/Misc.csproj
+1
-0
PLCGroup.cs
Project.FLY.ModbusMapper/FLY.ModbusMapper/PLCGroup.cs
+4
-1
FlyData_WarningHistory.cs
...Components/OBJComponents/Common/FlyData_WarningHistory.cs
+1
-1
ErrorConf.cs
Project.FLY.OBJComponents/OBJComponents/Server/ErrorConf.cs
+4
-3
FLY.Thick.Base.UI.csproj
...FLY.Thick.Base/FLY.Thick.Base.UI/FLY.Thick.Base.UI.csproj
+1
-1
PgErrorAllTable.xaml
...Thick.Base/FLY.Thick.Base.UI/PgError/PgErrorAllTable.xaml
+1
-1
PgErrorTable.xaml
...LY.Thick.Base/FLY.Thick.Base.UI/PgError/PgErrorTable.xaml
+3
-3
No files found.
Project.FLY.ControlLibrary/FLY.ControlLibrary/FLY.ControlLibrary.csproj
View file @
780c96d8
...
...
@@ -230,7 +230,7 @@
<Resource
Include=
"Images\background.jpg"
/>
</ItemGroup>
<ItemGroup>
<PackageReference
Include=
"MahApps.Metro.IconPacks"
>
<PackageReference
Include=
"MahApps.Metro.IconPacks
.Material
"
>
<Version>
3.2.0
</Version>
</PackageReference>
<PackageReference
Include=
"Microsoft.Expression.Drawing"
>
...
...
Project.FLY.Misc/MISC/IPEndPointJsonConverter.cs
0 → 100644
View file @
780c96d8
using
Newtonsoft.Json
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Net
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Misc
{
public
class
IPEndPointJsonConverter
:
JsonConverter
{
//
/// <summary>
/// 是否开启自定义反序列化,值为true时,反序列化时会走ReadJson方法,值为false时,不走ReadJson方法,而是默认的反序列化
/// </summary>
public
override
bool
CanRead
=>
true
;
/// <summary>
/// 是否开启自定义序列化,值为true时,序列化时会走WriteJson方法,值为false时,不走WriteJson方法,而是默认的序列化
/// </summary>
public
override
bool
CanWrite
=>
true
;
/// <summary>
/// 判断是否为IPEndPoint类型
/// </summary>
/// <param name="objectType"></param>
/// <returns></returns>
public
override
bool
CanConvert
(
Type
objectType
)
{
return
typeof
(
IPEndPoint
)
==
objectType
;
}
public
override
object
ReadJson
(
JsonReader
reader
,
Type
objectType
,
object
existingValue
,
JsonSerializer
serializer
)
{
bool
isNullable
=
IsNullableType
(
objectType
);
Type
t
=
isNullable
?
Nullable
.
GetUnderlyingType
(
objectType
)
:
objectType
;
if
(
reader
.
TokenType
==
JsonToken
.
Null
)
{
if
(!
IsNullableType
(
objectType
))
{
throw
new
Exception
(
string
.
Format
(
"不能转换null value to {0}."
,
objectType
));
}
return
null
;
}
try
{
if
(
reader
.
TokenType
==
JsonToken
.
String
)
{
string
epText
=
reader
.
Value
.
ToString
();
return
Misc
.
StringConverter
.
ToIPEndPoint
(
epText
);
}
}
catch
(
Exception
ex
)
{
throw
new
Exception
(
string
.
Format
(
"Error converting value {0} to type '{1}'"
,
reader
.
Value
,
objectType
));
}
throw
new
Exception
(
string
.
Format
(
"Unexpected token {0} when parsing enum"
,
reader
.
TokenType
));
}
public
bool
IsNullableType
(
Type
t
)
{
if
(
t
==
null
)
{
throw
new
ArgumentNullException
(
"t"
);
}
return
(
t
.
BaseType
.
FullName
==
"System.ValueType"
&&
t
.
GetGenericTypeDefinition
()
==
typeof
(
Nullable
<>));
}
public
override
void
WriteJson
(
JsonWriter
writer
,
object
value
,
JsonSerializer
serializer
)
{
if
(
value
==
null
)
{
writer
.
WriteNull
();
return
;
}
IPEndPoint
ep
=
(
IPEndPoint
)
value
;
writer
.
WriteValue
(
ep
.
ToString
());
}
}
}
Project.FLY.Misc/MISC/Misc.csproj
View file @
780c96d8
...
...
@@ -82,6 +82,7 @@
<Compile
Include=
"DATARANGE.cs"
/>
<Compile
Include=
"Enumerable.cs"
/>
<Compile
Include=
"IgnoreAttribute.cs"
/>
<Compile
Include=
"IPEndPointJsonConverter.cs"
/>
<Compile
Include=
"IsErrorAttribute.cs"
/>
<Compile
Include=
"PropertiesManager.cs"
/>
<Compile
Include=
"PropertyBinding.cs"
/>
...
...
Project.FLY.ModbusMapper/FLY.ModbusMapper/PLCGroup.cs
View file @
780c96d8
using
System
;
using
Misc
;
using
Newtonsoft.Json
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Net
;
...
...
@@ -13,6 +15,7 @@ namespace FLY.Modbus
{
public
class
PLCDevice
{
[
JsonConverter
(
typeof
(
IPEndPointJsonConverter
))]
public
IPEndPoint
EP
{
get
;
set
;
}
}
...
...
Project.FLY.OBJComponents/OBJComponents/Common/FlyData_WarningHistory.cs
View file @
780c96d8
...
...
@@ -118,6 +118,6 @@ namespace FLY.OBJComponents.Common
/// <summary>
/// PLC连接断开
/// </summary>
public
static
ERRNO
ERRNO_PLC_DISCONNECTED
=
new
ERRNO
()
{
Code
=
255
,
Descrption
=
"
收卷
PLC连接断开"
};
public
static
ERRNO
ERRNO_PLC_DISCONNECTED
=
new
ERRNO
()
{
Code
=
255
,
Descrption
=
"PLC连接断开"
};
}
}
Project.FLY.OBJComponents/OBJComponents/Server/ErrorConf.cs
View file @
780c96d8
...
...
@@ -16,7 +16,7 @@ namespace FLY.OBJComponents.Server
#
region
延时推送
MARKNO
const
int
MARKNO_DELAY_ISCONNECTED
=
4
;
#
endregion
string
plcName
;
/// <summary>
/// 需要设置
/// </summary>
...
...
@@ -25,10 +25,11 @@ namespace FLY.OBJComponents.Server
/// 报警系统
/// </summary>
WarningSystem
mWarning
;
public
ErrorConf
(
IPLCProxySystemService
PLCos
,
WarningSystem
mWarning
)
public
ErrorConf
(
IPLCProxySystemService
PLCos
,
WarningSystem
mWarning
,
string
plcName
)
{
this
.
PLCos
=
PLCos
;
this
.
mWarning
=
mWarning
;
this
.
plcName
=
plcName
;
}
#
region
报警
...
...
@@ -129,7 +130,7 @@ namespace FLY.OBJComponents.Server
ERRNO
errno
=
PlcErrNos
.
ERRNO_PLC_DISCONNECTED
;
byte
errcode
=
errno
.
Code
;
string
description
=
errno
.
Descrption
;
string
description
=
$"
{
plcName
}
"
+
errno
.
Descrption
;
mWarning
.
Add
(
errcode
,
description
,
state
);
});
},
TimeSpan
.
FromSeconds
(
3
),
true
,
false
,
this
,
MARKNO_DELAY_ISCONNECTED
,
true
);
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/FLY.Thick.Base.UI.csproj
View file @
780c96d8
...
...
@@ -572,7 +572,7 @@
<PackageReference
Include=
"MahApps.Metro"
>
<Version>
2.0.0-alpha0316
</Version>
</PackageReference>
<PackageReference
Include=
"MahApps.Metro.IconPacks"
>
<PackageReference
Include=
"MahApps.Metro.IconPacks
.Material
"
>
<Version>
3.2.0
</Version>
</PackageReference>
<PackageReference
Include=
"MvvmLight"
>
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgError/PgErrorAllTable.xaml
View file @
780c96d8
...
...
@@ -53,7 +53,7 @@
<StackPanel Orientation="Vertical">
<Grid Style="{StaticResource GridStyle_ButtonShadow}">
<Ellipse Style="{StaticResource backPackStyle}" Fill="White"/>
<iconPacks:PackIconMaterial
Design Kind="Clear
" Style="{StaticResource iconPackStyle}" Foreground="#FFEE3232"/>
<iconPacks:PackIconMaterial
Kind="Close
" Style="{StaticResource iconPackStyle}" Foreground="#FFEE3232"/>
</Grid>
<TextBlock Text="清空" Style="{StaticResource titlePackStyle}"/>
</StackPanel>
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgError/PgErrorTable.xaml
View file @
780c96d8
...
...
@@ -55,7 +55,7 @@
<StackPanel Orientation="Vertical">
<Grid Style="{StaticResource GridStyle_ButtonShadow}">
<Ellipse Style="{StaticResource backPackStyle}" Fill="{StaticResource Color_theme_static}" />
<iconPacks:PackIcon
FontAwesome Kind="InfoSolid
" Style="{StaticResource iconPackStyle}" Foreground="White"/>
<iconPacks:PackIcon
Material Kind="AlphaI
" Style="{StaticResource iconPackStyle}" Foreground="White"/>
</Grid>
<TextBlock Text="IO信息" Style="{StaticResource titlePackStyle}"/>
</StackPanel>
...
...
@@ -82,7 +82,7 @@
<StackPanel Orientation="Vertical">
<Grid Style="{StaticResource GridStyle_ButtonShadow}">
<Ellipse Style="{StaticResource backPackStyle}" Fill="#FFEE3232" />
<iconPacks:PackIconM
odern Kind="Reset
" Style="{StaticResource iconPackStyle}" Foreground="White"/>
<iconPacks:PackIconM
aterial Kind="TrayRemove
" Style="{StaticResource iconPackStyle}" Foreground="White"/>
</Grid>
<TextBlock Text="复位" Style="{StaticResource titlePackStyle}"/>
</StackPanel>
...
...
@@ -95,7 +95,7 @@
<StackPanel Orientation="Vertical">
<Grid Style="{StaticResource GridStyle_ButtonShadow}">
<Ellipse Style="{StaticResource backPackStyle}" Fill="White"/>
<iconPacks:PackIcon
Octicons Kind="
Mute" Style="{StaticResource iconPackStyle}" Foreground="#FFEE3232" />
<iconPacks:PackIcon
Material Kind="Volume
Mute" Style="{StaticResource iconPackStyle}" Foreground="#FFEE3232" />
</Grid>
<TextBlock Text="消音" Style="{StaticResource titlePackStyle}"/>
</StackPanel>
...
...
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