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
174960a1
Commit
174960a1
authored
Feb 22, 2023
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
板子自定义字段支持
parent
35d7c36d
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
348 additions
and
53 deletions
+348
-53
Doc/控制对象自定义字段.txt
+15
-0
VIZ.Package.Domain/ApplicationConstants.cs
+10
-0
VIZ.Package.Domain/Model/ControlObject/ControlFieldNodeModel.cs
+14
-0
VIZ.Package.Domain/Model/ControlObject/ControlObjectModel.cs
+14
-0
VIZ.Package.Module.Resource/Icons/icon_custom_32x32.png
+0
-0
VIZ.Package.Module.Resource/VIZ.Package.Module.Resource.csproj
+4
-0
VIZ.Package.Module/ControlObject/FieldEdit/Edit/BooleanEdit/BooleanEditPanelModel.cs
+12
-5
VIZ.Package.Module/ControlObject/FieldEdit/Edit/DupletEdit/DupletEditPanelModel.cs
+12
-5
VIZ.Package.Module/ControlObject/FieldEdit/Edit/FloatEdit/FloatEditPanelModel.cs
+12
-5
VIZ.Package.Module/ControlObject/FieldEdit/Edit/FontEdit/FontEditPanelModel.cs
+12
-5
VIZ.Package.Module/ControlObject/FieldEdit/Edit/ImageEdit/ImageEditPanelModel.cs
+12
-5
VIZ.Package.Module/ControlObject/FieldEdit/Edit/IntegerEdit/IntegerEditPanelModel.cs
+12
-5
VIZ.Package.Module/ControlObject/FieldEdit/Edit/RichTextEdit/RichTextEditPanelModel.cs
+12
-5
VIZ.Package.Module/ControlObject/FieldEdit/Edit/TextEdit/TextEditPanelModel.cs
+12
-5
VIZ.Package.Module/ControlObject/FieldEdit/Edit/TripletEdit/TripletEditPanelModel.cs
+12
-5
VIZ.Package.Module/ControlObject/FieldTree/View/FieldTreeView.xaml
+12
-0
VIZ.Package.Module/Preview/VizPreview/View/VizPreviewView.xaml
+1
-1
VIZ.Package.Service/DB/ControlObject/ControlObjectService.cs
+2
-0
VIZ.Package.Service/VIZ.Package.Service.csproj
+1
-0
VIZ.Package.Service/Viz/VizCommandControlObjectService.Custom.cs
+130
-0
VIZ.Package.Service/Viz/VizCommandControlObjectService.cs
+17
-6
VIZ.Package.Storage/Entity/ControlObject/ControlFieldEntity.cs
+5
-0
VIZ.Package.Storage/Entity/ControlObject/ControlObjectEntity.cs
+5
-0
VIZ.Package.Storage/Enum/VizControlFieldType.cs
+7
-1
VIZ.Package.sln
+3
-0
No files found.
Doc/控制对象自定义字段.txt
0 → 100644
View file @
174960a1
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
Viz控制字段自定义规则
---------------------------------------------------------------------------------
字段定义方法: VIZ_CUSTOM_CONTROL_FIELD_DEFINE
字段定义返回格式: FieldIdentifier|Value|Type|Description*FieldIdentifier|Value|Type|Description
备注: 多个字段使用“*”分割
字段设置值: VIZ_CUSTOM_CONTROL_FIELD_SET
参数: FieldIdentifier|Value|FieldIdentifier|Value
备注: 多个字段使用“*”分割
Type类型定义: custom_video : 自定义视频
\ No newline at end of file
VIZ.Package.Domain/ApplicationConstants.cs
View file @
174960a1
...
...
@@ -38,6 +38,16 @@ namespace VIZ.Package.Domain
public
const
string
VIZ_COMMAND_RESULT_ERROR_PREFIX
=
"ERROR"
;
/// <summary>
/// VIZ自定义字段定义方法名
/// </summary>
public
const
string
VIZ_COMMAND_CUSTOM_CONTROL_FIELD_DEFINE
=
"VIZ_CUSTOM_CONTROL_FIELD_DEFINE"
;
/// <summary>
/// VIZ自定义字段
/// </summary>
public
const
string
VIZ_COMMAND_CUSTOM_CONTROL_FIELD_SET
=
"VIZ_CUSTOM_CONTROL_FIELD_SET"
;
/// <summary>
/// Viz 层集合
/// </summary>
public
readonly
static
List
<
VizLayer
>
VIZ_LAYERS
=
new
List
<
VizLayer
>
{
VizLayer
.
FRONT_LAYER
,
VizLayer
.
MAIN_LAYER
,
VizLayer
.
BACK_LAYER
};
...
...
VIZ.Package.Domain/Model/ControlObject/ControlFieldNodeModel.cs
View file @
174960a1
...
...
@@ -125,5 +125,19 @@ namespace VIZ.Package.Domain
}
#
endregion
#
region
IsCustom
--
是否是自定义字段
private
bool
isCustom
;
/// <summary>
/// 是否是自定义字段
/// </summary>
public
bool
IsCustom
{
get
{
return
isCustom
;
}
set
{
isCustom
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
IsCustom
));
}
}
#
endregion
}
}
VIZ.Package.Domain/Model/ControlObject/ControlObjectModel.cs
View file @
174960a1
...
...
@@ -83,6 +83,20 @@ namespace VIZ.Package.Domain
#
endregion
#
region
CustomFieldDetails
--
自定义字段描述
private
string
customFieldDetails
;
/// <summary>
/// 自定义字段描述
/// </summary>
public
string
CustomFieldDetails
{
get
{
return
customFieldDetails
;
}
set
{
customFieldDetails
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
CustomFieldDetails
));
}
}
#
endregion
#
region
FieldNodes
--
字段节点集合
private
List
<
ControlFieldNodeModel
>
fieldNodes
=
new
List
<
ControlFieldNodeModel
>();
...
...
VIZ.Package.Module.Resource/Icons/icon_custom_32x32.png
0 → 100644
View file @
174960a1
714 Bytes
VIZ.Package.Module.Resource/VIZ.Package.Module.Resource.csproj
View file @
174960a1
...
...
@@ -270,5 +270,8 @@
<Resource Include="Icons\icon_field_edit_32x32.png" />
<Resource Include="Icons\icon_play_list_32x32.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\icon_custom_32x32.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
VIZ.Package.Module/ControlObject/FieldEdit/Edit/BooleanEdit/BooleanEditPanelModel.cs
View file @
174960a1
...
...
@@ -124,11 +124,18 @@ namespace VIZ.Package.Module
{
this
.
ControlField
.
Value
=
this
.
EditValue
?
"1"
:
"0"
;
this
.
VizCommandControlObjectService
.
SetControlObjectValue
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
.
TreeNodePath
,
this
.
ControlField
.
FieldIdentifier
,
this
.
ControlField
.
Value
);
if
(!
this
.
ControlField
.
IsCustom
)
{
this
.
VizCommandControlObjectService
.
SetControlObjectValue
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
.
TreeNodePath
,
this
.
ControlField
.
FieldIdentifier
,
this
.
ControlField
.
Value
);
}
else
{
this
.
VizCommandControlObjectService
.
SetCustomControlFieldValue
(
ApplicationDomainEx
.
PreviewConn
,
new
List
<
ControlFieldNodeModel
>
{
this
.
ControlField
});
}
return
;
}
...
...
VIZ.Package.Module/ControlObject/FieldEdit/Edit/DupletEdit/DupletEditPanelModel.cs
View file @
174960a1
...
...
@@ -262,11 +262,18 @@ namespace VIZ.Package.Module
{
this
.
ControlField
.
Value
=
this
.
Text
;
this
.
VizCommandControlObjectService
.
SetControlObjectValue
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
.
TreeNodePath
,
this
.
ControlField
.
FieldIdentifier
,
this
.
ControlField
.
Value
);
if
(!
this
.
ControlField
.
IsCustom
)
{
this
.
VizCommandControlObjectService
.
SetControlObjectValue
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
.
TreeNodePath
,
this
.
ControlField
.
FieldIdentifier
,
this
.
ControlField
.
Value
);
}
else
{
this
.
VizCommandControlObjectService
.
SetCustomControlFieldValue
(
ApplicationDomainEx
.
PreviewConn
,
new
List
<
ControlFieldNodeModel
>
{
this
.
ControlField
});
}
return
;
}
...
...
VIZ.Package.Module/ControlObject/FieldEdit/Edit/FloatEdit/FloatEditPanelModel.cs
View file @
174960a1
...
...
@@ -111,11 +111,18 @@ namespace VIZ.Package.Module
{
this
.
ControlField
.
Value
=
this
.
EditValue
.
ToString
();
this
.
VizCommandControlObjectService
.
SetControlObjectValue
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
.
TreeNodePath
,
this
.
ControlField
.
FieldIdentifier
,
this
.
ControlField
.
Value
);
if
(!
this
.
ControlField
.
IsCustom
)
{
this
.
VizCommandControlObjectService
.
SetControlObjectValue
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
.
TreeNodePath
,
this
.
ControlField
.
FieldIdentifier
,
this
.
ControlField
.
Value
);
}
else
{
this
.
VizCommandControlObjectService
.
SetCustomControlFieldValue
(
ApplicationDomainEx
.
PreviewConn
,
new
List
<
ControlFieldNodeModel
>
{
this
.
ControlField
});
}
return
;
}
...
...
VIZ.Package.Module/ControlObject/FieldEdit/Edit/FontEdit/FontEditPanelModel.cs
View file @
174960a1
...
...
@@ -118,11 +118,18 @@ namespace VIZ.Package.Module
{
this
.
ControlField
.
Value
=
this
.
Path
;
this
.
VizCommandControlObjectService
.
SetControlObjectValue
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
.
TreeNodePath
,
this
.
ControlField
.
FieldIdentifier
,
this
.
ControlField
.
Value
);
if
(!
this
.
ControlField
.
IsCustom
)
{
this
.
VizCommandControlObjectService
.
SetControlObjectValue
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
.
TreeNodePath
,
this
.
ControlField
.
FieldIdentifier
,
this
.
ControlField
.
Value
);
}
else
{
this
.
VizCommandControlObjectService
.
SetCustomControlFieldValue
(
ApplicationDomainEx
.
PreviewConn
,
new
List
<
ControlFieldNodeModel
>
{
this
.
ControlField
});
}
return
;
}
...
...
VIZ.Package.Module/ControlObject/FieldEdit/Edit/ImageEdit/ImageEditPanelModel.cs
View file @
174960a1
...
...
@@ -167,11 +167,18 @@ namespace VIZ.Package.Module
{
this
.
ControlField
.
Value
=
this
.
Path
;
this
.
VizCommandControlObjectService
.
SetControlObjectValue
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
.
TreeNodePath
,
this
.
ControlField
.
FieldIdentifier
,
this
.
ControlField
.
Value
);
if
(!
this
.
ControlField
.
IsCustom
)
{
this
.
VizCommandControlObjectService
.
SetControlObjectValue
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
.
TreeNodePath
,
this
.
ControlField
.
FieldIdentifier
,
this
.
ControlField
.
Value
);
}
else
{
this
.
VizCommandControlObjectService
.
SetCustomControlFieldValue
(
ApplicationDomainEx
.
PreviewConn
,
new
List
<
ControlFieldNodeModel
>
{
this
.
ControlField
});
}
return
;
}
...
...
VIZ.Package.Module/ControlObject/FieldEdit/Edit/IntegerEdit/IntegerEditPanelModel.cs
View file @
174960a1
...
...
@@ -111,11 +111,18 @@ namespace VIZ.Package.Module
{
this
.
ControlField
.
Value
=
this
.
EditValue
.
ToString
();
this
.
VizCommandControlObjectService
.
SetControlObjectValue
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
.
TreeNodePath
,
this
.
ControlField
.
FieldIdentifier
,
this
.
ControlField
.
Value
);
if
(!
this
.
ControlField
.
IsCustom
)
{
this
.
VizCommandControlObjectService
.
SetControlObjectValue
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
.
TreeNodePath
,
this
.
ControlField
.
FieldIdentifier
,
this
.
ControlField
.
Value
);
}
else
{
this
.
VizCommandControlObjectService
.
SetCustomControlFieldValue
(
ApplicationDomainEx
.
PreviewConn
,
new
List
<
ControlFieldNodeModel
>
{
this
.
ControlField
});
}
return
;
}
...
...
VIZ.Package.Module/ControlObject/FieldEdit/Edit/RichTextEdit/RichTextEditPanelModel.cs
View file @
174960a1
...
...
@@ -124,11 +124,18 @@ namespace VIZ.Package.Module
string
richText
=
$"
{
RICH_TEXT_LEFT
}{
this
.
Text
}{
RICH_TEXT_RIGHT
}
"
;
this
.
ControlField
.
Value
=
richText
;
this
.
VizCommandControlObjectService
.
SetControlObjectValue
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
.
TreeNodePath
,
this
.
ControlField
.
FieldIdentifier
,
this
.
ControlField
.
Value
);
if
(!
this
.
ControlField
.
IsCustom
)
{
this
.
VizCommandControlObjectService
.
SetControlObjectValue
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
.
TreeNodePath
,
this
.
ControlField
.
FieldIdentifier
,
this
.
ControlField
.
Value
);
}
else
{
this
.
VizCommandControlObjectService
.
SetCustomControlFieldValue
(
ApplicationDomainEx
.
PreviewConn
,
new
List
<
ControlFieldNodeModel
>
{
this
.
ControlField
});
}
return
;
}
...
...
VIZ.Package.Module/ControlObject/FieldEdit/Edit/TextEdit/TextEditPanelModel.cs
View file @
174960a1
...
...
@@ -113,11 +113,18 @@ namespace VIZ.Package.Module
{
this
.
ControlField
.
Value
=
this
.
Text
;
this
.
VizCommandControlObjectService
.
SetControlObjectValue
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
.
TreeNodePath
,
this
.
ControlField
.
FieldIdentifier
,
this
.
ControlField
.
Value
);
if
(!
this
.
ControlField
.
IsCustom
)
{
this
.
VizCommandControlObjectService
.
SetControlObjectValue
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
.
TreeNodePath
,
this
.
ControlField
.
FieldIdentifier
,
this
.
ControlField
.
Value
);
}
else
{
this
.
VizCommandControlObjectService
.
SetCustomControlFieldValue
(
ApplicationDomainEx
.
PreviewConn
,
new
List
<
ControlFieldNodeModel
>
{
this
.
ControlField
});
}
return
;
}
...
...
VIZ.Package.Module/ControlObject/FieldEdit/Edit/TripletEdit/TripletEditPanelModel.cs
View file @
174960a1
...
...
@@ -288,11 +288,18 @@ namespace VIZ.Package.Module
{
this
.
ControlField
.
Value
=
this
.
Text
;
this
.
VizCommandControlObjectService
.
SetControlObjectValue
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
.
TreeNodePath
,
this
.
ControlField
.
FieldIdentifier
,
this
.
ControlField
.
Value
);
if
(!
this
.
ControlField
.
IsCustom
)
{
this
.
VizCommandControlObjectService
.
SetControlObjectValue
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
.
TreeNodePath
,
this
.
ControlField
.
FieldIdentifier
,
this
.
ControlField
.
Value
);
}
else
{
this
.
VizCommandControlObjectService
.
SetCustomControlFieldValue
(
ApplicationDomainEx
.
PreviewConn
,
new
List
<
ControlFieldNodeModel
>
{
this
.
ControlField
});
}
return
;
}
...
...
VIZ.Package.Module/ControlObject/FieldTree/View/FieldTreeView.xaml
View file @
174960a1
...
...
@@ -16,10 +16,22 @@
d:DataContext="{d:DesignInstance Type=local:FieldTreeViewModel}"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<fcore:Bool2VisibilityConverter x:Key="Bool2VisibilityConverter"></fcore:Bool2VisibilityConverter>
</UserControl.Resources>
<Grid>
<dxg:GridControl ItemsSource="{Binding Path=ControlObject.FieldNodes}" ShowBorder="False"
SelectedItem="{Binding Path=SelectedControlField,Mode=TwoWay}">
<dxg:GridControl.Columns>
<dxg:GridColumn Header="" FieldName="IsCustom" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="30" AllowResizing="True">
<dxg:GridColumn.CellTemplate>
<DataTemplate>
<Image Source="/VIZ.Package.Module.Resource;component/Icons/icon_custom_32x32.png" Width="14" Height="14"
Visibility="{Binding Path=Row.IsCustom,Converter={StaticResource Bool2VisibilityConverter}}"></Image>
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
<dxg:GridColumn Header="字段" FieldName="FieldIdentifier" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="150" AllowResizing="True"></dxg:GridColumn>
<dxg:GridColumn Header="类型" FieldName="Type" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="100" AllowResizing="True"></dxg:GridColumn>
<dxg:GridColumn Header="描述" FieldName="Description" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="*" AllowResizing="True"></dxg:GridColumn>
...
...
VIZ.Package.Module/Preview/VizPreview/View/VizPreviewView.xaml
View file @
174960a1
...
...
@@ -95,7 +95,7 @@
</StackPanel>
</Grid>
<!-- VIZ引擎 -->
<fcommon:WindowHost x:Name="host" Grid.Row="1" Background="
Black" BackColor="Black
">
<fcommon:WindowHost x:Name="host" Grid.Row="1" Background="
#FF222222" BackColor="#FF222222
">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand PassEventArgsToCommand="True" EventName="SizeChanged"
Command="{Binding Path=WindowHostSizeChangedCommand}"></dxmvvm:EventToCommand>
...
...
VIZ.Package.Service/DB/ControlObject/ControlObjectService.cs
View file @
174960a1
...
...
@@ -43,6 +43,7 @@ namespace VIZ.Package.Service
entity
.
FieldIdentifier
=
field
.
FieldIdentifier
;
entity
.
Value
=
field
.
Value
;
entity
.
Type
=
field
.
Type
;
entity
.
IsCustom
=
field
.
IsCustom
;
list
.
Add
(
entity
);
}
...
...
@@ -123,6 +124,7 @@ namespace VIZ.Package.Service
entity
.
Description
=
obj
.
Description
;
entity
.
UseAllDirectors
=
obj
.
UseAllDirectors
;
entity
.
FieldDetails
=
obj
.
FieldDetails
;
entity
.
CustomFieldDetails
=
obj
.
CustomFieldDetails
;
ApplicationDomainEx
.
ProjectDbContext
.
ControlObject
.
Upsert
(
entity
);
}
...
...
VIZ.Package.Service/VIZ.Package.Service.csproj
View file @
174960a1
...
...
@@ -77,6 +77,7 @@
<Compile Include="DB\Registry\RegistryService.cs" />
<Compile Include="Logic\Plugin\PluginService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Viz\VizCommandControlObjectService.Custom.cs" />
<Compile Include="Viz\VizControlObjectDownloadService.cs" />
<Compile Include="Viz\GHResourceService.cs" />
<Compile Include="Viz\GHService.cs" />
...
...
VIZ.Package.Service/Viz/VizCommandControlObjectService.Custom.cs
0 → 100644
View file @
174960a1
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.Service
{
/// <summary>
/// VIZ命令ControlObject服务 -- 自定义控制字段
/// </summary>
public
partial
class
VizCommandControlObjectService
{
/// <summary>
/// 获取控制字段信息
/// </summary>
/// <param name="conn">连接</param>
/// <param name="obj">控制对象</param>
/// <returns>控制字段列表</returns>
public
List
<
ControlFieldNodeModel
>
GetCustomControlFields
(
ConnModel
conn
,
ControlObjectModel
obj
)
{
List
<
ControlFieldNodeModel
>
fields
=
new
List
<
ControlFieldNodeModel
>();
// Step 1. 获取自定义字段
string
define
=
conn
.
EndpointManager
.
Request
(
string
.
Format
(
VizEngineCommands
.
SCRIPT_INVOKE
,
ApplicationConstants
.
VIZ_COMMAND_CUSTOM_CONTROL_FIELD_DEFINE
,
string
.
Empty
));
if
(
string
.
IsNullOrWhiteSpace
(
define
)
||
ApplicationConstants
.
VIZ_COMMAND_RESULT_ERROR_PREFIX
.
StartsWith
(
define
))
{
obj
.
CustomFieldDetails
=
null
;
return
fields
;
}
obj
.
CustomFieldDetails
=
define
;
// Step 2. 构建自定义字段信息
fields
=
this
.
GetCustomControlFields
(
define
,
obj
);
return
fields
;
}
/// <summary>
/// 设置自定义控制字段值
/// </summary>
/// <param name="conn">连接</param>
/// <param name="fields">控制字段集合</param>
public
void
SetCustomControlFieldValue
(
ConnModel
conn
,
List
<
ControlFieldNodeModel
>
fields
)
{
if
(
fields
==
null
||
fields
.
Count
==
0
)
return
;
List
<
ControlFieldNodeModel
>
list
=
fields
.
Where
(
p
=>
p
.
IsCustom
).
ToList
();
if
(
list
.
Count
==
0
)
return
;
// FieldIdentifier|Value*FieldIdentifier|Value
List
<
string
>
field_infos
=
list
.
Select
(
p
=>
string
.
Format
(
"{0}|{1}"
,
p
.
FieldIdentifier
,
p
.
Value
)).
ToList
();
string
command
=
string
.
Join
(
"*"
,
field_infos
);
conn
.
EndpointManager
.
Send
(
string
.
Format
(
VizEngineCommands
.
SCRIPT_INVOKE
,
ApplicationConstants
.
VIZ_COMMAND_CUSTOM_CONTROL_FIELD_SET
,
command
));
}
/// <summary>
/// 更新自定义控制字段
/// </summary>
/// <param name="conn">连接</param>
/// <param name="model">控制对象</param>
/// <param name="customFieldDetails">自定义控制字段描述</param>
/// <param name="isGetValueFromViz">是否需要从Viz中获取数据</param>
public
void
UpdateCustomControlOjbectField
(
ConnModel
conn
,
ControlObjectModel
model
,
string
customFieldDetails
,
bool
isGetValueFromViz
)
{
List
<
ControlFieldNodeModel
>
fields
=
null
;
if
(
isGetValueFromViz
)
{
fields
=
this
.
GetCustomControlFields
(
conn
,
model
);
model
.
FieldNodes
.
AddRange
(
fields
);
model
.
AllFiledNodes
.
AddRange
(
fields
);
return
;
}
fields
=
this
.
GetCustomControlFields
(
model
.
CustomFieldDetails
,
model
);
model
.
FieldNodes
.
AddRange
(
fields
);
model
.
AllFiledNodes
.
AddRange
(
fields
);
}
// ============================================================================================
// Private Function
// ============================================================================================
/// <summary>
/// 获取自定义字段
/// </summary>
/// <param name="customFieldDetails">自定义字段描述</param>
/// <param name="obj">控制对象</param>
/// <returns>自定义字段描述</returns>
private
List
<
ControlFieldNodeModel
>
GetCustomControlFields
(
string
customFieldDetails
,
ControlObjectModel
obj
)
{
List
<
ControlFieldNodeModel
>
fields
=
new
List
<
ControlFieldNodeModel
>();
if
(
string
.
IsNullOrWhiteSpace
(
customFieldDetails
)
||
ApplicationConstants
.
VIZ_COMMAND_RESULT_ERROR_PREFIX
.
StartsWith
(
customFieldDetails
))
return
fields
;
// FieldIdentifier|Value|Type|Description*FieldIdentifier|Value|Type|Description
string
[]
define_fields
=
customFieldDetails
.
Split
(
new
char
[]
{
'*'
},
StringSplitOptions
.
RemoveEmptyEntries
);
foreach
(
string
define_field
in
define_fields
)
{
if
(
string
.
IsNullOrWhiteSpace
(
define_field
))
continue
;
// FieldIdentifier|Value|Type|Description
string
[]
pars
=
define_field
.
Split
(
new
char
[]
{
'|'
},
StringSplitOptions
.
RemoveEmptyEntries
);
if
(
pars
.
Length
!=
4
)
continue
;
ControlFieldNodeModel
model
=
new
ControlFieldNodeModel
();
model
.
FieldIdentifier
=
pars
[
0
];
model
.
Value
=
pars
[
1
];
model
.
Type
=
this
.
GetControlFieldType
(
pars
[
2
]);
model
.
Description
=
pars
[
3
];
model
.
IsCustom
=
true
;
fields
.
Add
(
model
);
}
return
fields
;
}
}
}
VIZ.Package.Service/Viz/VizCommandControlObjectService.cs
View file @
174960a1
...
...
@@ -16,7 +16,7 @@ namespace VIZ.Package.Service
/// <summary>
/// VIZ命令ControlObject服务
/// </summary>
public
class
VizCommandControlObjectService
public
partial
class
VizCommandControlObjectService
{
/// <summary>
/// 日志
...
...
@@ -250,6 +250,7 @@ namespace VIZ.Package.Service
model
.
Description
=
entity
.
Description
;
model
.
UseAllDirectors
=
entity
.
UseAllDirectors
;
model
.
FieldDetails
=
entity
.
FieldDetails
??
string
.
Empty
;
model
.
CustomFieldDetails
=
entity
.
CustomFieldDetails
??
string
.
Empty
;
this
.
UpdateControlObjectField
(
null
,
model
,
model
.
FieldDetails
,
false
);
}
...
...
@@ -325,6 +326,10 @@ namespace VIZ.Package.Service
sb
.
Append
(
$"MAIN_SCENE*TREE*
{
obj
.
TreeNodePath
}
*FUNCTION*ControlObject*in SET ON "
);
foreach
(
ControlFieldNodeModel
field
in
obj
.
AllFiledNodes
)
{
// 自定义字段不通过该方法上板
if
(
field
.
IsCustom
)
continue
;
sb
.
Append
(
$"
{
field
.
FieldIdentifier
}
SET
{
field
.
Value
}
\\0"
);
}
...
...
@@ -393,16 +398,12 @@ namespace VIZ.Package.Service
}
}
// =======================================================================
// Private Function
// =======================================================================
/// <summary>
/// 获取控制字段类型
/// </summary>
/// <param name="type">字段类型</param>
/// <returns>控制对象字段类型</returns>
p
rivate
VizControlFieldType
GetControlFieldType
(
string
type
)
p
ublic
VizControlFieldType
GetControlFieldType
(
string
type
)
{
if
(
type
==
"text"
)
return
VizControlFieldType
.
text
;
...
...
@@ -434,9 +435,16 @@ namespace VIZ.Package.Service
if
(
type
.
StartsWith
(
"<?xml"
))
return
VizControlFieldType
.
list
;
if
(
type
==
"custom_video"
)
return
VizControlFieldType
.
custom_video
;
return
VizControlFieldType
.
none
;
}
// =======================================================================
// Private Function
// =======================================================================
/// <summary>
/// 更新控制对象字段
/// </summary>
...
...
@@ -503,6 +511,9 @@ namespace VIZ.Package.Service
}
model
.
FieldNodes
=
fieldNodes
;
// Step 7. 更新自定义字段
this
.
UpdateCustomControlOjbectField
(
conn
,
model
,
model
.
CustomFieldDetails
,
isGetValueFromViz
);
}
}
}
VIZ.Package.Storage/Entity/ControlObject/ControlFieldEntity.cs
View file @
174960a1
...
...
@@ -37,5 +37,10 @@ namespace VIZ.Package.Storage
/// 字段类型
/// </summary>
public
VizControlFieldType
Type
{
get
;
set
;
}
/// <summary>
/// 是否是自定义字段
/// </summary>
public
bool
IsCustom
{
get
;
set
;
}
}
}
VIZ.Package.Storage/Entity/ControlObject/ControlObjectEntity.cs
View file @
174960a1
...
...
@@ -47,5 +47,10 @@ namespace VIZ.Package.Storage
/// 字段描述
/// </summary>
public
string
FieldDetails
{
get
;
set
;
}
/// <summary>
/// 自定义字段描述
/// </summary>
public
string
CustomFieldDetails
{
get
;
set
;
}
}
}
VIZ.Package.Storage/Enum/VizControlFieldType.cs
View file @
174960a1
...
...
@@ -76,6 +76,12 @@ namespace VIZ.Package.Storage
/// 字体
/// </summary>
[
Description
(
"字体"
)]
font
font
,
/// <summary>
/// 自定义 视频
/// </summary>
[
Description
(
"自定义 视频"
)]
custom_video
}
}
VIZ.Package.sln
View file @
174960a1
...
...
@@ -4,6 +4,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 17.3.32825.248
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "00-Doc", "00-Doc", "{4F55B183-4696-461C-8284-040FA7472C39}"
ProjectSection(SolutionItems) = preProject
Doc\控制对象自定义字段.txt = Doc\控制对象自定义字段.txt
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "05-Lib", "05-Lib", "{B20052FB-8BF7-4D72-8B38-EC0D5C05093B}"
EndProject
...
...
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