Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VIZ.H2V
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘龙飞
VIZ.H2V
Commits
747892a9
Commit
747892a9
authored
Jul 28, 2022
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 添加算法进程检测
parent
d9a15b44
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
112 additions
and
32 deletions
+112
-32
VIZ.H2V.Domain/Model/Algorithm/AlgorithmProcessModel.cs
+42
-0
VIZ.H2V.Domain/VIZ.H2V.Domain.csproj
+1
-0
VIZ.H2V.Module/NDIMainView/Controller/Hotkey/HotkeyController.cs
+17
-18
VIZ.H2V.Module/NDIMainView/ViewModel/NDIMainViewModel.cs
+10
-7
VIZ.H2V.Module/NDIView/Controller/Algorithm/AlgorithmControllerBase.cs
+3
-0
VIZ.H2V.Module/NDIView/Service/INDIViewService.cs
+1
-1
VIZ.H2V.Module/Setup/Provider/AppSetup_Algorithm.cs
+35
-3
VIZ.H2V.Module/VIZ.H2V.Module.csproj
+1
-1
VIZ.H2V/App.xaml.cs
+2
-2
No files found.
VIZ.H2V.Domain/Model/Algorithm/AlgorithmProcessModel.cs
View file @
747892a9
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
...
@@ -12,6 +13,33 @@ namespace VIZ.H2V.Domain
...
@@ -12,6 +13,33 @@ namespace VIZ.H2V.Domain
/// </summary>
/// </summary>
public
class
AlgorithmProcessModel
:
ModelBase
public
class
AlgorithmProcessModel
:
ModelBase
{
{
public
AlgorithmProcessModel
()
{
lock
(
AllProcessModelList
)
{
AllProcessModelList
.
Add
(
this
);
}
}
/// <summary>
/// 所有的算法进程模型
/// </summary>
public
static
List
<
AlgorithmProcessModel
>
AllProcessModelList
{
get
;
private
set
;
}
=
new
List
<
AlgorithmProcessModel
>();
#
region
ViewKey
--
视图键
private
string
viewKey
;
/// <summary>
/// 视图键
/// </summary>
public
string
ViewKey
{
get
{
return
viewKey
;
}
set
{
viewKey
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
ViewKey
));
}
}
#
endregion
#
region
ProcessID
--
进程
ID
#
region
ProcessID
--
进程
ID
private
int
processID
;
private
int
processID
;
...
@@ -53,5 +81,19 @@ namespace VIZ.H2V.Domain
...
@@ -53,5 +81,19 @@ namespace VIZ.H2V.Domain
}
}
#
endregion
#
endregion
#
region
Process
--
进程信息
private
Process
process
;
/// <summary>
/// 进程信息
/// </summary>
public
Process
Process
{
get
{
return
process
;
}
set
{
process
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
Process
));
}
}
#
endregion
}
}
}
}
VIZ.H2V.Domain/VIZ.H2V.Domain.csproj
View file @
747892a9
...
@@ -60,6 +60,7 @@
...
@@ -60,6 +60,7 @@
<Reference Include="System.Data" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<Compile Include="ApplicationDomainEx.cs" />
<Compile Include="ApplicationDomainEx.cs" />
...
...
VIZ.H2V.Module/NDIMainView/Controller/Hotkey/HotkeyController.cs
View file @
747892a9
...
@@ -76,7 +76,7 @@ namespace VIZ.H2V.Module
...
@@ -76,7 +76,7 @@ namespace VIZ.H2V.Module
service
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
INDIViewService
>(
NDIViewKeys
.
CAM_4
);
service
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
INDIViewService
>(
NDIViewKeys
.
CAM_4
);
}
}
if
(
service
==
null
)
if
(
service
==
null
||
service
.
StrategyMode
==
AlgorithmStrategyMode
.
auto_mode
)
return
false
;
return
false
;
ChangeStrategyContext
context
=
new
ChangeStrategyContext
();
ChangeStrategyContext
context
=
new
ChangeStrategyContext
();
...
@@ -115,7 +115,7 @@ namespace VIZ.H2V.Module
...
@@ -115,7 +115,7 @@ namespace VIZ.H2V.Module
service
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
INDIViewService
>(
NDIViewKeys
.
CAM_4
);
service
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
INDIViewService
>(
NDIViewKeys
.
CAM_4
);
}
}
if
(
service
==
null
)
if
(
service
==
null
||
service
.
StrategyMode
==
AlgorithmStrategyMode
.
center_mode
)
return
false
;
return
false
;
ChangeStrategyContext
context
=
new
ChangeStrategyContext
();
ChangeStrategyContext
context
=
new
ChangeStrategyContext
();
...
@@ -135,21 +135,6 @@ namespace VIZ.H2V.Module
...
@@ -135,21 +135,6 @@ namespace VIZ.H2V.Module
/// <returns>是否处理完成</returns>
/// <returns>是否处理完成</returns>
private
bool
ExecuteManual
(
string
hotkey
)
private
bool
ExecuteManual
(
string
hotkey
)
{
{
// Step 1. 先将当前手动模式的视图切换为自动模式
ApplicationDomainEx
.
ServiceManager
.
GetServiceList
<
INDIViewService
>()
.
Where
(
p
=>
p
.
StrategyMode
==
AlgorithmStrategyMode
.
manual_mode
)
.
ToList
()
.
ForEach
(
p
=>
{
ChangeStrategyContext
cxt
=
new
ChangeStrategyContext
();
cxt
.
Mode
=
AlgorithmStrategyMode
.
auto_mode
;
cxt
.
IsNeedRestart
=
false
;
cxt
.
TriggerScene
=
NDIViewScene
.
Hotkey
;
p
.
ChangeStrategyMode
(
cxt
);
});
// Step 2. 将目标视图切换为手动模式
INDIViewService
service
=
null
;
INDIViewService
service
=
null
;
if
(
string
.
Equals
(
this
.
Support
.
HotkeyConfig
.
ManualCAM1
,
hotkey
))
if
(
string
.
Equals
(
this
.
Support
.
HotkeyConfig
.
ManualCAM1
,
hotkey
))
...
@@ -169,9 +154,23 @@ namespace VIZ.H2V.Module
...
@@ -169,9 +154,23 @@ namespace VIZ.H2V.Module
service
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
INDIViewService
>(
NDIViewKeys
.
CAM_4
);
service
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
INDIViewService
>(
NDIViewKeys
.
CAM_4
);
}
}
if
(
service
==
null
)
if
(
service
==
null
||
service
.
StrategyMode
==
AlgorithmStrategyMode
.
manual_mode
)
return
false
;
return
false
;
// 先将出自身外手动模式的视图切换为自动模式
ApplicationDomainEx
.
ServiceManager
.
GetServiceList
<
INDIViewService
>()
.
Where
(
p
=>
p
.
StrategyMode
==
AlgorithmStrategyMode
.
manual_mode
&&
p
!=
service
)
.
ToList
()
.
ForEach
(
p
=>
{
ChangeStrategyContext
cxt
=
new
ChangeStrategyContext
();
cxt
.
Mode
=
AlgorithmStrategyMode
.
auto_mode
;
cxt
.
IsNeedRestart
=
false
;
cxt
.
TriggerScene
=
NDIViewScene
.
Hotkey
;
p
.
ChangeStrategyMode
(
cxt
);
});
ChangeStrategyContext
context
=
new
ChangeStrategyContext
();
ChangeStrategyContext
context
=
new
ChangeStrategyContext
();
context
.
Mode
=
AlgorithmStrategyMode
.
manual_mode
;
context
.
Mode
=
AlgorithmStrategyMode
.
manual_mode
;
context
.
IsNeedRestart
=
false
;
context
.
IsNeedRestart
=
false
;
...
...
VIZ.H2V.Module/NDIMainView/ViewModel/NDIMainViewModel.cs
View file @
747892a9
...
@@ -286,16 +286,19 @@ namespace VIZ.H2V.Module
...
@@ -286,16 +286,19 @@ namespace VIZ.H2V.Module
if
(
this
.
hotkeyController
==
null
)
if
(
this
.
hotkeyController
==
null
)
return
;
return
;
Window
window
=
Window
.
GetWindow
(
this
.
GetView
<
NDIMainView
>());
WPFHelper
.
BeginInvoke
(()
=>
if
(
window
==
null
)
{
return
;
Window
window
=
Window
.
GetWindow
(
this
.
GetView
<
NDIMainView
>());
if
(
window
==
null
)
return
;
if
(!
window
.
IsActive
)
if
(!
window
.
IsActive
)
return
;
return
;
string
hotkey
=
HotkeyHelper
.
GetHotkey
(
e
);
string
hotkey
=
HotkeyHelper
.
GetHotkey
(
e
);
this
.
hotkeyController
.
Execute
(
hotkey
);
this
.
hotkeyController
.
Execute
(
hotkey
);
});
}
}
}
}
}
}
VIZ.H2V.Module/NDIView/Controller/Algorithm/AlgorithmControllerBase.cs
View file @
747892a9
...
@@ -366,7 +366,10 @@ namespace VIZ.H2V.Module
...
@@ -366,7 +366,10 @@ namespace VIZ.H2V.Module
return
false
;
return
false
;
}
}
// 记录进程模型
this
.
Support
.
ProcessModel
.
ViewKey
=
this
.
Support
.
ViewKey
;
this
.
Support
.
ProcessModel
.
ProcessID
=
proc
.
Id
;
this
.
Support
.
ProcessModel
.
ProcessID
=
proc
.
Id
;
this
.
Support
.
ProcessModel
.
Process
=
proc
;
// 更新缓存
// 更新缓存
this
.
Support
.
ViewConfig
.
ProcessID
=
this
.
Support
.
ProcessModel
.
ProcessID
;
this
.
Support
.
ViewConfig
.
ProcessID
=
this
.
Support
.
ProcessModel
.
ProcessID
;
...
...
VIZ.H2V.Module/NDIView/Service/INDIViewService.cs
View file @
747892a9
...
@@ -42,7 +42,7 @@ namespace VIZ.H2V.Module
...
@@ -42,7 +42,7 @@ namespace VIZ.H2V.Module
/// <summary>
/// <summary>
/// NDI视图状态
/// NDI视图状态
/// </summary>
/// </summary>
NDIViewStatus
ViewStatus
{
get
;
}
NDIViewStatus
ViewStatus
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 加载样式
/// 加载样式
...
...
VIZ.H2V.Module/Setup/Provider/AppSetup_
Stop
Algorithm.cs
→
VIZ.H2V.Module/Setup/Provider/AppSetup_Algorithm.cs
View file @
747892a9
...
@@ -16,14 +16,14 @@ using VIZ.H2V.Connection;
...
@@ -16,14 +16,14 @@ using VIZ.H2V.Connection;
namespace
VIZ.H2V.Module
namespace
VIZ.H2V.Module
{
{
/// <summary>
/// <summary>
/// 应用程序启动 --
停止算法
/// 应用程序启动 --
算法进程
/// </summary>
/// </summary>
public
class
AppSetup_
Stop
Algorithm
:
AppSetupBase
public
class
AppSetup_Algorithm
:
AppSetupBase
{
{
/// <summary>
/// <summary>
/// 日志
/// 日志
/// </summary>
/// </summary>
private
static
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
AppSetup_
Stop
Algorithm
));
private
static
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
AppSetup_Algorithm
));
/// <summary>
/// <summary>
/// 描述
/// 描述
...
@@ -37,6 +37,8 @@ namespace VIZ.H2V.Module
...
@@ -37,6 +37,8 @@ namespace VIZ.H2V.Module
/// <returns>是否成功执行</returns>
/// <returns>是否成功执行</returns>
public
override
bool
Setup
(
AppSetupContext
context
)
public
override
bool
Setup
(
AppSetupContext
context
)
{
{
ApplicationDomainEx
.
LoopManager
.
Register
(
"AppSetup_Algorithm"
,
3
,
this
.
processCheck
);
return
true
;
return
true
;
}
}
...
@@ -67,5 +69,35 @@ namespace VIZ.H2V.Module
...
@@ -67,5 +69,35 @@ namespace VIZ.H2V.Module
Task
.
WaitAll
(
list
.
ToArray
());
Task
.
WaitAll
(
list
.
ToArray
());
}
}
/// <summary>
/// 进程检测
/// </summary>
private
void
processCheck
()
{
lock
(
AlgorithmProcessModel
.
AllProcessModelList
)
{
foreach
(
AlgorithmProcessModel
model
in
AlgorithmProcessModel
.
AllProcessModelList
)
{
if
(
model
.
ProcessID
<=
0
||
model
.
Process
==
null
)
continue
;
if
(!
model
.
Process
.
HasExited
)
continue
;
model
.
ProcessID
=
0
;
model
.
Process
=
null
;
WPFHelper
.
BeginInvoke
(()
=>
{
INDIViewService
service
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
INDIViewService
>(
model
.
ViewKey
);
if
(
service
==
null
)
return
;
service
.
ViewStatus
=
NDIViewStatus
.
Stop
;
});
}
}
}
}
}
}
}
VIZ.H2V.Module/VIZ.H2V.Module.csproj
View file @
747892a9
...
@@ -194,7 +194,7 @@
...
@@ -194,7 +194,7 @@
<Compile Include="NDIView\VieweModel\NDIViewModel.Message.cs" />
<Compile Include="NDIView\VieweModel\NDIViewModel.Message.cs" />
<Compile Include="NDIView\VieweModel\NDIViewModel.Property.cs" />
<Compile Include="NDIView\VieweModel\NDIViewModel.Property.cs" />
<Compile Include="NDIView\VieweModel\NDIViewModel.cs" />
<Compile Include="NDIView\VieweModel\NDIViewModel.cs" />
<Compile Include="Setup\Provider\AppSetup_
Stop
Algorithm.cs" />
<Compile Include="Setup\Provider\AppSetup_Algorithm.cs" />
<Compile Include="Setup\Provider\AppSetup_InitUDP.cs" />
<Compile Include="Setup\Provider\AppSetup_InitUDP.cs" />
<Compile Include="SystemSetting\ViewModel\HotkeySettingPanelViewModel.cs" />
<Compile Include="SystemSetting\ViewModel\HotkeySettingPanelViewModel.cs" />
<Compile Include="SystemSetting\ViewModel\AboutPanelViewModel.cs" />
<Compile Include="SystemSetting\ViewModel\AboutPanelViewModel.cs" />
...
...
VIZ.H2V/App.xaml.cs
View file @
747892a9
...
@@ -28,8 +28,8 @@ namespace VIZ.H2V
...
@@ -28,8 +28,8 @@ namespace VIZ.H2V
AppSetup
.
AppendSetup
(
new
AppSetup_InitExcel
());
AppSetup
.
AppendSetup
(
new
AppSetup_InitExcel
());
// 初始化NDI
// 初始化NDI
AppSetup
.
AppendSetup
(
new
AppSetup_InitNDI
());
AppSetup
.
AppendSetup
(
new
AppSetup_InitNDI
());
//
停止算法
//
初始化算法进程
AppSetup
.
AppendSetup
(
new
AppSetup_
Stop
Algorithm
());
AppSetup
.
AppendSetup
(
new
AppSetup_Algorithm
());
// 初始化UDP
// 初始化UDP
AppSetup
.
AppendSetup
(
new
AppSetup_InitUDP
());
AppSetup
.
AppendSetup
(
new
AppSetup_InitUDP
());
...
...
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