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
00756b98
Commit
00756b98
authored
Jan 07, 2023
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
状态面板
重新加载
parent
60aadce1
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
207 additions
and
14 deletions
+207
-14
VIZ.Package.Module/Main/View/MainStatusView.xaml
+8
-1
VIZ.Package.Module/Main/ViewModel/MainStatusViewModel.cs
+79
-0
VIZ.Package.Module/Page/Group/ViewModel/PageAddViewModel.cs
+1
-1
VIZ.Package.Module/Page/Group/ViewModel/PageGroupViewModel.cs
+4
-0
VIZ.Package.Module/Page/Templage/View/PageTemplateView.xaml
+3
-3
VIZ.Package.Module/Page/Templage/ViewModel/PageTemplateViewModel.cs
+101
-8
VIZ.Package.Service/Viz/VizCommandService.cs
+11
-1
No files found.
VIZ.Package.Module/Main/View/MainStatusView.xaml
View file @
00756b98
...
@@ -4,9 +4,16 @@
...
@@ -4,9 +4,16 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:VIZ.Package.Module"
xmlns:local="clr-namespace:VIZ.Package.Module"
d:DataContext="{d:DesignInstance Type=local:MainStatusViewModel}"
mc:Ignorable="d"
mc:Ignorable="d"
d:DesignHeight="35" d:DesignWidth="800">
d:DesignHeight="35" d:DesignWidth="800">
<Grid>
<Grid>
<TextBlock Text="状态面板" Foreground="Red" FontSize="24" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<!-- 項目名 -->
<TextBlock Text="项目:" Margin="10,0,0,0" Opacity="0.6"></TextBlock>
<TextBlock Text="{Binding ProjectName}" Margin="10,0,0,0"></TextBlock>
<TextBlock Text="场景:" Margin="40,0,0,0" Opacity="0.6"></TextBlock>
<TextBlock Text="{Binding Scene}" Margin="10,0,0,0"></TextBlock>
</StackPanel>
</Grid>
</Grid>
</UserControl>
</UserControl>
VIZ.Package.Module/Main/ViewModel/MainStatusViewModel.cs
View file @
00756b98
...
@@ -4,6 +4,7 @@ using System.Linq;
...
@@ -4,6 +4,7 @@ using System.Linq;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Core
;
using
VIZ.Framework.Core
;
using
VIZ.Package.Domain
;
namespace
VIZ.Package.Module
namespace
VIZ.Package.Module
{
{
...
@@ -12,5 +13,83 @@ namespace VIZ.Package.Module
...
@@ -12,5 +13,83 @@ namespace VIZ.Package.Module
/// </summary>
/// </summary>
public
class
MainStatusViewModel
:
ViewModelBase
public
class
MainStatusViewModel
:
ViewModelBase
{
{
/// <summary>
/// 状态视图模型
/// </summary>
public
MainStatusViewModel
()
{
ApplicationDomainEx
.
MessageManager
.
Register
<
ProjectOpenMessage
>(
this
,
this
.
OnProjectOpenMessage
);
ApplicationDomainEx
.
MessageManager
.
Register
<
ProjectCloseMessage
>(
this
,
this
.
OnProjectCloseMessage
);
ApplicationDomainEx
.
MessageManager
.
Register
<
PageOpenMessage
>(
this
,
this
.
OnPageOpenMessage
);
}
// ======================================================================
// Property
// ======================================================================
#
region
ProjectName
--
项目名称
private
string
projectName
;
/// <summary>
/// 项目名称
/// </summary>
public
string
ProjectName
{
get
{
return
projectName
;
}
set
{
projectName
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
ProjectName
));
}
}
#
endregion
#
region
Scene
--
当前打开的场景
private
string
scene
;
/// <summary>
/// 当前打开的场景
/// </summary>
public
string
Scene
{
get
{
return
scene
;
}
set
{
scene
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
Scene
));
}
}
#
endregion
// ======================================================================
// Message
// ======================================================================
/// <summary>
/// 项目打开消息
/// </summary>
/// <param name="msg">消息</param>
private
void
OnProjectOpenMessage
(
ProjectOpenMessage
msg
)
{
if
(
ApplicationDomainEx
.
ProjectDbContext
==
null
)
{
this
.
ProjectName
=
null
;
return
;
}
this
.
ProjectName
=
System
.
IO
.
Path
.
GetFileNameWithoutExtension
(
ApplicationDomainEx
.
ProjectDbContext
.
Path
);
}
/// <summary>
/// 项目关闭消息
/// </summary>
/// <param name="msg">消息</param>
private
void
OnProjectCloseMessage
(
ProjectCloseMessage
msg
)
{
this
.
ProjectName
=
null
;
}
/// <summary>
/// 页打开消息
/// </summary>
/// <param name="msg">消息</param>
private
void
OnPageOpenMessage
(
PageOpenMessage
msg
)
{
this
.
Scene
=
msg
.
Page
?.
Scene
;
}
}
}
}
}
VIZ.Package.Module/Page/Group/ViewModel/PageAddViewModel.cs
View file @
00756b98
...
@@ -122,7 +122,7 @@ namespace VIZ.Package.Module
...
@@ -122,7 +122,7 @@ namespace VIZ.Package.Module
/// </summary>
/// </summary>
private
void
Loaded
()
private
void
Loaded
()
{
{
this
.
TemplatePlugins
=
ApplicationDomainEx
.
PluginInfos
.
Where
(
p
=>
p
.
PluginType
==
PluginType
.
Page
).
ToList
();
this
.
TemplatePlugins
=
ApplicationDomainEx
.
PluginInfos
.
Where
(
p
=>
p
.
Group
==
ApplicationDomainEx
.
VizConfig
.
PluginGroup
&&
p
.
PluginType
==
PluginType
.
Page
).
ToList
();
// TODO: 选择默认模板
// TODO: 选择默认模板
}
}
...
...
VIZ.Package.Module/Page/Group/ViewModel/PageGroupViewModel.cs
View file @
00756b98
...
@@ -6,6 +6,7 @@ using System.Collections.ObjectModel;
...
@@ -6,6 +6,7 @@ using System.Collections.ObjectModel;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
VIZ.Framework.Core
;
using
VIZ.Framework.Core
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Service
;
using
VIZ.Package.Service
;
...
@@ -234,6 +235,9 @@ namespace VIZ.Package.Module
...
@@ -234,6 +235,9 @@ namespace VIZ.Package.Module
if
(
this
.
SelectedPageGroupModel
==
null
)
if
(
this
.
SelectedPageGroupModel
==
null
)
return
;
return
;
if
(
DXMessageBox
.
Show
(
$"是否删除分组【
{
this
.
SelectedPageGroupModel
.
GroupName
}
】?"
,
"提示"
,
MessageBoxButton
.
YesNo
)
!=
MessageBoxResult
.
Yes
)
return
;
this
.
PageGroupModels
.
Remove
(
this
.
SelectedPageGroupModel
);
this
.
PageGroupModels
.
Remove
(
this
.
SelectedPageGroupModel
);
}
}
...
...
VIZ.Package.Module/Page/Templage/View/PageTemplateView.xaml
View file @
00756b98
...
@@ -33,10 +33,10 @@
...
@@ -33,10 +33,10 @@
<ContextMenu>
<ContextMenu>
<MenuItem Header="打开" Command="{Binding Path=PlacementTarget.DataContext.OpenScenePageCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<MenuItem Header="打开" Command="{Binding Path=PlacementTarget.DataContext.OpenScenePageCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<Separator></Separator>
<Separator></Separator>
<MenuItem Header="添加至节目单" Command="{Binding Path=PlacementTarget.DataContext.
SceneTemplate
AddToPageGroupCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<MenuItem Header="添加至节目单" Command="{Binding Path=PlacementTarget.DataContext.AddToPageGroupCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<MenuItem Header="更新模板" Command="{Binding Path=PlacementTarget.DataContext.
SceneTemplate
UpdateCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<MenuItem Header="更新模板" Command="{Binding Path=PlacementTarget.DataContext.UpdateCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<Separator></Separator>
<Separator></Separator>
<MenuItem Header="删除模板" Command="{Binding Path=PlacementTarget.DataContext.
SceneTemplate
DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<MenuItem Header="删除模板" Command="{Binding Path=PlacementTarget.DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
</ContextMenu>
</ContextMenu>
</dxg:GridControl.ContextMenu>
</dxg:GridControl.ContextMenu>
<dxg:GridControl.Columns>
<dxg:GridControl.Columns>
...
...
VIZ.Package.Module/Page/Templage/ViewModel/PageTemplateViewModel.cs
View file @
00756b98
...
@@ -6,6 +6,7 @@ using System.Collections.ObjectModel;
...
@@ -6,6 +6,7 @@ using System.Collections.ObjectModel;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.Windows.Controls.Primitives
;
using
VIZ.Framework.Core
;
using
VIZ.Framework.Core
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Service
;
using
VIZ.Package.Service
;
...
@@ -26,10 +27,10 @@ namespace VIZ.Package.Module
...
@@ -26,10 +27,10 @@ namespace VIZ.Package.Module
public
PageTemplateViewModel
()
public
PageTemplateViewModel
()
{
{
// 初始化命令
// 初始化命令
this
.
i
nitCommand
();
this
.
I
nitCommand
();
// 初始化消息
// 初始化消息
this
.
i
nitMessage
();
this
.
I
nitMessage
();
// 注册服务
// 注册服务
ApplicationDomainEx
.
ServiceManager
.
AddService
(
ViewServiceKeys
.
PAGE_TEMPLATE_SERVICE
,
this
);
ApplicationDomainEx
.
ServiceManager
.
AddService
(
ViewServiceKeys
.
PAGE_TEMPLATE_SERVICE
,
this
);
...
@@ -38,16 +39,18 @@ namespace VIZ.Package.Module
...
@@ -38,16 +39,18 @@ namespace VIZ.Package.Module
/// <summary>
/// <summary>
/// 初始化命令
/// 初始化命令
/// </summary>
/// </summary>
private
void
i
nitCommand
()
private
void
I
nitCommand
()
{
{
this
.
SceneTemplateAddToPageGroupCommand
=
new
VCommand
(
this
.
SceneTemplate
AddToPageGroup
);
this
.
AddToPageGroupCommand
=
new
VCommand
(
this
.
AddToPageGroup
);
this
.
OpenScenePageCommand
=
new
VCommand
(
this
.
OpenScenePage
);
this
.
OpenScenePageCommand
=
new
VCommand
(
this
.
OpenScenePage
);
this
.
UpdateCommand
=
new
VCommand
(
this
.
Update
);
this
.
DeleteCommand
=
new
VCommand
(
this
.
Delete
);
}
}
/// <summary>
/// <summary>
/// 初始化消息
/// 初始化消息
/// </summary>
/// </summary>
private
void
i
nitMessage
()
private
void
I
nitMessage
()
{
{
ApplicationDomainEx
.
MessageManager
.
Register
<
ProjectOpenMessage
>(
this
,
this
.
OnProjectOpenMessage
);
ApplicationDomainEx
.
MessageManager
.
Register
<
ProjectOpenMessage
>(
this
,
this
.
OnProjectOpenMessage
);
ApplicationDomainEx
.
MessageManager
.
Register
<
ProjectCloseMessage
>(
this
,
this
.
OnProjectCloseMessage
);
ApplicationDomainEx
.
MessageManager
.
Register
<
ProjectCloseMessage
>(
this
,
this
.
OnProjectCloseMessage
);
...
@@ -68,6 +71,21 @@ namespace VIZ.Package.Module
...
@@ -68,6 +71,21 @@ namespace VIZ.Package.Module
/// </summary>
/// </summary>
private
PageService
pageService
=
new
PageService
();
private
PageService
pageService
=
new
PageService
();
/// <summary>
/// Viz命令服务
/// </summary>
private
VizCommandService
vizCommandService
=
new
VizCommandService
();
/// <summary>
/// Viz控制对象服务
/// </summary>
private
VizCommandControlObjectService
vizCommandControlObjectService
=
new
VizCommandControlObjectService
();
/// <summary>
/// 控制对象服务
/// </summary>
private
ControlObjectService
controlObjectService
=
new
ControlObjectService
();
// ======================================================================================
// ======================================================================================
// Property
// Property
// ======================================================================================
// ======================================================================================
...
@@ -160,17 +178,17 @@ namespace VIZ.Package.Module
...
@@ -160,17 +178,17 @@ namespace VIZ.Package.Module
// Command
// Command
// ======================================================================================
// ======================================================================================
#
region
SceneTemplate
AddToPageGroupCommand
--
场景模板添加至页分组命令
#
region
AddToPageGroupCommand
--
场景模板添加至页分组命令
/// <summary>
/// <summary>
/// 场景模板添加至页分组命令
/// 场景模板添加至页分组命令
/// </summary>
/// </summary>
public
VCommand
SceneTemplate
AddToPageGroupCommand
{
get
;
set
;
}
public
VCommand
AddToPageGroupCommand
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 场景模板添加至页分组
/// 场景模板添加至页分组
/// </summary>
/// </summary>
private
void
SceneTemplate
AddToPageGroup
()
private
void
AddToPageGroup
()
{
{
if
(
this
.
SelectedSceneTemplateModel
==
null
)
if
(
this
.
SelectedSceneTemplateModel
==
null
)
return
;
return
;
...
@@ -211,6 +229,81 @@ namespace VIZ.Package.Module
...
@@ -211,6 +229,81 @@ namespace VIZ.Package.Module
#
endregion
#
endregion
#
region
UpdateCommand
--
更新命令
/// <summary>
/// 更新命令
/// </summary>
public
VCommand
UpdateCommand
{
get
;
set
;
}
/// <summary>
/// 更新
/// </summary>
private
void
Update
()
{
if
(
this
.
SelectedSceneTemplateModel
==
null
)
return
;
IFieldTreeService
service
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
IFieldTreeService
>(
ViewServiceKeys
.
FIELD_TREE_SERVICE
);
if
(
service
==
null
)
return
;
this
.
IsLoading
=
true
;
ThreadHelper
.
SafeRun
(
action
:
()
=>
{
// 重新加载版子
this
.
vizCommandService
.
Reload
(
ApplicationDomainEx
.
PreviewConn
,
this
.
SelectedSceneTemplateModel
.
ScenePath
);
// 获取控制对象
ControlObjectModel
controlObject
=
this
.
vizCommandControlObjectService
.
GetControlObject
(
ApplicationDomainEx
.
PreviewConn
);
// 将控制字段写入数据库
this
.
controlObjectService
.
SaveControlFields
(
this
.
SelectedSceneTemplateModel
,
controlObject
.
AllFiledNodes
);
;
// 如果当前打开的项目是该模板,那么从新打开
if
(
ApplicationDomainEx
.
CurrentPage
==
this
.
SelectedSceneTemplateModel
)
{
WPFHelper
.
Invoke
(()
=>
{
this
.
OpenScenePage
();
});
}
},
final
:
()
=>
{
WPFHelper
.
BeginInvoke
(()
=>
{
this
.
IsLoading
=
false
;
});
});
}
#
endregion
#
region
DeleteCommand
--
删除命令
/// <summary>
/// 删除命令
/// </summary>
public
VCommand
DeleteCommand
{
get
;
set
;
}
/// <summary>
/// 删除
/// </summary>
private
void
Delete
()
{
if
(
this
.
SelectedSceneTemplateModel
==
null
)
return
;
if
(
DXMessageBox
.
Show
(
$"是否删除模板【
{
this
.
SelectedSceneTemplateModel
.
Scene
}
】?"
,
"提示"
,
System
.
Windows
.
MessageBoxButton
.
YesNo
)
!=
System
.
Windows
.
MessageBoxResult
.
Yes
)
return
;
this
.
SceneTemplateModels
.
Remove
(
this
.
SelectedSceneTemplateModel
);
}
#
endregion
// ======================================================================================
// ======================================================================================
// Message
// Message
// ======================================================================================
// ======================================================================================
...
...
VIZ.Package.Service/Viz/VizCommandService.cs
View file @
00756b98
...
@@ -29,6 +29,16 @@ namespace VIZ.Package.Service
...
@@ -29,6 +29,16 @@ namespace VIZ.Package.Service
}
}
/// <summary>
/// <summary>
/// 重新加载场景
/// </summary>
/// <param name="conn">连接</param>
/// <param name="scene">场景</param>
public
void
Reload
(
ConnModel
conn
,
string
scene
)
{
conn
.
EndpointManager
.
Send
(
$"SCENE**
{
scene
}
RELOAD"
);
}
/// <summary>
/// 播放
/// 播放
/// </summary>
/// </summary>
/// <param name="conn">连接</param>
/// <param name="conn">连接</param>
...
@@ -248,7 +258,7 @@ namespace VIZ.Package.Service
...
@@ -248,7 +258,7 @@ namespace VIZ.Package.Service
/// <summary>
/// <summary>
/// 下版子
/// 下版子
/// </summary>
/// </summary>
/// <param name="conn
ection
">连接</param>
/// <param name="conn">连接</param>
/// <param name="layer">层</param>s
/// <param name="layer">层</param>s
public
void
TakeOut
(
ConnModel
conn
,
VizLayer
layer
)
public
void
TakeOut
(
ConnModel
conn
,
VizLayer
layer
)
{
{
...
...
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