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
9512dcc5
Commit
9512dcc5
authored
4 years ago
by
潘栩锋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 断开连接后,3min内可以重新自动扫描
parent
35f80508
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
33 deletions
+40
-33
GM_Base.cs
Project.FLY.Thick.Base/FLY.Thick.Base/Server/GM_Base.cs
+40
-33
No files found.
Project.FLY.Thick.Base/FLY.Thick.Base/Server/GM_Base.cs
View file @
9512dcc5
...
...
@@ -7,6 +7,8 @@ using System.ComponentModel;
using
FlyADBase
;
using
FLY.Thick.Base.Common
;
using
FLY.Thick.Base.IService
;
using
System.Diagnostics
;
namespace
FLY.Thick.Base.Server
{
public
abstract
class
GM_Base
:
IGageMode
,
INotifyErrorArisen
...
...
@@ -241,7 +243,9 @@ namespace FLY.Thick.Base.Server
{
GM_AutoScan
mGMAutoScan
;
DynArea
mDynArea
;
DateTime
dt_lastscan
=
DateTime
.
MinValue
;
Stopwatch
stopwatch
=
new
Stopwatch
();
bool
isReadyToAutoScan
=
false
;
public
GM_Disconnected
(
FlyAD7
flyad
)
:
base
(
flyad
)
{
...
...
@@ -257,34 +261,50 @@ namespace FLY.Thick.Base.Server
void
mDynArea_PropertyChanged
(
object
sender
,
PropertyChangedEventArgs
e
)
{
if
(
e
.
PropertyName
==
"FLYADIsConnect"
)
if
(
e
.
PropertyName
==
nameof
(
mDynArea
.
FLYADIsConnect
)
)
{
if
(!
mDynArea
.
FLYADIsConnect
)
{
//AD卡已经断开
//如果刚才在扫描,在1分钟内,AD卡连接后,重新执行扫描动作
if
(
mDynArea
.
ControllerState
==
CTRL_STATE
.
SCAN
)
if
(
mDynArea
.
ControllerState
==
CTRL_STATE
.
SCAN
||
mDynArea
.
ControllerState
==
CTRL_STATE
.
AUTOSCAN
)
{
dt_lastscan
=
DateTime
.
Now
;
//之前在扫描中
isReadyToAutoScan
=
true
;
stopwatch
.
Restart
();
}
else
{
isReadyToAutoScan
=
false
;
stopwatch
.
Stop
();
}
Start
();
}
else
{
if
(
IsRunning
)
//AD盒已经重新连接上
if
(
IsRunning
)
//还在 CTRL_STATE.DISCONNECTED
{
if
((
DateTime
.
Now
-
dt_lastscan
)
<
TimeSpan
.
FromMinutes
(
1
))
//1min 内重新扫描
{
//断开连接,到现在重新连上,只过了30秒,重新执行扫描
mGMAutoScan
.
Start
(
5
);
if
(
isReadyToAutoScan
)
{
//需要自动扫描
if
(
stopwatch
.
Elapsed
>
TimeSpan
.
FromMinutes
(
3
))
{
isReadyToAutoScan
=
false
;
stopwatch
.
Stop
();
//断开连接,到现在重新连上,只过了3min,重新执行扫描
mGMAutoScan
.
Start
(
5
);
}
else
{
Stop
();
}
}
else
else
{
Stop
();
}
}
dt_lastscan
=
DateTime
.
MinValue
;
}
}
}
...
...
@@ -296,30 +316,17 @@ namespace FLY.Thick.Base.Server
public
override
void
Stop
()
{
IsRunning
=
false
;
isReadyToAutoScan
=
false
;
stopwatch
.
Stop
();
}
}
public
class
GM_AutoScan
:
GM_Base
{
public
int
Delay
{
get
;
set
;
}
private
int
counter
=
5
;
public
int
Counter
{
get
{
return
counter
;
public
int
Delay
{
get
;
set
;
}
public
int
Counter
{
get
;
set
;
}
=
5
;
}
set
{
if
(
counter
!=
value
)
{
counter
=
value
;
NotifyPropertyChanged
(
"Counter"
);
}
}
}
Action
ReScan
;
DateTime
dtLast
=
DateTime
.
MinValue
;
public
GM_AutoScan
(
FlyAD7
flyad
)
...
...
@@ -395,7 +402,7 @@ namespace FLY.Thick.Base.Server
void
GM_Pause_PropertyChanged
(
object
sender
,
PropertyChangedEventArgs
e
)
{
if
(
e
.
PropertyName
==
"Enable"
)
if
(
e
.
PropertyName
==
nameof
(
Enable
)
)
{
if
(
Enable
)
{
...
...
@@ -442,7 +449,7 @@ namespace FLY.Thick.Base.Server
}
void
mDynArea_PropertyChanged
(
object
sender
,
PropertyChangedEventArgs
e
)
{
if
(
e
.
PropertyName
==
"DataValid"
)
if
(
e
.
PropertyName
==
nameof
(
mDynArea
.
DataValid
)
)
{
if
(
Enable
)
update_datavalid
();
...
...
This diff is collapsed.
Click to expand it.
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