Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VIZ.Package
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.Package
Commits
1435e982
Commit
1435e982
authored
Feb 07, 2023
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加预览重启
parent
0f4c4d27
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
111 additions
and
42 deletions
+111
-42
VIZ.Package.Domain/ApplicationDomainEx.cs
+5
-0
VIZ.Package.Domain/Message/Viz/VizPreviewRestartMessage.cs
+16
-0
VIZ.Package.Domain/VIZ.Package.Domain.csproj
+1
-0
VIZ.Package.Module.Resource/Icons/preview_refresh_32x32.png
+0
-0
VIZ.Package.Module.Resource/VIZ.Package.Module.Resource.csproj
+4
-0
VIZ.Package.Module/Main/ViewModel/MainTopViewModel.cs
+10
-0
VIZ.Package.Module/Preview/VizPreview/Controller/VizPreviewController.cs
+5
-6
VIZ.Package.Module/Preview/VizPreview/View/VizPreviewView.xaml
+6
-0
VIZ.Package.Module/Preview/VizPreview/ViewModel/VizPreviewViewModel.cs
+63
-35
VIZ.Package.Module/Task/PackageTask/ViewModel/PackageTaskViewModel.cs
+1
-1
No files found.
VIZ.Package.Domain/ApplicationDomainEx.cs
View file @
1435e982
...
...
@@ -69,6 +69,11 @@ namespace VIZ.Package.Domain
// =============================================================
/// <summary>
/// Viz预览是否可用
/// </summary>
public
static
bool
IsVizPreviewReadly
{
get
;
set
;
}
/// <summary>
/// Viz配置
/// </summary>
public
static
VizConfigEntity
VizConfig
{
get
;
set
;
}
...
...
VIZ.Package.Domain/Message/Viz/VizPreviewRestartMessage.cs
0 → 100644
View file @
1435e982
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.Package.Domain
{
/// <summary>
/// Viz引擎重启消息
/// </summary>
public
class
VizPreviewRestartMessage
{
}
}
VIZ.Package.Domain/VIZ.Package.Domain.csproj
View file @
1435e982
...
...
@@ -94,6 +94,7 @@
<Compile Include="Message\Project\ProjectCloseMessage.cs" />
<Compile Include="Message\Project\ProjectOpenMessage.cs" />
<Compile Include="Message\Viz\VizPreviewReadyMessage.cs" />
<Compile Include="Message\Viz\VizPreviewRestartMessage.cs" />
<Compile Include="Model\Conn\ConnGroupModel.cs" />
<Compile Include="Model\Conn\ConnModel.cs" />
<Compile Include="Core\IPackageEndpointManager.cs" />
...
...
VIZ.Package.Module.Resource/Icons/preview_refresh_32x32.png
0 → 100644
View file @
1435e982
875 Bytes
VIZ.Package.Module.Resource/VIZ.Package.Module.Resource.csproj
View file @
1435e982
...
...
@@ -249,5 +249,8 @@
<ItemGroup>
<Resource Include="Icons\top_icon_about_20x20.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\preview_refresh_32x32.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
VIZ.Package.Module/Main/ViewModel/MainTopViewModel.cs
View file @
1435e982
...
...
@@ -52,6 +52,7 @@ namespace VIZ.Package.Module
private
void
InitMessage
()
{
ApplicationDomainEx
.
MessageManager
.
Register
<
VizPreviewReadyMessage
>(
this
,
this
.
OnVizPreviewReadyMessage
);
ApplicationDomainEx
.
MessageManager
.
Register
<
VizPreviewRestartMessage
>(
this
,
this
.
OnVizPreviewRestartMessage
);
ApplicationDomainEx
.
MessageManager
.
Register
<
ApplicationClosingMessage
>(
this
,
this
.
OnApplicationClosingMessage
);
}
...
...
@@ -361,6 +362,15 @@ namespace VIZ.Package.Module
}
/// <summary>
/// 预览引擎重启消息
/// </summary>
/// <param name="msg">消息</param>
private
void
OnVizPreviewRestartMessage
(
VizPreviewRestartMessage
msg
)
{
this
.
IsVizPreviewReady
=
false
;
}
/// <summary>
/// 应用程序关闭前消息
/// </summary>
/// <param name="msg">消息</param>
...
...
VIZ.Package.Module/Preview/VizPreview/Controller/VizPreviewController.cs
View file @
1435e982
...
...
@@ -37,8 +37,6 @@ namespace VIZ.Package.Module
/// <param name="conn">连接模型</param>
public
void
StartVizEngine
(
VizPreviewView
view
,
string
path
,
ConnModel
conn
)
{
this
.
ViewModel
.
IsEngineReady
=
false
;
var
dpi
=
WPFHelper
.
GetDpiByGraphics
();
int
width
=
(
int
)(
view
.
host
.
ActualWidth
*
(
dpi
.
X
/
96d
));
int
height
=
(
int
)(
view
.
host
.
ActualHeight
*
(
dpi
.
Y
/
96d
));
...
...
@@ -83,19 +81,19 @@ namespace VIZ.Package.Module
// Step 3. 发送渲染命令
do
{
System
.
Threading
.
Thread
.
Sleep
(
1
000
);
System
.
Threading
.
Thread
.
Sleep
(
2
000
);
if
(
vizConfig
.
EngineFullType
==
EngineFullType
.
VIZ_Eng3
)
{
string
cmd
=
$"RENDERER WINDOW_OPEN_ON_PARENT 0x
{
hWnd
.
ToString
(
"X6"
)}
{
width
}
{
height
}
ONAIR"
;
conn
.
EndpointManager
.
Send
(
cmd
);
string
result
=
conn
.
EndpointManager
.
Request
(
cmd
);
}
else
if
(
string
.
IsNullOrWhiteSpace
(
ApplicationDomainEx
.
VizPreviewRenderer
)
&&
vizConfig
.
EngineFullType
==
EngineFullType
.
VIZ_Eng4
)
{
// 创建 EDITOR
ApplicationDomainEx
.
VizPreviewRenderer
=
conn
.
EndpointManager
.
Request
(
"EDITOR CREATE RENDERER"
);
string
cmd
=
$"
{
ApplicationDomainEx
.
VizPreviewRenderer
}
WINDOW_OPEN_ON_PARENT 0x
{
hWnd
.
ToString
(
"X6"
)}
{
width
}
{
height
}
ONAIR"
;
conn
.
EndpointManager
.
Send
(
cmd
);
string
result
=
conn
.
EndpointManager
.
Request
(
cmd
);
}
WPFHelper
.
Invoke
(()
=>
...
...
@@ -108,7 +106,8 @@ namespace VIZ.Package.Module
// Step 4. 启动完成
WPFHelper
.
BeginInvoke
(()
=>
{
this
.
ViewModel
.
IsEngineReady
=
true
;
// 设置
ApplicationDomainEx
.
IsVizPreviewReadly
=
true
;
// 发送引擎嵌入完成消息
VizPreviewReadyMessage
msg
=
new
VizPreviewReadyMessage
();
...
...
VIZ.Package.Module/Preview/VizPreview/View/VizPreviewView.xaml
View file @
1435e982
...
...
@@ -52,6 +52,12 @@
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center">
<fcommon:IconButton Icon="/VIZ.Package.Module.Resource;component/Icons/preview_refresh_32x32.png"
ToolTip="重启预览引擎"
Style="{StaticResource IconButton_Menu_Mask}" Margin="0,0,40,0"
IconWidth="16" IconHeight="16" Height="30" Width="30"
Command="{Binding Path=RestartPreviewCommand}"></fcommon:IconButton>
<CheckBox Content="TA" Style="{StaticResource CheckBox_Preview_TA}" Margin="5,0,0,0"
IsChecked="{Binding Path=IsShowTS,Mode=TwoWay}">
</CheckBox>
...
...
VIZ.Package.Module/Preview/VizPreview/ViewModel/VizPreviewViewModel.cs
View file @
1435e982
...
...
@@ -42,7 +42,8 @@ namespace VIZ.Package.Module
private
void
initCommand
()
{
this
.
LoadedCommand
=
new
VCommand
(
this
.
Loaded
);
this
.
WindowHostSizeChangedCommand
=
new
VCommand
<
System
.
Windows
.
SizeChangedEventArgs
>(
this
.
WindowHostSizeChanged
);
this
.
WindowHostSizeChangedCommand
=
new
VCommand
<
SizeChangedEventArgs
>(
this
.
WindowHostSizeChanged
);
this
.
RestartPreviewCommand
=
new
VCommand
(
this
.
RestartPreview
);
this
.
PlayCommand
=
new
VCommand
(
this
.
Play
);
this
.
ContinueCommand
=
new
VCommand
(
this
.
Continue
);
this
.
StopCommand
=
new
VCommand
(
this
.
Stop
);
...
...
@@ -74,20 +75,6 @@ namespace VIZ.Package.Module
// Property
// ================================================================================
#
region
IsEngineReady
--
引擎是否准备完毕
private
bool
isEngineReady
;
/// <summary>
/// 引擎是否准备完毕
/// </summary>
public
bool
IsEngineReady
{
get
{
return
isEngineReady
;
}
set
{
isEngineReady
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
IsEngineReady
));
}
}
#
endregion
#
region
IsShowTS
--
是否显示安全框
private
bool
isShowTS
;
...
...
@@ -187,6 +174,10 @@ namespace VIZ.Package.Module
if
(
view
==
null
)
return
;
// 设置预览状态不可用
ApplicationDomainEx
.
IsVizPreviewReadly
=
false
;
// 启动引擎嵌入线程
ThreadHelper
.
SafeRun
(()
=>
{
// 等待能正确获取到界面宽度时再嵌入VIZ引擎
...
...
@@ -215,12 +206,12 @@ namespace VIZ.Package.Module
/// <summary>
/// 宿主容器大小改变命令
/// </summary>
public
VCommand
<
S
ystem
.
Windows
.
S
izeChangedEventArgs
>
WindowHostSizeChangedCommand
{
get
;
set
;
}
public
VCommand
<
SizeChangedEventArgs
>
WindowHostSizeChangedCommand
{
get
;
set
;
}
/// <summary>
/// 宿主容器大小改变
/// </summary>
private
void
WindowHostSizeChanged
(
S
ystem
.
Windows
.
S
izeChangedEventArgs
e
)
private
void
WindowHostSizeChanged
(
SizeChangedEventArgs
e
)
{
VizConfigEntity
config
=
ApplicationDomainEx
.
VizConfig
;
ConnModel
conn
=
ApplicationDomainEx
.
PreviewConn
;
...
...
@@ -247,6 +238,45 @@ namespace VIZ.Package.Module
#
endregion
#
region
RestartPreviewCommand
--
重启预览命令
/// <summary>
/// 重启预览命令
/// </summary>
public
VCommand
RestartPreviewCommand
{
get
;
set
;
}
/// <summary>
/// 重启预览
/// </summary>
private
void
RestartPreview
()
{
// 设置预览引擎未准备完毕
ApplicationDomainEx
.
IsVizPreviewReadly
=
false
;
// 发送Viz引擎重启消息
VizPreviewRestartMessage
msg
=
new
VizPreviewRestartMessage
();
ApplicationDomainEx
.
MessageManager
.
Send
(
msg
);
// 关闭引擎进程
try
{
ApplicationDomainEx
.
VizPreviewProcess
.
Kill
();
}
catch
(
Exception
ex
)
{
log
.
Error
(
ex
);
}
// 启动引擎启动线程
ThreadHelper
.
SafeRun
(()
=>
{
// 启动引擎
this
.
StartVizEngine
();
});
}
#
endregion
#
region
PlayCommand
--
播放命令
/// <summary>
...
...
@@ -326,7 +356,7 @@ namespace VIZ.Package.Module
private
void
ShowRGB
()
{
// 引擎未准备好 || 当前没有选中的节目单项目 则不处理
if
(!
this
.
IsEngineRead
y
||
ApplicationDomainEx
.
CurrentPage
==
null
)
if
(!
ApplicationDomainEx
.
IsVizPreviewReadl
y
||
ApplicationDomainEx
.
CurrentPage
==
null
)
return
;
this
.
vizCommandService
.
ShowRGB
(
ApplicationDomainEx
.
PreviewConn
);
...
...
@@ -347,7 +377,7 @@ namespace VIZ.Package.Module
private
void
ShowKey
()
{
// 引擎未准备好 || 当前没有选中的节目单项目 则不处理
if
(!
this
.
IsEngineRead
y
||
ApplicationDomainEx
.
CurrentPage
==
null
)
if
(!
ApplicationDomainEx
.
IsVizPreviewReadl
y
||
ApplicationDomainEx
.
CurrentPage
==
null
)
return
;
this
.
vizCommandService
.
ShowKey
(
ApplicationDomainEx
.
PreviewConn
);
...
...
@@ -368,7 +398,7 @@ namespace VIZ.Package.Module
private
void
ShowKeyPreview
()
{
// 引擎未准备好 || 当前没有选中的节目单项目 则不处理
if
(!
this
.
IsEngineRead
y
||
ApplicationDomainEx
.
CurrentPage
==
null
)
if
(!
ApplicationDomainEx
.
IsVizPreviewReadl
y
||
ApplicationDomainEx
.
CurrentPage
==
null
)
return
;
this
.
vizCommandService
.
ShowKeyPreview
(
ApplicationDomainEx
.
PreviewConn
);
...
...
@@ -387,7 +417,7 @@ namespace VIZ.Package.Module
private
void
OnPageOpenMessage
(
PageOpenMessage
msg
)
{
// 引擎未准备好 || 当前没有选中的节目单项目 则不处理
if
(!
this
.
IsEngineRead
y
||
ApplicationDomainEx
.
CurrentPage
==
null
)
if
(!
ApplicationDomainEx
.
IsVizPreviewReadl
y
||
ApplicationDomainEx
.
CurrentPage
==
null
)
return
;
this
.
vizCommandService
.
SetObject
(
ApplicationDomainEx
.
PreviewConn
,
msg
.
Page
.
ScenePath
,
VizLayer
.
MAIN_LAYER
);
...
...
@@ -428,7 +458,7 @@ namespace VIZ.Package.Module
private
void
OnControlFieldChangedMessage
(
ControlFieldChangedMessage
msg
)
{
// 引擎未准备好 || 当前没有选中的节目单项目 则不处理
if
(!
this
.
IsEngineRead
y
||
ApplicationDomainEx
.
CurrentPage
==
null
)
if
(!
ApplicationDomainEx
.
IsVizPreviewReadl
y
||
ApplicationDomainEx
.
CurrentPage
==
null
)
return
;
// 缺少信息
...
...
@@ -449,7 +479,7 @@ namespace VIZ.Package.Module
private
void
OnControlListFieldChangedMessage
(
ControlListFieldChangedMessage
msg
)
{
// 引擎未准备好 || 当前没有选中的节目单项目 则不处理
if
(!
this
.
IsEngineRead
y
||
ApplicationDomainEx
.
CurrentPage
==
null
)
if
(!
ApplicationDomainEx
.
IsVizPreviewReadl
y
||
ApplicationDomainEx
.
CurrentPage
==
null
)
return
;
// 缺少信息
...
...
@@ -477,14 +507,11 @@ namespace VIZ.Package.Module
return
;
VizConfigEntity
vizConfig
=
ApplicationDomainEx
.
VizConfig
;
ConnGroupModel
connGroup
=
ApplicationDomainEx
.
PreviewConnGroup
;
if
(
connGroup
==
null
)
{
connGroup
=
new
ConnGroupModel
();
connGroup
.
Name
=
"预览"
;
connGroup
.
IsEnabled
=
true
;
connGroup
.
IsLocalPreview
=
true
;
}
ConnGroupModel
connGroup
=
new
ConnGroupModel
();
connGroup
.
Name
=
"预览"
;
connGroup
.
IsEnabled
=
true
;
connGroup
.
IsLocalPreview
=
true
;
ConnModel
conn
=
ApplicationDomainEx
.
PreviewConn
;
if
(
conn
!=
null
)
{
...
...
@@ -574,7 +601,7 @@ namespace VIZ.Package.Module
private
void
IsShowTSChanged
()
{
// 引擎未准备好 || 当前没有选中的节目单项目 则不处理
if
(!
this
.
IsEngineRead
y
||
ApplicationDomainEx
.
CurrentPage
==
null
)
if
(!
ApplicationDomainEx
.
IsVizPreviewReadl
y
||
ApplicationDomainEx
.
CurrentPage
==
null
)
return
;
this
.
vizCommandService
.
ShowTS
(
ApplicationDomainEx
.
PreviewConn
,
this
.
IsShowTS
);
...
...
@@ -586,7 +613,7 @@ namespace VIZ.Package.Module
private
void
IsShowSAChanged
()
{
// 引擎未准备好 || 当前没有选中的节目单项目 则不处理
if
(!
this
.
IsEngineRead
y
||
ApplicationDomainEx
.
CurrentPage
==
null
)
if
(!
ApplicationDomainEx
.
IsVizPreviewReadl
y
||
ApplicationDomainEx
.
CurrentPage
==
null
)
return
;
this
.
vizCommandService
.
ShowSA
(
ApplicationDomainEx
.
PreviewConn
,
this
.
IsShowSA
);
...
...
@@ -598,10 +625,10 @@ namespace VIZ.Package.Module
private
void
IsShowBBChanged
()
{
// 引擎未准备好 || 当前没有选中的节目单项目 则不处理
if
(!
this
.
IsEngineRead
y
||
ApplicationDomainEx
.
CurrentPage
==
null
)
if
(!
ApplicationDomainEx
.
IsVizPreviewReadl
y
||
ApplicationDomainEx
.
CurrentPage
==
null
)
return
;
this
.
vizCommandService
.
ShowBB
(
ApplicationDomainEx
.
PreviewConn
,
this
.
IsShowBB
);
}
}
}
}
\ No newline at end of file
VIZ.Package.Module/Task/PackageTask/ViewModel/PackageTaskViewModel.cs
View file @
1435e982
...
...
@@ -228,7 +228,7 @@ namespace VIZ.Package.Module
List
<
string
>
updateMessage
=
new
List
<
string
>();
// 更新预览
if
(
task
.
IsPreviewEnabled
&&
ApplicationDomainEx
.
PreviewConn
!=
null
&&
ApplicationDomainEx
.
PreviewConn
.
IsConnected
)
if
(
task
.
IsPreviewEnabled
&&
ApplicationDomainEx
.
IsVizPreviewReadly
&&
ApplicationDomainEx
.
PreviewConn
!=
null
&&
ApplicationDomainEx
.
PreviewConn
.
IsConnected
)
{
this
.
ExecuteTaskPreviewUpdate
(
task
,
updateMessage
);
}
...
...
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