Commit d8aa0168 by liulongfei

字段树获取

parent 143b88fa
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 VizTreeNodeInfo
{
/// <summary>
/// 节点路径
/// </summary>
/// <remarks>
/// Example: 1/3/3
/// </remarks>
public string Path { get; set; }
/// <summary>
/// 节点编号
/// </summary>
/// <remarks>
/// Example: 407
/// </remarks>
public string Num { get; set; }
/// <summary>
/// 节点名称
/// </summary>
public string Name { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.Package.Storage;
namespace VIZ.Package.Domain
{
/// <summary>
/// 控制字段节点模型
/// </summary>
public class ControlFieldNodeModel : ModelBase
{
#region Route -- 属性路由
private List<string> route;
/// <summary>
/// 属性路由
/// </summary>
public List<string> Route
{
get { return route; }
set { route = value; this.RaisePropertyChanged(nameof(Route)); }
}
#endregion
#region TreeNodePath -- 树节点路径
private string treeNodePath;
/// <summary>
/// 树节点路径
/// </summary>
public string TreeNodePath
{
get { return treeNodePath; }
set { treeNodePath = value; this.RaisePropertyChanged(nameof(TreeNodePath)); }
}
#endregion
#region FieldIdentifier -- 字段名称
private string fieldIdentifier;
/// <summary>
/// 字段名称
/// </summary>
public string FieldIdentifier
{
get { return fieldIdentifier; }
set { fieldIdentifier = value; this.RaisePropertyChanged(nameof(FieldIdentifier)); }
}
#endregion
#region Description -- 描述
private string description;
/// <summary>
/// 描述
/// </summary>
public string Description
{
get { return description; }
set { description = value; this.RaisePropertyChanged(nameof(Description)); }
}
#endregion
#region Value -- 字段值
private string _value;
/// <summary>
/// 字段值
/// </summary>
public string Value
{
get { return _value; }
set { _value = value; this.RaisePropertyChanged(nameof(Value)); }
}
#endregion
#region Type -- 字段类型
private VizControlFieldType type;
/// <summary>
/// 字段类型
/// </summary>
public VizControlFieldType Type
{
get { return type; }
set { type = value; this.RaisePropertyChanged(nameof(Type)); }
}
#endregion
#region TypeSchema -- 字段类型定义
private string typeSchema;
/// <summary>
/// 字段类型定义
/// </summary>
public string TypeSchema
{
get { return typeSchema; }
set { typeSchema = value; this.RaisePropertyChanged(nameof(TypeSchema)); }
}
#endregion
#region Items -- 子节点集合
private List<ControlFieldNodeModel> items = new List<ControlFieldNodeModel>();
/// <summary>
/// 子节点集合
/// </summary>
public List<ControlFieldNodeModel> Items
{
get { return items; }
set { items = value; this.RaisePropertyChanged(nameof(Items)); }
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.Package.Domain
{
/// <summary>
/// 控制对象模型
/// </summary>
public class ControlObjectModel : ModelBase
{
#region TreeNodeName -- 所在场景节点名称
private string treeNodeName;
/// <summary>
/// 所在场景节点名称
/// </summary>
public string TreeNodeName
{
get { return treeNodeName; }
set { treeNodeName = value; this.RaisePropertyChanged(nameof(TreeNodeName)); }
}
#endregion
#region TreeNodePath -- 所在场景节点路径
private string treeNodePath;
/// <summary>
/// 所在场景节点路径
/// </summary>
public string TreeNodePath
{
get { return treeNodePath; }
set { treeNodePath = value; this.RaisePropertyChanged(nameof(TreeNodePath)); }
}
#endregion
#region Description -- 描述
private string description;
/// <summary>
/// 描述
/// </summary>
public string Description
{
get { return description; }
set { description = value; this.RaisePropertyChanged(nameof(Description)); }
}
#endregion
#region UseAllDirectors -- 使用所有的控制器
private bool useAllDirectors;
/// <summary>
/// 使用所有的控制器
/// </summary>
public bool UseAllDirectors
{
get { return useAllDirectors; }
set { useAllDirectors = value; this.RaisePropertyChanged(nameof(UseAllDirectors)); }
}
#endregion
#region FieldNodes -- 字段节点集合
private List<ControlFieldNodeModel> fieldNodes = new List<ControlFieldNodeModel>();
/// <summary>
/// 字段节点集合
/// </summary>
public List<ControlFieldNodeModel> FieldNodes
{
get { return fieldNodes; }
set { fieldNodes = value; this.RaisePropertyChanged(nameof(FieldNodes)); }
}
#endregion
#region AllFiledNodes -- 所有字段节点集合
private List<ControlFieldNodeModel> allFiledNodes = new List<ControlFieldNodeModel>();
/// <summary>
/// 所有字段节点集合
/// </summary>
public List<ControlFieldNodeModel> AllFiledNodes
{
get { return allFiledNodes; }
set { allFiledNodes = value; this.RaisePropertyChanged(nameof(AllFiledNodes)); }
}
#endregion
}
}
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
<Compile Include="ApplicationDomainEx.cs" /> <Compile Include="ApplicationDomainEx.cs" />
<Compile Include="Enum\ModulePluginIds.cs" /> <Compile Include="Enum\ModulePluginIds.cs" />
<Compile Include="Enum\ViewServiceKeys.cs" /> <Compile Include="Enum\ViewServiceKeys.cs" />
<Compile Include="Info\VizTreeNodeInfo.cs" />
<Compile Include="Message\Page\PageOpenMessage.cs" /> <Compile Include="Message\Page\PageOpenMessage.cs" />
<Compile Include="Message\Page\PageInitedMessage.cs" /> <Compile Include="Message\Page\PageInitedMessage.cs" />
<Compile Include="Message\Project\ProjectSaveMessage.cs" /> <Compile Include="Message\Project\ProjectSaveMessage.cs" />
...@@ -80,6 +81,8 @@ ...@@ -80,6 +81,8 @@
<Compile Include="Model\Conn\ConnGroupModel.cs" /> <Compile Include="Model\Conn\ConnGroupModel.cs" />
<Compile Include="Model\Conn\ConnModel.cs" /> <Compile Include="Model\Conn\ConnModel.cs" />
<Compile Include="Core\IPackageEndpointManager.cs" /> <Compile Include="Core\IPackageEndpointManager.cs" />
<Compile Include="Model\ControlObject\ControlFieldNodeModel.cs" />
<Compile Include="Model\ControlObject\ControlObjectModel.cs" />
<Compile Include="Model\Page\PageGroupModel.cs" /> <Compile Include="Model\Page\PageGroupModel.cs" />
<Compile Include="Model\Page\PageModel.cs" /> <Compile Include="Model\Page\PageModel.cs" />
<Compile Include="Model\Page\PageModelBase.cs" /> <Compile Include="Model\Page\PageModelBase.cs" />
...@@ -122,8 +125,6 @@ ...@@ -122,8 +125,6 @@
<Name>VIZ.Package.Storage</Name> <Name>VIZ.Package.Storage</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup />
<Folder Include="Model\Viz\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>
\ No newline at end of file
...@@ -4,6 +4,8 @@ using System.Linq; ...@@ -4,6 +4,8 @@ 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;
using VIZ.Package.Service;
namespace VIZ.Package.Module namespace VIZ.Package.Module
{ {
...@@ -12,6 +14,48 @@ namespace VIZ.Package.Module ...@@ -12,6 +14,48 @@ namespace VIZ.Package.Module
/// </summary> /// </summary>
public class FieldTreeViewModel : ViewModelBase public class FieldTreeViewModel : ViewModelBase
{ {
public FieldTreeViewModel()
{
// 初始化消息
this.InitMessage();
}
/// <summary>
/// 初始化消息
/// </summary>
private void InitMessage()
{
ApplicationDomainEx.MessageManager.Register<PageInitedMessage>(this, this.OnPageInitedMessage);
}
// =============================================================
// Service & Controller
// =============================================================
/// <summary>
/// Viz 控制对象命令服务
/// </summary>
private VizCommandControlObjectService vizCommandControlObjectService = new VizCommandControlObjectService();
// =============================================================
// Property
// =============================================================
// =============================================================
// Command
// =============================================================
// =============================================================
// Message
// =============================================================
/// <summary>
/// 页初始化完成消息
/// </summary>
/// <param name="msg">消息</param>
private void OnPageInitedMessage(PageInitedMessage msg)
{
var test = this.vizCommandControlObjectService.GetControlObject(ApplicationDomainEx.PreviewConn);
}
} }
} }
\ No newline at end of file
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Viz\GHResourceService.cs" /> <Compile Include="Viz\GHResourceService.cs" />
<Compile Include="Viz\GHService.cs" /> <Compile Include="Viz\GHService.cs" />
<Compile Include="Viz\VizCommandControlObjectService.cs" />
<Compile Include="Viz\VizCommandService.cs" /> <Compile Include="Viz\VizCommandService.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
......
...@@ -25,7 +25,7 @@ namespace VIZ.Package.Service ...@@ -25,7 +25,7 @@ namespace VIZ.Package.Service
throw new ArgumentNullException(nameof(conn)); throw new ArgumentNullException(nameof(conn));
// 需要等待结果 // 需要等待结果
conn.EndpointManager.Send($"RENDERER*{layer} SET_OBJECT SCENE*{scene}"); conn.EndpointManager.Request($"RENDERER*{layer} SET_OBJECT SCENE*{scene}");
} }
/// <summary> /// <summary>
......
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 ControlDynamicFieldEntity : ControlFieldEntity
{
/// <summary>
/// 所属字段
/// </summary>
public string OwnerFieldIdentifier { get; set; }
/// <summary>
/// 行数, 从0开始
/// </summary>
public int Row { get; set; }
}
}
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 ControlFieldEntity
{
/// <summary>
/// 编号
/// </summary>
[BsonId(true)]
public int Id { get; set; }
/// <summary>
/// 字段名称
/// </summary>
public string FieldIdentifier { get; set; }
/// <summary>
/// 字段值
/// </summary>
public string Value { get; set; }
/// <summary>
/// 字段类型
/// </summary>
public VizControlFieldType Type { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Storage
{
/// <summary>
/// Viz 控制字段类型
/// </summary>
public enum VizControlFieldType
{
/// <summary>
/// 未指定
/// </summary>
[Description("未指定")]
none,
/// <summary>
/// 文本
/// </summary>
[Description("文本")]
text,
/// <summary>
/// Bool值
/// </summary>
[Description("Bool值")]
boolean,
/// <summary>
/// 富文本
/// </summary>
[Description("富文本")]
richtext,
/// <summary>
/// 图片
/// </summary>
[Description("图片")]
image,
/// <summary>
/// 列表
/// </summary>
[Description("列表")]
list,
/// <summary>
/// 三元组
/// </summary>
[Description("三元组")]
triplet
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Storage
{
/// <summary>
/// Viz控制对象参数
/// </summary>
public enum VizControlObjectParameters
{
/// <summary>
/// 描述
/// </summary>
description,
/// <summary>
/// trio 是否已经加载
/// </summary>
trio_loadable,
/// <summary>
/// Viz层
/// </summary>
viz_layer,
/// <summary>
/// 使用所有的控制器
/// </summary>
use_all_directors,
/// <summary>
/// 图层 0 FRONT_LAYER, 1 MAIN_LAYER, 2 BACK_LAYER
/// </summary>
layer,
/// <summary>
/// 状态
/// </summary>
state,
/// <summary>
/// 背景场景
/// </summary>
background
}
}
...@@ -60,6 +60,26 @@ namespace VIZ.Package.Storage ...@@ -60,6 +60,26 @@ namespace VIZ.Package.Storage
public ILiteCollection<PageEntity> Page { get; private set; } public ILiteCollection<PageEntity> Page { get; private set; }
/// <summary> /// <summary>
/// 根据ID获取控制字段, ID 为 TemplateID 或者 PageID
/// </summary>
/// <param name="id">TemplateID 或者 PageID</param>
/// <returns>控制字段</returns>
public ILiteCollection<ControlFieldEntity> GetControlFiled(Guid id)
{
return this.Database.GetCollection<ControlFieldEntity>(id.ToString());
}
/// <summary>
/// 根据ID获取控制动态字段, ID 为 TemplateID 或者 PageID
/// </summary>
/// <param name="id">TemplateID 或者 PageID</param>
/// <returns>控制动态字段</returns>
public ILiteCollection<ControlDynamicFieldEntity> GetControlDynamicFiled(Guid id)
{
return this.Database.GetCollection<ControlDynamicFieldEntity>(id.ToString());
}
/// <summary>
/// 销毁 /// 销毁
/// </summary> /// </summary>
public void Dispose() public void Dispose()
......
...@@ -69,6 +69,8 @@ ...@@ -69,6 +69,8 @@
<ItemGroup> <ItemGroup>
<Compile Include="Entity\Conn\ConnEntity.cs" /> <Compile Include="Entity\Conn\ConnEntity.cs" />
<Compile Include="Entity\Conn\ConnGroupEntity.cs" /> <Compile Include="Entity\Conn\ConnGroupEntity.cs" />
<Compile Include="Entity\ControlObject\ControlDynamicFieldEntity.cs" />
<Compile Include="Entity\ControlObject\ControlFieldEntity.cs" />
<Compile Include="Entity\Page\PageEntityBase.cs" /> <Compile Include="Entity\Page\PageEntityBase.cs" />
<Compile Include="Entity\Page\PageEntity.cs" /> <Compile Include="Entity\Page\PageEntity.cs" />
<Compile Include="Entity\Page\PageGroupEntity.cs" /> <Compile Include="Entity\Page\PageGroupEntity.cs" />
...@@ -77,6 +79,8 @@ ...@@ -77,6 +79,8 @@
<Compile Include="Enum\EngineFullType.cs" /> <Compile Include="Enum\EngineFullType.cs" />
<Compile Include="Enum\EngineType.cs" /> <Compile Include="Enum\EngineType.cs" />
<Compile Include="Enum\PageType.cs" /> <Compile Include="Enum\PageType.cs" />
<Compile Include="Enum\VizControlFieldType.cs" />
<Compile Include="Enum\VizControlObjectParameters.cs" />
<Compile Include="Enum\VizLayer.cs" /> <Compile Include="Enum\VizLayer.cs" />
<Compile Include="LocalDbContext.cs" /> <Compile Include="LocalDbContext.cs" />
<Compile Include="ProjectDbContext.cs" /> <Compile Include="ProjectDbContext.cs" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment