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
4db1bb43
Commit
4db1bb43
authored
Mar 21, 2023
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
命令模板
parent
667eea85
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
834 additions
and
11 deletions
+834
-11
VIZ.Package.Domain/Enum/ModulePluginIds.cs
+5
-0
VIZ.Package.Domain/Enum/ViewServiceKeys.cs
+5
-0
VIZ.Package.Domain/Message/Page/PageSaveAsMessage.cs
+19
-0
VIZ.Package.Domain/Message/Page/PageSaveMessage.cs
+20
-0
VIZ.Package.Domain/VIZ.Package.Domain.csproj
+2
-0
VIZ.Package.Module/Control/Controller/ControlController.cs
+56
-4
VIZ.Package.Module/ControlObject/FieldEdit/ViewModel/FieldEditViewModel.cs
+18
-7
VIZ.Package.Module/PageCommand/Controller/PageCommandController.cs
+121
-0
VIZ.Package.Module/PageCommand/PageCommandLifeCycle.cs
+57
-0
VIZ.Package.Module/PageCommand/Service/IPageCommandService.cs
+44
-0
VIZ.Package.Module/PageCommand/View/PageCommandView.xaml
+77
-0
VIZ.Package.Module/PageCommand/View/PageCommandView.xaml.cs
+33
-0
VIZ.Package.Module/PageCommand/ViewModel/PageCommandViewModel.cs
+284
-0
VIZ.Package.Module/Preview/VizPreview/ViewModel/VizPreviewViewModel.cs
+28
-0
VIZ.Package.Module/VIZ.Package.Module.csproj
+11
-0
VIZ.Package.Storage/Entity/Command/PageCommandEntity.cs
+46
-0
VIZ.Package.Storage/ProjectDbContext.cs
+7
-0
VIZ.Package.Storage/VIZ.Package.Storage.csproj
+1
-0
No files found.
VIZ.Package.Domain/Enum/ModulePluginIds.cs
View file @
4db1bb43
...
...
@@ -32,6 +32,11 @@ namespace VIZ.Package.Domain
public
const
string
PAGE_GROUP
=
"PAGE_GROUP"
;
/// <summary>
/// 页命令
/// </summary>
public
const
string
PAGE_COMMAND
=
"PAGE_COMMAND"
;
/// <summary>
/// 字段树
/// </summary>
public
const
string
FIELD_TREE
=
"FIELD_TREE"
;
...
...
VIZ.Package.Domain/Enum/ViewServiceKeys.cs
View file @
4db1bb43
...
...
@@ -32,6 +32,11 @@ namespace VIZ.Package.Domain
public
const
string
PAGE_GROUP_SERVICE
=
"PAGE_GROUP_SERVICE"
;
/// <summary>
/// 页命令服务
/// </summary>
public
const
string
PAGE_COMMAND_SERVICE
=
"PAGE_COMMAND_SERVICE"
;
/// <summary>
/// 字段树服务
/// </summary>
public
const
string
FIELD_TREE_SERVICE
=
"FIELD_TREE_SERVICE"
;
...
...
VIZ.Package.Domain/Message/Page/PageSaveAsMessage.cs
0 → 100644
View file @
4db1bb43
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.Package.Domain
{
/// <summary>
/// 页另存为消息
/// </summary>
public
class
PageSaveAsMessage
{
/// <summary>
/// 页模型基类
/// </summary>
public
PageModelBase
Page
{
get
;
set
;
}
}
}
VIZ.Package.Domain/Message/Page/PageSaveMessage.cs
0 → 100644
View file @
4db1bb43
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.Package.Domain
{
/// <summary>
/// 页保存消息
/// </summary>
public
class
PageSaveMessage
{
/// <summary>
/// 页基类
/// </summary>
public
PageModelBase
Page
{
get
;
set
;
}
}
}
VIZ.Package.Domain/VIZ.Package.Domain.csproj
View file @
4db1bb43
...
...
@@ -98,6 +98,8 @@
<Compile Include="Message\Page\PageOpenOverMessage.cs" />
<Compile Include="Message\Page\PageOpenMessage.cs" />
<Compile Include="Message\Page\PageInitedMessage.cs" />
<Compile Include="Message\Page\PageSaveAsMessage.cs" />
<Compile Include="Message\Page\PageSaveMessage.cs" />
<Compile Include="Message\Project\ProjectSaveMessage.cs" />
<Compile Include="Message\Project\ProjectCloseMessage.cs" />
<Compile Include="Message\Project\ProjectOpenMessage.cs" />
...
...
VIZ.Package.Module/Control/Controller/ControlController.cs
View file @
4db1bb43
...
...
@@ -43,10 +43,6 @@ namespace VIZ.Package.Module
/// <param name="conn">连接</param>
public
void
TakeNormal
(
PageModelBase
oldPageBase
,
PageModelBase
newPageBase
,
ControlObjectModel
obj
,
IPluginView
view
,
ConnModel
conn
)
{
// 场景信息
SceneInfoModel
oldSceneInfo
=
oldPageBase
.
GetSceneInfo
();
SceneInfoModel
newSceneInfo
=
newPageBase
.
GetSceneInfo
();
// 切换场景
this
.
vizCommandService
.
SetEnabledUpdate
(
conn
,
false
);
try
...
...
@@ -68,6 +64,13 @@ namespace VIZ.Package.Module
}
this
.
vizCommandService
.
SetEnabledUpdate
(
conn
,
true
);
this
.
vizCommandService
.
Start
(
conn
,
ApplicationDomainEx
.
CurrentPage
.
Layer
);
// 执行命令
IPageCommandService
pageCommandService
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
IPageCommandService
>(
ViewServiceKeys
.
PAGE_COMMAND_SERVICE
);
if
(
pageCommandService
==
null
)
return
;
pageCommandService
.
BeginExecuteTakeCommand
(
ApplicationDomainEx
.
CurrentPage
,
conn
);
}
/// <summary>
...
...
@@ -181,6 +184,13 @@ namespace VIZ.Package.Module
transitionLogicLayer
.
SceneIdentifier
=
newPageBase
.
Scene
;
transitionLogicLayer
.
StateIdentifier
=
newPageBase
.
StateIdentifier
;
transitionLogicLayer
.
ControlObject
=
controlObjectValue
;
// 执行命令
IPageCommandService
pageCommandService
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
IPageCommandService
>(
ViewServiceKeys
.
PAGE_COMMAND_SERVICE
);
if
(
pageCommandService
==
null
)
return
;
pageCommandService
.
BeginExecuteTakeCommand
(
ApplicationDomainEx
.
CurrentPage
,
conn
);
}
// ---------------------------------------------------------------------------
...
...
@@ -198,6 +208,13 @@ namespace VIZ.Package.Module
{
this
.
vizCommandService
.
TakeContinue
(
conn
,
newPageBase
.
Layer
);
view
?.
TakeContinue
(
conn
);
// 执行命令
IPageCommandService
pageCommandService
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
IPageCommandService
>(
ViewServiceKeys
.
PAGE_COMMAND_SERVICE
);
if
(
pageCommandService
==
null
)
return
;
pageCommandService
.
BeginExecuteTakeContinueCommand
(
ApplicationDomainEx
.
CurrentPage
,
conn
);
}
/// <summary>
...
...
@@ -225,6 +242,13 @@ namespace VIZ.Package.Module
{
logicLayer
.
IsContinued
=
true
;
}
// 执行命令
IPageCommandService
pageCommandService
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
IPageCommandService
>(
ViewServiceKeys
.
PAGE_COMMAND_SERVICE
);
if
(
pageCommandService
==
null
)
return
;
pageCommandService
.
BeginExecuteTakeContinueCommand
(
ApplicationDomainEx
.
CurrentPage
,
conn
);
}
// ---------------------------------------------------------------------------
...
...
@@ -242,6 +266,13 @@ namespace VIZ.Package.Module
{
this
.
vizCommandService
.
TakeOut
(
conn
,
newPageBase
.
Layer
);
view
?.
TakeOut
(
conn
);
// 执行命令
IPageCommandService
pageCommandService
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
IPageCommandService
>(
ViewServiceKeys
.
PAGE_COMMAND_SERVICE
);
if
(
pageCommandService
==
null
)
return
;
pageCommandService
.
BeginExecuteTakeOutCommand
(
ApplicationDomainEx
.
CurrentPage
,
conn
);
}
/// <summary>
...
...
@@ -275,6 +306,13 @@ namespace VIZ.Package.Module
SceneInfoModel
sceneInfo
=
newPageBase
.
GetSceneInfo
();
TransitionLogicLayerInfo
logicLayer
=
bgSceneInfo
.
TransitionLogic
.
LayerInfos
.
FirstOrDefault
(
p
=>
p
.
LayerIdentifier
==
newPageBase
.
LayerIdentifier
);
bgSceneInfo
.
TransitionLogic
.
LayerInfos
.
Remove
(
logicLayer
);
// 执行命令
IPageCommandService
pageCommandService
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
IPageCommandService
>(
ViewServiceKeys
.
PAGE_COMMAND_SERVICE
);
if
(
pageCommandService
==
null
)
return
;
pageCommandService
.
BeginExecuteTakeOutCommand
(
ApplicationDomainEx
.
CurrentPage
,
conn
);
}
// ---------------------------------------------------------------------------
...
...
@@ -305,6 +343,13 @@ namespace VIZ.Package.Module
log
.
Error
(
ex
);
}
this
.
vizCommandService
.
SetEnabledUpdate
(
conn
,
true
);
// 执行命令
IPageCommandService
pageCommandService
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
IPageCommandService
>(
ViewServiceKeys
.
PAGE_COMMAND_SERVICE
);
if
(
pageCommandService
==
null
)
return
;
pageCommandService
.
BeginExecuteTakeUpdateCommand
(
ApplicationDomainEx
.
CurrentPage
,
conn
);
}
/// <summary>
...
...
@@ -331,6 +376,13 @@ namespace VIZ.Package.Module
{
view
.
TakeUpdate
(
conn
);
}
// 执行命令
IPageCommandService
pageCommandService
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
IPageCommandService
>(
ViewServiceKeys
.
PAGE_COMMAND_SERVICE
);
if
(
pageCommandService
==
null
)
return
;
pageCommandService
.
BeginExecuteTakeUpdateCommand
(
ApplicationDomainEx
.
CurrentPage
,
conn
);
}
}
}
VIZ.Package.Module/ControlObject/FieldEdit/ViewModel/FieldEditViewModel.cs
View file @
4db1bb43
...
...
@@ -177,6 +177,11 @@ namespace VIZ.Package.Module
// 保存
this
.
controlObjectService
.
SaveControlFields
(
ApplicationDomainEx
.
CurrentPage
,
obj
.
AllFiledNodes
);
// 发送页保存消息
PageSaveMessage
saveMessage
=
new
PageSaveMessage
();
saveMessage
.
Page
=
ApplicationDomainEx
.
CurrentPage
;
ApplicationDomainEx
.
MessageManager
.
Send
(
saveMessage
);
// 发送弹出提示
AlertMessage
alertMessage
=
new
AlertMessage
();
alertMessage
.
Message
=
"保存成功"
;
...
...
@@ -227,13 +232,14 @@ namespace VIZ.Package.Module
DXMessageBox
.
Show
(
"另存失败!"
);
return
;
}
PageModel
newPage
=
null
;
// 另存模板
if
(
ApplicationDomainEx
.
CurrentPage
is
PageTemplateModel
srcTemplate
)
{
PageModel
p
age
=
pageGroupService
.
AddPage
(
srcTemplate
);
this
.
controlObjectService
.
SaveControlFields
(
p
age
.
PageID
,
controlObject
.
AllFiledNodes
);
pageGroupService
.
OpenPage
(
p
age
);
newP
age
=
pageGroupService
.
AddPage
(
srcTemplate
);
this
.
controlObjectService
.
SaveControlFields
(
newP
age
.
PageID
,
controlObject
.
AllFiledNodes
);
pageGroupService
.
OpenPage
(
newP
age
);
// 记录操作日志
string
remark
=
$"模板:
{
srcTemplate
.
ScenePath
}
"
;
...
...
@@ -242,15 +248,20 @@ namespace VIZ.Package.Module
// 另存页
else
if
(
ApplicationDomainEx
.
CurrentPage
is
PageModel
srcPage
)
{
PageModel
p
age
=
pageGroupService
.
CopyPage
();
this
.
controlObjectService
.
SaveControlFields
(
p
age
.
PageID
,
controlObject
.
AllFiledNodes
);
pageGroupService
.
OpenPage
(
p
age
);
newP
age
=
pageGroupService
.
CopyPage
();
this
.
controlObjectService
.
SaveControlFields
(
newP
age
.
PageID
,
controlObject
.
AllFiledNodes
);
pageGroupService
.
OpenPage
(
newP
age
);
// 记录操作日志
string
remark
=
$"页:
{
p
age
.
ScenePath
}
"
;
string
remark
=
$"页:
{
newP
age
.
ScenePath
}
"
;
this
.
recordLogService
.
AppendLog
(
ApplicationConstants
.
APPLICATION_GROUP_NAME
,
RecordLogOperate
.
Operate
,
RecordLogTrigger
.
Human
,
RecordLogConstants
.
OPERATE_CONTROL_FIELD_SAVE_AS
,
remark
);
}
// 发送另存为消息
PageSaveAsMessage
saveAsMessage
=
new
PageSaveAsMessage
();
saveAsMessage
.
Page
=
newPage
;
ApplicationDomainEx
.
MessageManager
.
Send
(
saveAsMessage
);
// 发送弹出提示
AlertMessage
alertMessage
=
new
AlertMessage
();
alertMessage
.
Message
=
"另存成功"
;
...
...
VIZ.Package.Module/PageCommand/Controller/PageCommandController.cs
0 → 100644
View file @
4db1bb43
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Core
;
using
VIZ.Package.Domain
;
namespace
VIZ.Package.Module
{
/// <summary>
/// 页命令控制器
/// </summary>
public
class
PageCommandController
{
/// <summary>
/// 延时
/// </summary>
/// <remarks>
/// 示例: delay 1000
/// 描述:延时 1000 毫秒
/// </remarks>
public
const
string
CMD_DELAY
=
"delay"
;
/// <summary>
/// 发送
/// </summary>
/// <remarks>
/// 示例: send xxx
/// 描述: 向viz引擎发送xxx命令
/// </remarks>
public
const
string
CMD_SEND
=
"send"
;
/// <summary>
/// 开始执行命令
/// </summary>
/// <param name="pageBase">页</param>
/// <param name="conn">连接</param>
/// <param name="command">命令</param>
public
void
BeginExecute
(
PageModelBase
pageBase
,
ConnModel
conn
,
string
command
)
{
if
(
pageBase
==
null
||
string
.
IsNullOrWhiteSpace
(
command
))
return
;
ThreadHelper
.
SafeRun
(()
=>
this
.
Execute
(
pageBase
,
conn
,
command
));
}
/// <summary>
/// 执行
/// </summary>
/// <param name="pageBase">页</param>
/// <param name="conn">连接</param>
/// <param name="command">命令</param>
private
void
Execute
(
PageModelBase
pageBase
,
ConnModel
conn
,
string
command
)
{
string
[]
lines
=
command
.
Split
(
new
string
[]
{
"\r"
,
"\n"
},
StringSplitOptions
.
RemoveEmptyEntries
);
foreach
(
string
line
in
lines
)
{
string
str
=
line
.
Trim
();
int
index
=
str
.
IndexOf
(
' '
);
string
cmd
=
str
.
Substring
(
0
,
index
);
string
args
=
str
.
Substring
(
index
,
str
.
Length
-
index
);
cmd
=
cmd
.
Trim
().
ToLower
();
args
=
args
.
Trim
();
this
.
ExecuteLine
(
pageBase
,
conn
,
cmd
,
args
);
}
}
/// <summary>
/// 执行
/// </summary>
/// <param name="pageBase">页</param>
/// <param name="conn">连接</param>
/// <param name="cmd">命令</param>
/// <param name="args">参数</param>
private
void
ExecuteLine
(
PageModelBase
pageBase
,
ConnModel
conn
,
string
cmd
,
string
args
)
{
switch
(
cmd
)
{
case
CMD_DELAY
:
this
.
ExecuteLine_Delay
(
pageBase
,
conn
,
cmd
,
args
);
break
;
case
CMD_SEND
:
this
.
ExecuteLine_Send
(
pageBase
,
conn
,
cmd
,
args
);
break
;
}
}
/// <summary>
/// 执行 -- 延时
/// </summary>
/// <param name="pageBase">页</param>
/// <param name="conn">连接</param>
/// <param name="cmd">命令</param>
/// <param name="args">参数</param>
private
void
ExecuteLine_Delay
(
PageModelBase
pageBase
,
ConnModel
conn
,
string
cmd
,
string
args
)
{
int
.
TryParse
(
args
,
out
int
delay
);
if
(
delay
<=
0
)
return
;
System
.
Threading
.
Thread
.
Sleep
(
delay
);
}
/// <summary>
/// 执行 -- 向Viz发送消息
/// </summary>
/// <param name="pageBase">页</param>
/// <param name="conn">连接</param>
/// <param name="cmd">命令</param>
/// <param name="args">参数</param>
private
void
ExecuteLine_Send
(
PageModelBase
pageBase
,
ConnModel
conn
,
string
cmd
,
string
args
)
{
if
(
conn
==
null
||
!
conn
.
IsEnabled
||
!
conn
.
IsConnected
)
return
;
conn
.
EndpointManager
.
Send
(
args
);
}
}
}
VIZ.Package.Module/PageCommand/PageCommandLifeCycle.cs
0 → 100644
View file @
4db1bb43
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Plugin
;
namespace
VIZ.Package.Module
{
/// <summary>
/// 页命令插件生命周期
/// </summary>
public
class
PageCommandLifeCycle
:
IPluginLifeCycle
{
/// <summary>
/// 插件分组
/// </summary>
public
const
string
PLUGIN_GROUP
=
ApplicationConstants
.
APPLICATION_GROUP_NAME
;
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
/// 插件ID不能包含点号
/// </remarks>
public
const
string
PLUGIN_ID
=
ModulePluginIds
.
PAGE_COMMAND
;
/// <summary>
/// 插件名称
/// </summary>
public
const
string
PLUGIN_NAME
=
"命令"
;
/// <summary>
/// 注册
/// </summary>
/// <returns>插件信息</returns>
public
PluginInfo
Register
()
{
PluginInfo
info
=
new
PluginInfo
();
info
.
Group
=
PLUGIN_GROUP
;
info
.
ID
=
PLUGIN_ID
;
info
.
Name
=
PLUGIN_NAME
;
info
.
ViewType
=
typeof
(
PageCommandView
);
return
info
;
}
/// <summary>
/// 销毁
/// </summary>
public
void
Dispose
()
{
}
}
}
VIZ.Package.Module/PageCommand/Service/IPageCommandService.cs
0 → 100644
View file @
4db1bb43
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Core
;
using
VIZ.Package.Domain
;
namespace
VIZ.Package.Module
{
/// <summary>
/// 页命令服务
/// </summary>
public
interface
IPageCommandService
:
IService
{
/// <summary>
/// 开始执行上板命令
/// </summary>
/// <param name="pageBase">页或模板</param>
/// <param name="conn">连接</param>
void
BeginExecuteTakeCommand
(
PageModelBase
pageBase
,
ConnModel
conn
);
/// <summary>
/// 开始执行继续命令
/// </summary>
/// <param name="pageBase">页或模板</param>
/// <param name="conn">连接</param>
void
BeginExecuteTakeContinueCommand
(
PageModelBase
pageBase
,
ConnModel
conn
);
/// <summary>
/// 开始执行下板命令
/// </summary>
/// <param name="pageBase">页或模板</param>
/// <param name="conn">连接</param>
void
BeginExecuteTakeOutCommand
(
PageModelBase
pageBase
,
ConnModel
conn
);
/// <summary>
/// 开始执行更新命令
/// </summary>
/// <param name="pageBase">页或模板</param>
/// <param name="conn">连接</param>
void
BeginExecuteTakeUpdateCommand
(
PageModelBase
pageBase
,
ConnModel
conn
);
}
}
VIZ.Package.Module/PageCommand/View/PageCommandView.xaml
0 → 100644
View file @
4db1bb43
<UserControl x:Class="VIZ.Package.Module.PageCommandView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:fcore="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:fcommon="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common"
xmlns:common="clr-namespace:VIZ.Package.Common;assembly=VIZ.Package.Common"
xmlns:storage="clr-namespace:VIZ.Package.Storage;assembly=VIZ.Package.Storage"
xmlns:resource="clr-namespace:VIZ.Package.Module.Resource;assembly=VIZ.Package.Module.Resource"
xmlns:local="clr-namespace:VIZ.Package.Module"
xmlns:domain="clr-namespace:VIZ.Package.Domain;assembly=VIZ.Package.Domain"
d:DataContext="{d:DesignInstance Type=local:PageCommandViewModel}"
x:Name="uc"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="PreviewKeyDown" Command="{Binding Path=PreviewKeyDownCommand}" PassEventArgsToCommand="True"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.Package.Module.Resource;component/Style/IconButton/IconButton_Default.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="25"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<!-- 描述 -->
<Border Background="#11FFFFFF" Grid.Row="0">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" >
<TextBlock Text="页:" Margin="8,0,0,0" d:Foreground="White" Opacity="0.7"></TextBlock>
<TextBlock Text="{Binding PageID}" Margin="10,0,0,0" MinWidth="40" d:Foreground="White"></TextBlock>
<TextBlock Text="场景:" Margin="40,0,0,0" d:Foreground="White" Opacity="0.7"></TextBlock>
<TextBlock Text="{Binding Scene}" Margin="10,0,0,0" MinWidth="80" d:Foreground="White"></TextBlock>
</StackPanel>
</Border>
<!-- 命令输入框 -->
<dx:DXTabControl Grid.Row="1" Margin="0,10,0,0" Padding="0,5,0,0">
<dx:DXTabControl.View>
<dx:TabControlStretchView HeaderLocation="Top" ShowHeaderMenu="False"
NewButtonShowMode="NoWhere"
HideButtonShowMode="NoWhere"
PinnedTabSize="60">
</dx:TabControlStretchView>
</dx:DXTabControl.View>
<dx:DXTabItem Header="Take">
<dxe:TextEdit AcceptsReturn="True" EditValue="{Binding Path=TakeCommand,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="5"
VerticalContentAlignment="Top"></dxe:TextEdit>
</dx:DXTabItem>
<dx:DXTabItem Header="Continue">
<dxe:TextEdit AcceptsReturn="True" EditValue="{Binding Path=TakeContinueCommand,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="5"
VerticalContentAlignment="Top"></dxe:TextEdit>
</dx:DXTabItem>
<dx:DXTabItem Header="TakeOut">
<dxe:TextEdit AcceptsReturn="True" EditValue="{Binding Path=TakeOutCommand,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="5"
VerticalContentAlignment="Top"></dxe:TextEdit>
</dx:DXTabItem>
<dx:DXTabItem Header="Update">
<dxe:TextEdit AcceptsReturn="True" EditValue="{Binding Path=TakeUpdateCommand,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="5"
VerticalContentAlignment="Top"></dxe:TextEdit>
</dx:DXTabItem>
</dx:DXTabControl>
</Grid>
</UserControl>
VIZ.Package.Module/PageCommand/View/PageCommandView.xaml.cs
0 → 100644
View file @
4db1bb43
using
DevExpress.Xpf.Core
;
using
DevExpress.Xpf.Grid
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
System.Windows.Controls
;
using
System.Windows.Data
;
using
System.Windows.Documents
;
using
System.Windows.Input
;
using
System.Windows.Media
;
using
System.Windows.Media.Imaging
;
using
System.Windows.Navigation
;
using
System.Windows.Shapes
;
using
VIZ.Framework.Core
;
namespace
VIZ.Package.Module
{
/// <summary>
/// PageCommandView.xaml 的交互逻辑
/// </summary>
public
partial
class
PageCommandView
:
UserControl
{
public
PageCommandView
()
{
InitializeComponent
();
WPFHelper
.
BindingViewModel
(
this
,
new
PageCommandViewModel
());
}
}
}
VIZ.Package.Module/PageCommand/ViewModel/PageCommandViewModel.cs
0 → 100644
View file @
4db1bb43
using
DevExpress.Xpf.Core
;
using
DevExpress.Xpf.Grid
;
using
DevExpress.Xpf.Bars
;
using
log4net
;
using
Newtonsoft.Json.Serialization
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Web.UI
;
using
System.Windows
;
using
VIZ.Framework.Core
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Common
;
using
VIZ.Package.Service
;
using
VIZ.Package.Storage
;
using
DevExpress.Xpf.Editors.Helpers
;
using
System.Windows.Input
;
using
VIZ.Framework.Common
;
using
System.Windows.Controls.Primitives
;
namespace
VIZ.Package.Module
{
/// <summary>
/// 页分组视图模型
/// </summary>
public
class
PageCommandViewModel
:
ViewModelBase
,
IPageCommandService
{
/// <summary>
/// 日志
/// </summary>
private
readonly
static
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
PageCommandViewModel
));
public
PageCommandViewModel
()
{
ApplicationDomainEx
.
ServiceManager
.
AddService
(
ViewServiceKeys
.
PAGE_COMMAND_SERVICE
,
this
);
// 初始化命令
this
.
InitCommand
();
// 初始化消息
this
.
InitMessage
();
}
/// <summary>
/// 初始化命令
/// </summary>
private
void
InitCommand
()
{
}
/// <summary>
/// 初始化消息
/// </summary>
private
void
InitMessage
()
{
ApplicationDomainEx
.
MessageManager
.
Register
<
PageOpenMessage
>(
this
,
this
.
OnPageOpenMessage
);
ApplicationDomainEx
.
MessageManager
.
Register
<
PageSaveMessage
>(
this
,
this
.
OnPageSaveMessage
);
ApplicationDomainEx
.
MessageManager
.
Register
<
PageSaveAsMessage
>(
this
,
this
.
OnPageSaveAsMessage
);
}
// ======================================================================================
// Controller & Service
// ======================================================================================
/// <summary>
/// 页命令控制器
/// </summary>
public
PageCommandController
pageCommandController
=
new
PageCommandController
();
// ======================================================================================
// Property
// ======================================================================================
#
region
TakeCommand
--
上板命令
private
string
takeCommand
;
/// <summary>
/// 上板命令
/// </summary>
public
string
TakeCommand
{
get
{
return
takeCommand
;
}
set
{
takeCommand
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
TakeCommand
));
}
}
#
endregion
#
region
TakeContinueCommand
--
上版继续命令
private
string
takeContinueCommand
;
/// <summary>
/// 上版继续命令
/// </summary>
public
string
TakeContinueCommand
{
get
{
return
takeContinueCommand
;
}
set
{
takeContinueCommand
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
TakeContinueCommand
));
}
}
#
endregion
#
region
TakeOutCommand
--
下板命令
private
string
takeOutCommand
;
/// <summary>
/// 下板命令
/// </summary>
public
string
TakeOutCommand
{
get
{
return
takeOutCommand
;
}
set
{
takeOutCommand
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
TakeOutCommand
));
}
}
#
endregion
#
region
TakeUpdateCommand
--
更新命令
private
string
takeUpdateCommand
;
/// <summary>
/// 更新命令
/// </summary>
public
string
TakeUpdateCommand
{
get
{
return
takeUpdateCommand
;
}
set
{
takeUpdateCommand
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
TakeUpdateCommand
));
}
}
#
endregion
#
region
PageID
--
页
ID
private
string
pageID
;
/// <summary>
/// 页ID
/// </summary>
public
string
PageID
{
get
{
return
pageID
;
}
set
{
pageID
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
PageID
));
}
}
#
endregion
#
region
Scene
--
场景
private
string
scene
;
/// <summary>
/// 场景
/// </summary>
public
string
Scene
{
get
{
return
scene
;
}
set
{
scene
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
Scene
));
}
}
#
endregion
// ======================================================================================
// Command
// ======================================================================================
// ======================================================================================
// Message
// ======================================================================================
/// <summary>
/// 页打开消息
/// </summary>
/// <param name="msg">消息</param>
private
void
OnPageOpenMessage
(
PageOpenMessage
msg
)
{
if
(
msg
.
Page
is
PageModel
page
)
{
this
.
PageID
=
page
.
GetPageNumString
();
}
else
{
this
.
PageID
=
string
.
Empty
;
}
this
.
Scene
=
msg
.
Page
.
Scene
;
Guid
templateIdOrPageId
=
msg
.
Page
.
GetTemplateIdOrPageId
();
PageCommandEntity
entity
=
ApplicationDomainEx
.
ProjectDbContext
.
PageCommand
.
Find
(
p
=>
p
.
PageID
==
templateIdOrPageId
).
FirstOrDefault
();
this
.
TakeCommand
=
entity
?.
TakeCommand
??
string
.
Empty
;
this
.
TakeContinueCommand
=
entity
?.
TakeContinueCommand
??
string
.
Empty
;
this
.
TakeOutCommand
=
entity
?.
TakeOutCommand
??
string
.
Empty
;
this
.
TakeUpdateCommand
=
entity
?.
TakeUpdateCommand
??
string
.
Empty
;
}
/// <summary>
/// 页保存消息
/// </summary>
/// <param name="msg">消息</param>
private
void
OnPageSaveMessage
(
PageSaveMessage
msg
)
{
Guid
templateIdOrPageId
=
msg
.
Page
.
GetTemplateIdOrPageId
();
PageCommandEntity
entity
=
ApplicationDomainEx
.
ProjectDbContext
.
PageCommand
.
Find
(
p
=>
p
.
PageID
==
templateIdOrPageId
).
FirstOrDefault
();
entity
=
entity
??
new
PageCommandEntity
();
entity
.
PageID
=
templateIdOrPageId
;
entity
.
TakeCommand
=
this
.
TakeCommand
;
entity
.
TakeContinueCommand
=
this
.
TakeContinueCommand
;
entity
.
TakeOutCommand
=
this
.
TakeOutCommand
;
entity
.
TakeUpdateCommand
=
this
.
TakeUpdateCommand
;
ApplicationDomainEx
.
ProjectDbContext
.
PageCommand
.
Upsert
(
entity
);
}
/// <summary>
/// 页另存为消息
/// </summary>
/// <param name="msg">消息</param>
private
void
OnPageSaveAsMessage
(
PageSaveAsMessage
msg
)
{
Guid
templateIdOrPageId
=
msg
.
Page
.
GetTemplateIdOrPageId
();
PageCommandEntity
entity
=
ApplicationDomainEx
.
ProjectDbContext
.
PageCommand
.
Find
(
p
=>
p
.
PageID
==
templateIdOrPageId
).
FirstOrDefault
();
entity
=
entity
??
new
PageCommandEntity
();
entity
.
PageID
=
templateIdOrPageId
;
entity
.
TakeCommand
=
this
.
TakeCommand
;
entity
.
TakeContinueCommand
=
this
.
TakeContinueCommand
;
entity
.
TakeOutCommand
=
this
.
TakeOutCommand
;
entity
.
TakeUpdateCommand
=
this
.
TakeUpdateCommand
;
ApplicationDomainEx
.
ProjectDbContext
.
PageCommand
.
Upsert
(
entity
);
}
// ======================================================================================
// Public Function
// ======================================================================================
/// <summary>
/// 开始执行上板命令
/// </summary>
/// <param name="pageBase">页或模板</param>
/// <param name="conn">连接</param>
public
void
BeginExecuteTakeCommand
(
PageModelBase
pageBase
,
ConnModel
conn
)
{
this
.
pageCommandController
.
BeginExecute
(
pageBase
,
conn
,
this
.
TakeCommand
);
}
/// <summary>
/// 开始执行继续命令
/// </summary>
/// <param name="pageBase">页或模板</param>
/// <param name="conn">连接</param>
public
void
BeginExecuteTakeContinueCommand
(
PageModelBase
pageBase
,
ConnModel
conn
)
{
this
.
pageCommandController
.
BeginExecute
(
pageBase
,
conn
,
this
.
TakeContinueCommand
);
}
/// <summary>
/// 开始执行下板命令
/// </summary>
/// <param name="pageBase">页或模板</param>
/// <param name="conn">连接</param>
public
void
BeginExecuteTakeOutCommand
(
PageModelBase
pageBase
,
ConnModel
conn
)
{
this
.
pageCommandController
.
BeginExecute
(
pageBase
,
conn
,
this
.
TakeOutCommand
);
}
/// <summary>
/// 开始执行更新命令
/// </summary>
/// <param name="pageBase">页或模板</param>
/// <param name="conn">连接</param>
public
void
BeginExecuteTakeUpdateCommand
(
PageModelBase
pageBase
,
ConnModel
conn
)
{
this
.
pageCommandController
.
BeginExecute
(
pageBase
,
conn
,
this
.
TakeUpdateCommand
);
}
// ======================================================================================
// Private Function
// ======================================================================================
}
}
VIZ.Package.Module/Preview/VizPreview/ViewModel/VizPreviewViewModel.cs
View file @
4db1bb43
...
...
@@ -351,6 +351,13 @@ namespace VIZ.Package.Module
{
this
.
vizCommandService
.
Start
(
conn
,
null
,
VizLayer
.
MAIN_LAYER
);
view
?.
PreviewIn
(
conn
);
// 执行命令
IPageCommandService
pageCommandService
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
IPageCommandService
>(
ViewServiceKeys
.
PAGE_COMMAND_SERVICE
);
if
(
pageCommandService
==
null
)
return
;
pageCommandService
.
BeginExecuteTakeCommand
(
ApplicationDomainEx
.
CurrentPage
,
conn
);
}
catch
(
Exception
ex
)
{
...
...
@@ -381,6 +388,13 @@ namespace VIZ.Package.Module
{
this
.
vizCommandService
.
Continue
(
conn
,
null
,
VizLayer
.
MAIN_LAYER
);
view
?.
PreviewContinue
(
conn
);
// 执行命令
IPageCommandService
pageCommandService
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
IPageCommandService
>(
ViewServiceKeys
.
PAGE_COMMAND_SERVICE
);
if
(
pageCommandService
==
null
)
return
;
pageCommandService
.
BeginExecuteTakeContinueCommand
(
ApplicationDomainEx
.
CurrentPage
,
conn
);
});
}
...
...
@@ -405,6 +419,13 @@ namespace VIZ.Package.Module
{
this
.
vizCommandService
.
Stop
(
conn
,
null
,
VizLayer
.
MAIN_LAYER
);
view
?.
PreviewOut
(
conn
);
// 执行命令
IPageCommandService
pageCommandService
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
IPageCommandService
>(
ViewServiceKeys
.
PAGE_COMMAND_SERVICE
);
if
(
pageCommandService
==
null
)
return
;
pageCommandService
.
BeginExecuteTakeOutCommand
(
ApplicationDomainEx
.
CurrentPage
,
conn
);
});
}
...
...
@@ -451,6 +472,13 @@ namespace VIZ.Package.Module
log
.
Error
(
ex
);
}
this
.
vizCommandService
.
SetEnabledUpdate
(
conn
,
true
);
// 执行命令
IPageCommandService
pageCommandService
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
IPageCommandService
>(
ViewServiceKeys
.
PAGE_COMMAND_SERVICE
);
if
(
pageCommandService
==
null
)
return
;
pageCommandService
.
BeginExecuteTakeUpdateCommand
(
ApplicationDomainEx
.
CurrentPage
,
conn
);
});
}
...
...
VIZ.Package.Module/VIZ.Package.Module.csproj
View file @
4db1bb43
...
...
@@ -144,6 +144,13 @@
<Compile Include="Log\ViewModel\VizCommandWindowModel.cs" />
<Compile Include="Main\Controller\HotkeyController.cs" />
<Compile Include="Main\Core\MainTopViewMenuDataTemplateSelector.cs" />
<Compile Include="PageCommand\Controller\PageCommandController.cs" />
<Compile Include="PageCommand\PageCommandLifeCycle.cs" />
<Compile Include="PageCommand\Service\IPageCommandService.cs" />
<Compile Include="PageCommand\ViewModel\PageCommandViewModel.cs" />
<Compile Include="PageCommand\View\PageCommandView.xaml.cs">
<DependentUpon>PageCommandView.xaml</DependentUpon>
</Compile>
<Compile Include="Page\Core\View\PageLoadingWindow.xaml.cs">
<DependentUpon>PageLoadingWindow.xaml</DependentUpon>
</Compile>
...
...
@@ -466,6 +473,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="PageCommand\View\PageCommandView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Page\Core\View\PageLoadingWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
...
...
VIZ.Package.Storage/Entity/Command/PageCommandEntity.cs
0 → 100644
View file @
4db1bb43
using
LiteDB
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.Package.Storage
{
/// <summary>
/// 页命令实体
/// </summary>
public
class
PageCommandEntity
{
/// <summary>
/// 编号
/// </summary>
[
BsonId
(
true
)]
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 页或模板ID
/// </summary>
public
Guid
PageID
{
get
;
set
;
}
/// <summary>
/// 命令
/// </summary>
public
string
TakeCommand
{
get
;
set
;
}
/// <summary>
/// 继续命令
/// </summary>
public
string
TakeContinueCommand
{
get
;
set
;
}
/// <summary>
/// 下板命令
/// </summary>
public
string
TakeOutCommand
{
get
;
set
;
}
/// <summary>
/// 更新命令
/// </summary>
public
string
TakeUpdateCommand
{
get
;
set
;
}
}
}
VIZ.Package.Storage/ProjectDbContext.cs
View file @
4db1bb43
...
...
@@ -41,6 +41,7 @@ namespace VIZ.Package.Storage
this
.
ControlObject
=
this
.
Database
.
GetCollection
<
ControlObjectEntity
>();
this
.
SceneThumbnailCache
=
this
.
Database
.
GetStorage
<
Guid
>(
"_SceneThumbnailFiles"
,
"_SceneThumbnailChunks"
);
this
.
ScrollElementPackage
=
this
.
Database
.
GetCollection
<
ScrollElementPackageEntity
>();
this
.
PageCommand
=
this
.
Database
.
GetCollection
<
PageCommandEntity
>();
}
/// <summary>
...
...
@@ -84,6 +85,11 @@ namespace VIZ.Package.Storage
public
ILiteCollection
<
ScrollElementPackageEntity
>
ScrollElementPackage
{
get
;
private
set
;
}
/// <summary>
/// 页命令
/// </summary>
public
ILiteCollection
<
PageCommandEntity
>
PageCommand
{
get
;
private
set
;
}
/// <summary>
/// 销毁
/// </summary>
public
void
Dispose
()
...
...
@@ -95,6 +101,7 @@ namespace VIZ.Package.Storage
this
.
ControlObject
=
null
;
this
.
SceneThumbnailCache
=
null
;
this
.
ScrollElementPackage
=
null
;
this
.
PageCommand
=
null
;
this
.
Database
?.
Dispose
();
}
...
...
VIZ.Package.Storage/VIZ.Package.Storage.csproj
View file @
4db1bb43
...
...
@@ -95,6 +95,7 @@
<Compile Include="CsvDbContext.cs" />
<Compile Include="CSV\GridColumnDefintionItem.cs" />
<Compile Include="CSV\RecordLog\RecordLog.cs" />
<Compile Include="Entity\Command\PageCommandEntity.cs" />
<Compile Include="Entity\Config\HotKeyConfigEntity.cs" />
<Compile Include="Entity\Config\MediaConfigEntity.cs" />
<Compile Include="Entity\Config\PluginMappingConfigEntity.cs" />
...
...
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