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
2e998d28
Commit
2e998d28
authored
Jul 07, 2021
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 FlyADIODefine 使用方式,确保一个环境只有 一个FlyADIODefine
parent
c8c14e01
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
64 deletions
+33
-64
WdIOTip.xaml.cs
....FLY.Thick.Base/FLY.Thick.Base.UI/PgError/WdIOTip.xaml.cs
+27
-27
FlyAdIoDefineServiceClient.cs
....Base/FLY.Thick.Base/Client/FlyAdIoDefineServiceClient.cs
+0
-36
FlyADIODefine.cs
...ect.FLY.Thick.Base/FLY.Thick.Base/Common/FlyADIODefine.cs
+6
-1
No files found.
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgError/WdIOTip.xaml.cs
View file @
2e998d28
using
FLY.Thick.Base.IService
;
using
FLY.Thick.Base.Common
;
using
FLY.Thick.Base.IService
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
...
...
@@ -33,7 +34,7 @@ namespace FLY.Thick.Base.UI
public
void
Init
(
IFlyAdIoDefineService
iODefineService
,
ITDGageService
gageService
)
{
viewModel
=
new
WdIoTipVm
();
viewModel
.
Init
(
iODefineService
,
gageService
);
viewModel
.
Init
(
iODefineService
,
gageService
.
DynArea
);
this
.
DataContext
=
viewModel
;
}
...
...
@@ -53,9 +54,9 @@ namespace FLY.Thick.Base.UI
}
public
void
Init
(
IFlyAdIoDefineService
iODefineService
,
ITDGageService
gageService
)
public
void
Init
(
IFlyAdIoDefineService
iODefineService
,
DynArea
dynArea
)
{
this
.
dynArea
=
gageService
.
D
ynArea
;
this
.
dynArea
=
d
ynArea
;
this
.
iODefineService
=
iODefineService
;
for
(
int
i
=
0
;
i
<
12
;
i
++)
{
...
...
@@ -86,23 +87,25 @@ namespace FLY.Thick.Base.UI
update
();
}
Misc
.
BindingOperations
.
SetBinding
(
dynArea
,
nameof
(
dynArea
.
IStatus
),
()
=>
{
for
(
int
i
=
0
;
i
<
IStatus
.
Count
();
i
++)
{
IStatus
[
i
].
IsOn
=
!
Misc
.
MyBase
.
CHECKBIT
(
dynArea
.
IStatus
,
i
);
}
});
Misc
.
BindingOperations
.
SetBinding
(
dynArea
,
nameof
(
dynArea
.
OStatus
),
()
=>
{
for
(
int
i
=
0
;
i
<
OStatus
.
Count
();
i
++)
{
OStatus
[
i
].
IsOn
=
!
Misc
.
MyBase
.
CHECKBIT
(
dynArea
.
OStatus
,
i
);
}
});
Misc
.
BindingOperations
.
SetBinding
(
dynArea
,
nameof
(
dynArea
.
IStatus
),
updateIsOn_In
);
Misc
.
BindingOperations
.
SetBinding
(
dynArea
,
nameof
(
dynArea
.
OStatus
),
updateIsOn_Out
);
}
void
updateIsOn_In
()
{
for
(
int
i
=
0
;
i
<
IStatus
.
Count
();
i
++)
{
IStatus
[
i
].
IsOn
=
!
Misc
.
MyBase
.
CHECKBIT
(
dynArea
.
IStatus
,
i
);
}
}
void
updateIsOn_Out
()
{
for
(
int
i
=
0
;
i
<
OStatus
.
Count
();
i
++)
{
OStatus
[
i
].
IsOn
=
!
Misc
.
MyBase
.
CHECKBIT
(
dynArea
.
OStatus
,
i
);
}
}
private
void
Client_PropertyChanged
(
object
sender
,
System
.
ComponentModel
.
PropertyChangedEventArgs
e
)
{
var
client
=
this
.
iODefineService
as
FObjBase
.
FObjServiceClient
;
...
...
@@ -129,6 +132,9 @@ namespace FLY.Thick.Base.UI
update
(
IODefine
.
IOTYPE
.
Input
,
IStatus
,
reponse
.
InCount
,
list
);
update
(
IODefine
.
IOTYPE
.
Output
,
OStatus
,
reponse
.
OutCount
,
list
);
updateIsOn_In
();
updateIsOn_Out
();
},
this
);
}
...
...
@@ -205,25 +211,19 @@ namespace FLY.Thick.Base.UI
}
public
class
WdIoTipVmUt
:
INotifyPropertyChanged
public
class
WdIoTipVmUt
:
WdIoTipVm
{
public
event
PropertyChangedEventHandler
PropertyChanged
;
public
ObservableCollection
<
FlyAdIoStatus
>
IStatus
{
get
;
}
=
new
ObservableCollection
<
FlyAdIoStatus
>();
public
ObservableCollection
<
FlyAdIoStatus
>
OStatus
{
get
;
}
=
new
ObservableCollection
<
FlyAdIoStatus
>();
public
WdIoTipVmUt
()
{
for
(
int
i
=
0
;
i
<
1
6
;
i
++)
for
(
int
i
=
0
;
i
<
1
2
;
i
++)
{
IStatus
.
Add
(
new
FlyAdIoStatus
()
{
Number
=
$"i
{
i
+
1
}
"
});
};
for
(
int
i
=
0
;
i
<
8
;
i
++)
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
OStatus
.
Add
(
new
FlyAdIoStatus
()
{
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Client/FlyAdIoDefineServiceClient.cs
View file @
2e998d28
...
...
@@ -33,45 +33,9 @@ namespace FLY.Thick.Base.Client
/// </summary>
/// <param name="asyncDelegate"></param>
/// <param name="asyncContext"></param>
[
Call
(
typeof
(
List
<
IODefine
>))]
public
void
GetIODefine
(
AsyncCBHandler
asyncDelegate
,
object
asyncContext
)
{
Call
(
nameof
(
GetIODefine
),
null
,
asyncDelegate
,
asyncContext
);
}
}
/// <summary>
/// 输入输出口描述
/// </summary>
public
class
IODefine
{
/// <summary>
/// 输入口?输出口?
/// </summary>
public
enum
IOTYPE
{
/// <summary>
/// 输入口
/// </summary>
Input
,
/// <summary>
/// 输出口
/// </summary>
Output
};
/// <summary>
/// 输入口?输出口?
/// </summary>
public
IOTYPE
IoType
;
/// <summary>
/// 序号,从0开始排列
/// </summary>
public
int
Index
;
/// <summary>
/// 功能表述
/// </summary>
public
string
Description
;
}
}
Project.FLY.Thick.Base/FLY.Thick.Base/Common/FlyADIODefine.cs
View file @
2e998d28
...
...
@@ -12,10 +12,15 @@ namespace FLY.Thick.Base.Common
/// </summary>
public
class
FlyADIODefine
:
IFlyAdIoDefineService
{
protected
static
FlyADIODefine
instance
;
public
static
void
SetInstance
(
FlyADIODefine
flyADIODefine
)
{
instance
=
flyADIODefine
;
}
/// <summary>
/// 子类 需要 重新 把子类对象 赋值给 Instance, 确保整个环境只用一个版本的 单例
/// </summary>
public
static
FlyADIODefine
Instance
{
get
;
set
;
}
=
new
FlyADIODefine
()
;
public
static
FlyADIODefine
Instance
=>
instance
;
#
region
输入口
/// <summary>
...
...
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