Commit a261c56c by wangonghui

临时数据

parents 6ee12cfa d4cf00b2
<entry>
<entry>
<element complete="true" scene="TITLES/2022/YC/YC_FeiGun_image" name="1000">
<entry name="viz">
<entry name="location"/>
<entry name="front">
<entry name="scene">TITLES/2022/YC/YC_FeiGun_image</entry>
</entry>
<entry name="load">scene</entry>
<entry name="viz_layer"/>
<entry name="use_all_directors">yes</entry>
</entry>
<schema>
<field description="FZZongYi-M05S-Regular" location="1/2" singleline="True" type="richtext" name="1"/>
<field description="Image1" location="1/1" type="image" name="Image1"/>
<field type="float" name="scroll_data.space_before"/>
<field type="float" name="scroll_data.space_after"/>
</schema>
<entry name="data">
<entry name="1">22222222</entry>
<entry name="Image1">IMAGE*TITLES/2022/YC/mu_ad</entry>
<entry name="scroll_data.space_before">0</entry>
<entry name="scroll_data.space_after">0</entry>
</entry>
</element>
</entry>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<update>
<element name="1011" description="12345678" complete="true" showautodescription="true" scene="TITLES/2022/YC/YC_FeiGun_text">
<element complete="true" scene="TITLES/2022/YC/YC_FeiGun_image" name="1000">
<entry name="viz">
<entry name="location"></entry>
<entry name="location"/>
<entry name="front">
<entry name="scene" timestamp="">TITLES/2022/YC/YC_FeiGun_text</entry>
<entry name="scene">TITLES/2022/YC/YC_FeiGun_image</entry>
</entry>
<entry name="load">scene</entry>
<entry name="viz_layer"></entry>
<entry name="viz_layer"/>
<entry name="use_all_directors">yes</entry>
<entry name="fonts"></entry>
</entry>
<ref name="master_template">/storage/shows/{ABCB973C-3A85-4DC2-BF2B-2C01BD1433E7}/mastertemplates/YC_FeiGun_text</ref>
<entry name="default_alternatives"></entry>
<schema>
<field name="1" type="richtext" description="FZZongYi-M05S-Regular" singleline="True" location="1/1"/>
<field name="scroll_data.space_before" type="float"/>
<field name="scroll_data.space_after" type="float"/>
<field description="FZZongYi-M05S-Regular" location="1/2" singleline="True" type="richtext" name="1"/>
<field description="Image1" location="1/1" type="image" name="Image1"/>
<field type="float" name="scroll_data.space_before"/>
<field type="float" name="scroll_data.space_after"/>
</schema>
<entry name="data">
<entry name="1" >12345678</entry>
<entry name="scroll_data.space_before" >0</entry>
<entry name="scroll_data.space_after" >0</entry>
</entry>
<entry name="dblink">
<entry name="1"/>
</entry>
<entry name="settings">
<entry name="tabfields">
<entry name="1"/>
<entry name="scroll_data">
<entry name="type">scroll_data</entry>
</entry>
</entry>
<entry name="isfilescript">false</entry>
<entry name="modified">2023-03-13T16:54:12</entry>
<entry name="1">22222222</entry>
<entry name="Image1">IMAGE*TITLES/2022/YC/mu_ad</entry>
<entry name="scroll_data.space_before">0</entry>
<entry name="scroll_data.space_after">0</entry>
</entry>
</element>
</update>
\ No newline at end of file
......@@ -76,6 +76,48 @@ namespace VIZ.Package.Domain
#endregion
#region Width -- 宽度
private GridColumnWidth width = new GridColumnWidth(1, GridColumnUnitType.Auto);
/// <summary>
/// 宽度
/// </summary>
public GridColumnWidth Width
{
get { return width; }
set { width = value; this.RaisePropertyChanged(nameof(Width)); }
}
#endregion
#region MinWidth -- 最小宽度
private double minWidth = 10d;
/// <summary>
/// 最小宽度
/// </summary>
public double MinWidth
{
get { return minWidth; }
set { minWidth = value; this.RaisePropertyChanged(nameof(MinWidth)); }
}
#endregion
#region MaxWidth -- 最大宽度
private double maxWidth = 500d;
/// <summary>
/// 最大宽度
/// </summary>
public double MaxWidth
{
get { return maxWidth; }
set { maxWidth = value; this.RaisePropertyChanged(nameof(MaxWidth)); }
}
#endregion
#region AllowEditing -- 是否启用编辑
private bool allowEditing;
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Storage;
namespace VIZ.Package.Domain
{
/// <summary>
/// 底飞字段定义
/// </summary>
public class GridColumnScrollElementFieldDefinition : GridColumnControlFieldDefinition
{
#region PageBase -- 关联页
private PageModelBase pageBase;
/// <summary>
/// 关联页
/// </summary>
public PageModelBase PageBase
{
get { return pageBase; }
set { pageBase = value; this.RaisePropertyChanged(nameof(PageBase)); }
}
#endregion
}
}
......@@ -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";
......
......@@ -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";
......
......@@ -14,7 +14,7 @@ namespace VIZ.Package.Domain
/// <summary>
/// 获取场景信息
/// </summary>
/// <param name="pageBase">场景模型基类</param>
/// <param name="pageBase">模型基类</param>
/// <returns>场景信息</returns>
public static SceneInfoModel GetSceneInfo(this PageModelBase pageBase)
{
......@@ -32,17 +32,31 @@ namespace VIZ.Package.Domain
}
}
/// <summary>
/// 获取场景父级
/// </summary>
/// <param name="pageBase">场景父级</param>
/// <param name="pageBase">页模型基类</param>
/// <returns>场景父级</returns>
public static string GetSceneParent(this PageModelBase pageBase)
{
string parent = ApplicationDomainEx.CurrentPage.ScenePath.Substring(0, ApplicationDomainEx.CurrentPage.ScenePath.LastIndexOf('/'));
return parent;
}
/// <summary>
/// 获取模板ID或页ID
/// </summary>
/// <param name="pageBase">页模型基类</param>
/// <returns>模板ID或页ID</returns>
public static Guid GetTemplateIdOrPageId(this PageModelBase pageBase)
{
if (pageBase is PageModel page)
return page.PageID;
if (pageBase is PageTemplateModel template)
return template.TemplateID;
return Guid.Empty;
}
}
}
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; }
}
}
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; }
}
}
......@@ -215,6 +215,11 @@ namespace VIZ.Package.Domain
public const string OPERATE_PAGE_ADD = "添加页";
/// <summary>
/// 添加命令模板页
/// </summary>
public const string OPERATE_PAGE_ADD_CMD = "添加命令模板页";
/// <summary>
/// 修改页号
/// </summary>
public const string OPERATE_PAGE_CHANGE_PAGE_NUM = "修改页号";
......
......@@ -77,6 +77,7 @@
<Compile Include="ApplicationDomainEx.cs" />
<Compile Include="Core\GridColumnControlFieldDefinition.cs" />
<Compile Include="Core\GridColumnDefinition.cs" />
<Compile Include="Core\GridColumnScrollElementFieldDefinition.cs" />
<Compile Include="Core\IHotkeySupport.cs" />
<Compile Include="Enum\ConnGroupStatus.cs" />
<Compile Include="Enum\MenuItemType.cs" />
......@@ -97,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" />
......
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using VIZ.Package.Domain;
namespace VIZ.Package.Module.Resource
{
/// <summary>
/// 页缩略图转化器
/// </summary>
public class PageThumbnailConverter : IValueConverter
{
[DllImport("gdi32.dll", SetLastError = true)]
private static extern bool DeleteObject(IntPtr hObject);
/// <summary>
/// 命令缩略图
/// </summary>
public ImageSource CommandThumbnail { get; set; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
PageModelBase pageBase = value as PageModelBase;
if (pageBase == null)
return null;
if (pageBase.PageType == Storage.PageType.Command)
return this.CommandThumbnail;
Bitmap bitmap = pageBase.ThumbnailBitmap;
if (bitmap == null)
return null;
IntPtr hBitmap = bitmap.GetHbitmap();
ImageSource wpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
hBitmap,
IntPtr.Zero,
Int32Rect.Empty,
BitmapSizeOptions.FromEmptyOptions());
if (!DeleteObject(hBitmap))
{
throw new System.ComponentModel.Win32Exception();
}
return wpfBitmap;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
......@@ -59,15 +59,5 @@ namespace VIZ.Package.Module.Resource.Properties {
resourceCulture = value;
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
public static System.Drawing.Bitmap cmd_template {
get {
object obj = ResourceManager.GetObject("cmd_template", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}
......@@ -117,8 +117,4 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="cmd_template" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\cmd_template.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
\ No newline at end of file
......@@ -104,6 +104,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Converter\ConnGroupStatus2BrushConverter.cs" />
<Compile Include="Converter\PageThumbnailConverter.cs" />
<Compile Include="Converter\VizControlFieldTypeStringConverter.cs" />
<Compile Include="Converter\ResourceFileSelectionModeConverter.cs" />
<Compile Include="Converter\RichText2TextConverter.cs" />
......@@ -138,9 +139,6 @@
<Resource Include="Icons\project_24x24.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\cmd_template.jpg" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\take_continue_30x30.png" />
<Resource Include="Icons\take_in_30x30.png" />
<Resource Include="Icons\take_out_30x30.png" />
......@@ -289,5 +287,8 @@
<ItemGroup>
<Resource Include="Icons\down_32x32.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\cmd_template.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
......@@ -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
......@@ -183,6 +179,21 @@ namespace VIZ.Package.Module
transitionLogicLayer.ControlObject = controlObjectValue;
}
/// <summary>
/// 上版 -- 命令
/// </summary>
/// <param name="pageBase">页</param>
/// <param name="conn">连接</param>
public void TakeCommnad(PageModelBase pageBase, ConnModel conn)
{
// 执行命令
IPageCommandService pageCommandService = ApplicationDomainEx.ServiceManager.GetService<IPageCommandService>(ViewServiceKeys.PAGE_COMMAND_SERVICE);
if (pageCommandService == null)
return;
pageCommandService.BeginExecuteTakeCommand(pageBase, conn);
}
// ---------------------------------------------------------------------------
// 继续
......@@ -198,6 +209,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 +243,28 @@ 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);
}
/// <summary>
/// 继续 -- 命令
/// </summary>
/// <param name="pageBase">页</param>
/// <param name="conn">连接</param>
public void ContinueCommnad(PageModelBase pageBase, ConnModel conn)
{
// 执行命令
IPageCommandService pageCommandService = ApplicationDomainEx.ServiceManager.GetService<IPageCommandService>(ViewServiceKeys.PAGE_COMMAND_SERVICE);
if (pageCommandService == null)
return;
pageCommandService.BeginExecuteTakeContinueCommand(pageBase, conn);
}
// ---------------------------------------------------------------------------
......@@ -277,6 +317,21 @@ namespace VIZ.Package.Module
bgSceneInfo.TransitionLogic.LayerInfos.Remove(logicLayer);
}
/// <summary>
/// 下版 -- 命令
/// </summary>
/// <param name="pageBase">页</param>
/// <param name="conn">连接</param>
public void TakeOutCommnad(PageModelBase pageBase, ConnModel conn)
{
// 执行命令
IPageCommandService pageCommandService = ApplicationDomainEx.ServiceManager.GetService<IPageCommandService>(ViewServiceKeys.PAGE_COMMAND_SERVICE);
if (pageCommandService == null)
return;
pageCommandService.BeginExecuteTakeOutCommand(pageBase, conn);
}
// ---------------------------------------------------------------------------
// 更新
......@@ -332,5 +387,20 @@ namespace VIZ.Package.Module
view.TakeUpdate(conn);
}
}
/// <summary>
/// 更新 -- 命令
/// </summary>
/// <param name="pageBase">页</param>
/// <param name="conn">连接</param>
public void UpdateCommnad(PageModelBase pageBase, ConnModel conn)
{
// 执行命令
IPageCommandService pageCommandService = ApplicationDomainEx.ServiceManager.GetService<IPageCommandService>(ViewServiceKeys.PAGE_COMMAND_SERVICE);
if (pageCommandService == null)
return;
pageCommandService.BeginExecuteTakeUpdateCommand(pageBase, conn);
}
}
}
......@@ -141,14 +141,18 @@ namespace VIZ.Package.Module
this.Execute(
action: (obj, view, conn) =>
{
if (obj.TransitionLogic)
if (ApplicationDomainEx.CurrentPage.PageType == PageType.Scene)
{
this.controlController.ContinueTransitionLogic(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn);
}
else
{
this.controlController.ContinueNormal(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn);
if (obj.TransitionLogic)
{
this.controlController.ContinueTransitionLogic(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn);
}
else
{
this.controlController.ContinueNormal(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn);
}
}
this.controlController.ContinueCommnad(ApplicationDomainEx.CurrentPage, conn);
},
over: null);
}
......@@ -173,14 +177,18 @@ namespace VIZ.Package.Module
this.Execute(
action: (obj, view, conn) =>
{
if (obj.TransitionLogic)
if (ApplicationDomainEx.CurrentPage.PageType == PageType.Scene)
{
this.controlController.TakeOutTransitionLogic(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn);
}
else
{
this.controlController.TakeOutNormal(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn);
if (obj.TransitionLogic)
{
this.controlController.TakeOutTransitionLogic(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn);
}
else
{
this.controlController.TakeOutNormal(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn);
}
}
this.controlController.TakeOutCommnad(ApplicationDomainEx.CurrentPage, conn);
},
over: () =>
{
......@@ -225,14 +233,18 @@ namespace VIZ.Package.Module
this.Execute(
action: (obj, view, conn) =>
{
if (obj.TransitionLogic)
if (ApplicationDomainEx.CurrentPage.PageType == PageType.Scene)
{
this.controlController.UpdateTransitionLogic(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn);
}
else
{
this.controlController.UpdateNormal(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn);
if (obj.TransitionLogic)
{
this.controlController.UpdateTransitionLogic(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn);
}
else
{
this.controlController.UpdateNormal(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn);
}
}
this.controlController.UpdateCommnad(ApplicationDomainEx.CurrentPage, conn);
},
over: null);
}
......@@ -363,14 +375,18 @@ namespace VIZ.Package.Module
this.Execute(
action: (obj, view, conn) =>
{
if (obj.TransitionLogic)
if (ApplicationDomainEx.CurrentPage.PageType == PageType.Scene)
{
this.controlController.TakeTransitionLogic(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn);
}
else
{
this.controlController.TakeNormal(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn);
if (obj.TransitionLogic)
{
this.controlController.TakeTransitionLogic(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn);
}
else
{
this.controlController.TakeNormal(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn);
}
}
this.controlController.TakeCommnad(ApplicationDomainEx.CurrentPage, conn);
},
over: () =>
{
......
......@@ -44,7 +44,7 @@ namespace VIZ.Package.Module
/// <summary>
/// 值改变时触发
/// </summary>
private void EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
protected virtual void EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
{
// 是否需要发送至预览
if (!this.IsSendToPreview)
......
......@@ -54,7 +54,7 @@ namespace VIZ.Package.Module
/// <summary>
/// 值改变时触发
/// </summary>
private void EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
protected virtual void EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
{
// 是否需要发送至预览
if (!this.IsSendToPreview)
......
......@@ -44,7 +44,7 @@ namespace VIZ.Package.Module
/// <summary>
/// 值改变时触发
/// </summary>
private void EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
protected virtual void EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
{
// 是否需要发送至预览
if (!this.IsSendToPreview)
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Domain;
namespace VIZ.Package.Module
{
/// <summary>
/// 图片底飞单元格编辑
/// </summary>
public class ImageScrollElementCellEdit : ImageListCellEdit
{
/// <summary>
/// 值改变时触发
/// </summary>
protected override void EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
{
// 是否需要发送至预览
if (!this.IsSendToPreview)
return;
// 预览连接不存在
if (ApplicationDomainEx.PreviewConn == null)
return;
DevExpress.Xpf.Grid.EditGridCellData cellData = this.DataContext as DevExpress.Xpf.Grid.EditGridCellData;
if (cellData == null)
return;
GridColumnControlFieldDefinition columnDefinition = cellData.Column.DataContext as GridColumnControlFieldDefinition;
if (columnDefinition == null)
return;
// 设置值
IDictionary<string, object> dic = cellData.Row as IDictionary<string, object>;
dic[columnDefinition.FieldName] = e.NewValue?.ToString() ?? string.Empty;
// 向Viz发送指令
//this.VizCommandControlObjectService.SetControlObjectListValue(
// ApplicationDomainEx.PreviewConn,
// columnDefinition.ControlObject.TreeNodePath,
// columnDefinition.ControlField.FieldIdentifier,
// cellData.RowData.RowHandle.Value,
// columnDefinition.FieldName,
// e.NewValue?.ToString() ?? string.Empty);
}
}
}
using DevExpress.Xpf.Editors;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Domain;
namespace VIZ.Package.Module
{
/// <summary>
/// 富文本底飞单元格编辑
/// </summary>
public class RichTextScrollElementCellEdit : RichTextListCellEdit
{
/// <summary>
/// 值改变时触发
/// </summary>
protected override void EditValueChanged(object sender, EditValueChangedEventArgs e)
{
// 是否需要发送至预览
if (!this.IsSendToPreview)
return;
// 预览连接不存在
if (ApplicationDomainEx.PreviewConn == null)
return;
DevExpress.Xpf.Grid.EditGridCellData cellData = this.DataContext as DevExpress.Xpf.Grid.EditGridCellData;
if (cellData == null)
return;
GridColumnControlFieldDefinition columnDefinition = cellData.Column.DataContext as GridColumnControlFieldDefinition;
if (columnDefinition == null)
return;
string richText = $"{RICH_TEXT_LEFT}{e.NewValue?.ToString() ?? string.Empty}{RICH_TEXT_RIGHT}";
// 设置值
IDictionary<string, object> dic = cellData.Row as IDictionary<string, object>;
dic[columnDefinition.FieldName] = richText;
// 向Viz发送指令
//this.VizCommandControlObjectService.SetControlObjectListValue(
// ApplicationDomainEx.PreviewConn,
// columnDefinition.ControlObject.TreeNodePath,
// columnDefinition.ControlField.FieldIdentifier,
// cellData.RowData.RowHandle.Value,
// columnDefinition.FieldName,
// richText);
}
}
}
using DevExpress.Xpf.Editors;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Domain;
namespace VIZ.Package.Module
{
/// <summary>
///
/// </summary>
public class TextScrollElementCellEdit : TextListCellEdit
{
/// <summary>
/// 值改变时触发
/// </summary>
protected override void EditValueChanged(object sender, EditValueChangedEventArgs e)
{
// 是否需要发送至预览
if (!this.IsSendToPreview)
return;
// 预览连接不存在
if (ApplicationDomainEx.PreviewConn == null)
return;
DevExpress.Xpf.Grid.EditGridCellData cellData = this.DataContext as DevExpress.Xpf.Grid.EditGridCellData;
if (cellData == null)
return;
GridColumnControlFieldDefinition columnDefinition = cellData.Column.DataContext as GridColumnControlFieldDefinition;
if (columnDefinition == null)
return;
// 设置值
IDictionary<string, object> dic = cellData.Row as IDictionary<string, object>;
dic[columnDefinition.FieldName] = e.NewValue?.ToString() ?? string.Empty;
// 向Viz发送指令
//this.VizCommandControlObjectService.SetControlObjectListValue(
// ApplicationDomainEx.PreviewConn,
// columnDefinition.ControlObject.TreeNodePath,
// columnDefinition.ControlField.FieldIdentifier,
// cellData.RowData.RowHandle.Value,
// columnDefinition.FieldName,
// e.NewValue?.ToString() ?? string.Empty);
}
}
}
using DevExpress.Xpf.Grid;
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using VIZ.Package.Domain;
using VIZ.Package.Storage;
namespace VIZ.Package.Module
{
/// <summary>
/// 底飞编辑面板单元格模板选择器
/// </summary>
public class ScrollElementEditPanelCellTemplateSelector : DataTemplateSelector
{
/// <summary>
/// 索引模板
/// </summary>
public DataTemplate IndexTemplate { get; set; }
/// <summary>
/// 文本模板
/// </summary>
public DataTemplate TextDataTemplate { get; set; }
/// <summary>
/// 富文本模板
/// </summary>
public DataTemplate RichTextDataTemplate { get; set; }
/// <summary>
/// 图片模板
/// </summary>
public DataTemplate ImageDataTemplate { get; set; }
/// <summary>
/// 筛选模板
/// </summary>
/// <param name="item">项</param>
/// <param name="container">容器</param>
/// <returns>数据模板</returns>
public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
GridCellData data = (GridCellData)item;
GridColumnScrollElementFieldDefinition definition = data.Column.DataContext as GridColumnScrollElementFieldDefinition;
if (definition == null)
return null;
switch (definition.Type)
{
case VizControlFieldType.none: return null;
case VizControlFieldType.system_index: return this.IndexTemplate;
case VizControlFieldType.text: return this.TextDataTemplate;
case VizControlFieldType.richtext: return this.RichTextDataTemplate;
case VizControlFieldType.image: return this.ImageDataTemplate;
default: return null;
}
}
}
}
\ No newline at end of file
......@@ -17,23 +17,82 @@
mc:Ignorable="d"
d:DesignHeight="400" d:DesignWidth="800">
<UserControl.Resources>
<fcore:Bitmap2ImageSourceConverter x:Key="Bitmap2ImageSourceConverter"></fcore:Bitmap2ImageSourceConverter>
</UserControl.Resources>
<!-- 行号转化器 -->
<resource:RowHandleConverter x:Key="RowHandleConverter"></resource:RowHandleConverter>
<!-- 富文本转文本 -->
<resource:RichText2TextConverter x:Key="RichText2TextConverter"></resource:RichText2TextConverter>
<!-- 单元格编辑模板选择器 -->
<local:ScrollElementEditPanelCellTemplateSelector x:Key="CellTemplateSelector">
<!-- 索引 -->
<local:ScrollElementEditPanelCellTemplateSelector.IndexTemplate>
<DataTemplate>
<TextBlock Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding RowData.RowHandle,Converter={StaticResource RowHandleConverter}}"></TextBlock>
</DataTemplate>
</local:ScrollElementEditPanelCellTemplateSelector.IndexTemplate>
<!-- 富文本 -->
<local:ScrollElementEditPanelCellTemplateSelector.RichTextDataTemplate>
<DataTemplate>
<TextBlock Text="{Binding Value,Converter={StaticResource RichText2TextConverter},Mode=OneWay}" Margin="3,0,3,0"
TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" VerticalAlignment="Center"></TextBlock>
</DataTemplate>
</local:ScrollElementEditPanelCellTemplateSelector.RichTextDataTemplate>
<!-- 图片 -->
<local:ScrollElementEditPanelCellTemplateSelector.ImageDataTemplate>
<DataTemplate>
<local:ImageListCellEdit></local:ImageListCellEdit>
</DataTemplate>
</local:ScrollElementEditPanelCellTemplateSelector.ImageDataTemplate>
</local:ScrollElementEditPanelCellTemplateSelector>
<!-- 单元格编辑模板选择器 -->
<local:ScrollElementEditPanelCellTemplateSelector x:Key="CellEditTemplateSelector">
<!-- 文本 -->
<local:ScrollElementEditPanelCellTemplateSelector.TextDataTemplate>
<DataTemplate>
<local:TextListCellEdit></local:TextListCellEdit>
</DataTemplate>
</local:ScrollElementEditPanelCellTemplateSelector.TextDataTemplate>
<!-- 富文本 -->
<local:ScrollElementEditPanelCellTemplateSelector.RichTextDataTemplate>
<DataTemplate>
<local:RichTextScrollElementCellEdit></local:RichTextScrollElementCellEdit>
</DataTemplate>
</local:ScrollElementEditPanelCellTemplateSelector.RichTextDataTemplate>
</local:ScrollElementEditPanelCellTemplateSelector>
<!-- 列定义模板 -->
<DataTemplate x:Key="ColumnTemplate">
<ContentControl>
<dxg:GridColumn FieldName="{Binding FieldName}"
Header="{Binding Header}" ReadOnly="{Binding ReadOnly}"
Width="{Binding Width}" MinWidth="{Binding MinWidth}" MaxWidth="{Binding MaxWidth}"
CellTemplateSelector="{StaticResource CellTemplateSelector}"
CellEditTemplateSelector="{StaticResource CellEditTemplateSelector}"
AllowEditing="{Binding AllowEditing}"
AllowResizing="True"
AllowSorting="False" AllowColumnFiltering="False"/>
</ContentControl>
</DataTemplate>
</UserControl.Resources>
<Grid VerticalAlignment="Stretch" AllowDrop="True">
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
</Grid.RowDefinitions>
<!-- 模板 -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="60"></ColumnDefinition>
<ColumnDefinition Width="300"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="底飞模板:" VerticalAlignment="Center" HorizontalAlignment="Right" Opacity="0.86"></TextBlock>
<TextBlock Text="底飞模板:" VerticalAlignment="Center" HorizontalAlignment="Right" Opacity="0.75"></TextBlock>
<dxe:ComboBoxEdit IsTextEditable="False" Height="30" Grid.Column="1" Margin="20,0,0,0"
EditValue="{Binding Path=SelectedSceneTemplateModel,Mode=TwoWay}"
ItemsSource="{Binding Path=SceneTemplateModels,Mode=OneWay}" DisplayMember="Scene"></dxe:ComboBoxEdit>
......@@ -43,6 +102,58 @@
</Grid>
<!-- 数据 -->
<dxg:GridControl ItemsSource="{Binding Path=ItemsSource}" ShowBorder="True" Grid.Row="1" AllowDrop="True"
ColumnsSource="{Binding Path=Columns}" SelectionMode="Cell" Margin="10"
SelectedItem="{Binding Path=SelectedValue}"
ColumnGeneratorTemplate="{StaticResource ColumnTemplate}">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="SelectionChanged" PassEventArgsToCommand="True" Command="{Binding Path=SelectionChangedCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<dxg:GridControl.ContextMenu>
<ContextMenu>
<MenuItem Header="添加" Command="{Binding Path=PlacementTarget.DataContext.AddCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<MenuItem Header="删除" Command="{Binding Path=PlacementTarget.DataContext.RemoveCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
</ContextMenu>
</dxg:GridControl.ContextMenu>
<dxg:GridControl.View>
<dxg:TableView x:Name="tabView" AllowEditing="True" ShowIndicator="False"
IsColumnMenuEnabled="False"
NavigationStyle="Cell" EditorShowMode="MouseDown" ShowVerticalLines="True"
ShowHorizontalLines="True"
AlternateRowBackground="#05ffffff"
ShowGroupPanel="False" RowMinHeight="24"
AllowDrop="True"
ShowBandsPanel="False"
ShowTotalSummary="False"
ShowFixedTotalSummary="False"
ShowDragDropHint="False"
ShowTargetInfoInDragDropHint="false">
</dxg:TableView>
</dxg:GridControl.View>
</dxg:GridControl>
<!-- 预览控制 -->
<Grid Grid.Row="2" Margin="2,0,2,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Width="80" Height="24" Content="Play" Command="{Binding Path=PreviewPlayCommand}"></Button>
<Button Width="80" Height="24" Content="Stop" Grid.Column="1" Command="{Binding Path=PreviewStopCommand}"></Button>
<Button Width="80" Height="24" Content="Continue" Grid.Column="2" Command="{Binding Path=PreviewContinueCommnad}"></Button>
<TextBlock Text="Position:" Opacity="0.75" Grid.Column="3" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,5,0"></TextBlock>
<dxe:TextEdit Width="100" Height="24" Grid.Column="4" EditValue="{Binding Path=PreviewPosition,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
dxe:NumericMaskOptions.ValueAfterDelete="ZeroThenNull"
dxe:NumericMaskOptions.AlwaysShowDecimalSeparator="False"
MaskType="Numeric" Mask="##########.###"></dxe:TextEdit>
<Button Width="80" Height="24" Content="Apply" Grid.Column="5" Command="{Binding Path=PreviewSetPosCommand}"></Button>
</Grid>
</Grid>
</UserControl>
......@@ -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 page = pageGroupService.AddPage(srcTemplate);
this.controlObjectService.SaveControlFields(page.PageID, controlObject.AllFiledNodes);
pageGroupService.OpenPage(page);
newPage = pageGroupService.AddPage(srcTemplate);
this.controlObjectService.SaveControlFields(newPage.PageID, controlObject.AllFiledNodes);
pageGroupService.OpenPage(newPage);
// 记录操作日志
string remark = $"模板:{srcTemplate.ScenePath}";
......@@ -242,15 +248,20 @@ namespace VIZ.Package.Module
// 另存页
else if (ApplicationDomainEx.CurrentPage is PageModel srcPage)
{
PageModel page = pageGroupService.CopyPage();
this.controlObjectService.SaveControlFields(page.PageID, controlObject.AllFiledNodes);
pageGroupService.OpenPage(page);
newPage = pageGroupService.CopyPage();
this.controlObjectService.SaveControlFields(newPage.PageID, controlObject.AllFiledNodes);
pageGroupService.OpenPage(newPage);
// 记录操作日志
string remark = $"页:{page.ScenePath}";
string remark = $"页:{newPage.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 = "另存成功";
......
......@@ -152,6 +152,9 @@ namespace VIZ.Package.Module
ThreadHelper.SafeRun(action: () =>
{
if (msg.Page.PageType != PageType.Scene)
return;
// 从本地数据库获取控制对象
ControlObjectEntity entity = this.controlObjectService.GetControlObject(msg.Page)?.FirstOrDefault();
ControlObjectModel controlObject = new ControlObjectModel();
......@@ -225,7 +228,7 @@ namespace VIZ.Package.Module
/// </summary>
public void TryUpdateControlFieldListValue()
{
if (this.SelectedControlField == null || this.SelectedControlField.Type != VizControlFieldType.list)
if (this.SelectedControlField == null || this.SelectedControlField.Type != VizControlFieldType.list && this.SelectedControlField.Type != VizControlFieldType.scroll_elements)
return;
IFieldEditService service = ApplicationDomainEx.ServiceManager.GetService<IFieldEditService>(ViewServiceKeys.FIELD_EDIT_SERVICE);
......
......@@ -21,7 +21,7 @@
<!-- 系统版本 -->
<TextBlock Text="系统版本:" VerticalAlignment="Center" HorizontalAlignment="Right"
Grid.Row="1" Grid.Column="0" Margin="0,0,10,0"></TextBlock>
<TextBlock Text="V1.1.0.03141048_beta" VerticalAlignment="Center" HorizontalAlignment="Left"
<TextBlock Text="V1.1.0.03171405_beta" VerticalAlignment="Center" HorizontalAlignment="Left"
Grid.Row="1" Grid.Column="1"></TextBlock>
</Grid>
</dx:ThemedWindow>
......@@ -14,6 +14,12 @@ namespace VIZ.Package.Module
public interface IPageGroupService : IService
{
/// <summary>
/// 创建并添加命令模板页
/// </summary>
/// <returns>页</returns>
PageModel AddCmdPage();
/// <summary>
/// 添加页
/// </summary>
/// <param name="template">模板</param>
......
......@@ -31,6 +31,8 @@
</ResourceDictionary.MergedDictionaries>
<resource:RowHandleConverter x:Key="RowHandleConverter"></resource:RowHandleConverter>
<resource:PageThumbnailConverter x:Key="PageThumbnailConverter"
CommandThumbnail="/VIZ.Package.Module.Resource;component/Images/cmd_template.png"></resource:PageThumbnailConverter>
<fcore:Bitmap2ImageSourceConverter x:Key="Bitmap2ImageSourceConverter"></fcore:Bitmap2ImageSourceConverter>
<fcore:Enum2EnumDescriptionConverter x:Key="Enum2EnumDescriptionConverter" EnumType="{x:Type storage:PageType}"></fcore:Enum2EnumDescriptionConverter>
<fcore:Bool2SolidColorBrushConverter x:Key="RowHandleBgConverter"
......@@ -173,7 +175,7 @@
VisibleIndex="{Binding Path=VisibleIndex,Mode=TwoWay}">
<common:GridColumnResizeMinHeight.CellTemplate>
<DataTemplate>
<fcommon:ResizeImageControl ImageSource="{Binding Path=Row.ThumbnailBitmap,Converter={StaticResource Bitmap2ImageSourceConverter}}"
<fcommon:ResizeImageControl ImageSource="{Binding Path=Row,Converter={StaticResource PageThumbnailConverter}}"
IconSource="/VIZ.Package.Module.Resource;component/Icons/image_20x20.png"
ShowImageMinWidth="50" ShowImageMinHeight="50">
</fcommon:ResizeImageControl>
......@@ -398,6 +400,8 @@
ColumnGeneratorTemplateSelector="{StaticResource ResourceKey=ColumnDefintionGeneratorTemplateSelector}">
<dxg:GridControl.ContextMenu>
<common:ContextMenuEx BindingTargetType="{x:Type dx:DXTabControl}">
<MenuItem Header="添加命令页" Command="{Binding Path=DataContext.CreateCmdPageCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type common:ContextMenuEx}}}"/>
<Separator></Separator>
<MenuItem Header="粘贴页" Command="{Binding Path=DataContext.PastePageCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type common:ContextMenuEx}}}"/>
</common:ContextMenuEx>
</dxg:GridControl.ContextMenu>
......@@ -439,6 +443,10 @@
Command="{Binding ElementName=uc,Path=DataContext.OpenPageCommand}"
Tag="{x:Static Member=common:GridControlHelper.KEEP_MENU_TAG}"/>
<dxb:BarItemLinkSeparator />
<dxb:BarButtonItem Name="CreateCmdPage" Content="添加命令页"
Command="{Binding ElementName=uc,Path=DataContext.CreateCmdPageCommand}"
Tag="{x:Static Member=common:GridControlHelper.KEEP_MENU_TAG}"/>
<dxb:BarItemLinkSeparator />
<dxb:BarButtonItem Name="Update" Content="更新选中页"
Command="{Binding ElementName=uc,Path=DataContext.UpdateCommand}"
Tag="{x:Static Member=common:GridControlHelper.KEEP_MENU_TAG}"/>
......
......@@ -94,6 +94,7 @@ namespace VIZ.Package.Module
this.AddGroupCommand = new VCommand(this.AddGroup);
this.RenameGroupCommand = new VCommand(this.RenameGroup);
this.DeleteGroupCommand = new VCommand(this.DeleteGroup);
this.CreateCmdPageCommand = new VCommand(this.CreateCmdPage, this.CanCreateCmdPage);
this.DeleteItemCommand = new VCommand(this.DeleteItem);
this.OpenPageCommand = new VCommand(this.OpenPage, this.CanOpenPage);
this.OpenAndTakePageCommand = new VCommand(this.OpenAndTakePage, this.CanOpenAndTakePage);
......@@ -393,6 +394,32 @@ namespace VIZ.Package.Module
#endregion
#region CreateCmdPageCommand -- 创建命令模板页命令
/// <summary>
/// 创建命令模板页命令
/// </summary>
public VCommand CreateCmdPageCommand { get; set; }
/// <summary>
/// 是否可以创建命令模板页
/// </summary>
/// <returns>是否可以添加模板页</returns>
private bool CanCreateCmdPage()
{
return this.SelectedPageGroupModel != null;
}
/// <summary>
/// 创建命令模板页
/// </summary>
private void CreateCmdPage()
{
this.AddCmdPage();
}
#endregion
#region DeleteItemCommand -- 刪除項命令
/// <summary>
......@@ -1177,6 +1204,33 @@ namespace VIZ.Package.Module
// ======================================================================================
/// <summary>
/// 创建并添加命令模板页
/// </summary>
/// <returns>页</returns>
public PageModel AddCmdPage()
{
if (this.SelectedPageGroupModel == null)
return null;
// 记录操作日志
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.Operate, RecordLogTrigger.Human, RecordLogConstants.OPERATE_PAGE_ADD_CMD);
// 根据模板拷贝页
PageModel page = new PageModel();
page.PageType = PageType.Command;
page.ConnGroupID = ApplicationDomainEx.ConnGroups.FirstOrDefault(p => p.IsDefault)?.GroupID ?? Guid.Empty;
page.PageGroupID = this.SelectedPageGroupModel.GroupID;
// 页码
page.PageNum = this.SelectedPageGroupModel.Pages.MaxOrDefault(p => p.PageNum) + 1;
// 添加页
this.SelectedPageGroupModel.Pages.Add(page);
return page;
}
/// <summary>
/// 添加页
/// </summary>
/// <param name="template">模板</param>
......
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);
}
}
}
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()
{
}
}
}
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);
}
}
<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>
<TextBlock Text="模板类型:" Margin="40,0,0,0" d:Foreground="White" Opacity="0.7"></TextBlock>
<TextBlock Text="{Binding PageType}" 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: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>
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());
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Domain;
namespace VIZ.Package.Module
{
/// <summary>
/// Viz预览命令控制器
/// </summary>
public class VizPreviewCmdController
{
/// <summary>
/// 上版 -- 命令
/// </summary>
/// <param name="pageBase">页</param>
/// <param name="conn">连接</param>
public void TakeCommnad(PageModelBase pageBase, ConnModel conn)
{
// 执行命令
IPageCommandService pageCommandService = ApplicationDomainEx.ServiceManager.GetService<IPageCommandService>(ViewServiceKeys.PAGE_COMMAND_SERVICE);
if (pageCommandService == null)
return;
pageCommandService.BeginExecuteTakeCommand(pageBase, conn);
}
/// <summary>
/// 继续 -- 命令
/// </summary>
/// <param name="pageBase">页</param>
/// <param name="conn">连接</param>
public void ContinueCommnad(PageModelBase pageBase, ConnModel conn)
{
// 执行命令
IPageCommandService pageCommandService = ApplicationDomainEx.ServiceManager.GetService<IPageCommandService>(ViewServiceKeys.PAGE_COMMAND_SERVICE);
if (pageCommandService == null)
return;
pageCommandService.BeginExecuteTakeContinueCommand(pageBase, conn);
}
/// <summary>
/// 下版 -- 命令
/// </summary>
/// <param name="pageBase">页</param>
/// <param name="conn">连接</param>
public void TakeOutCommnad(PageModelBase pageBase, ConnModel conn)
{
// 执行命令
IPageCommandService pageCommandService = ApplicationDomainEx.ServiceManager.GetService<IPageCommandService>(ViewServiceKeys.PAGE_COMMAND_SERVICE);
if (pageCommandService == null)
return;
pageCommandService.BeginExecuteTakeOutCommand(pageBase, conn);
}
/// <summary>
/// 更新 -- 命令
/// </summary>
/// <param name="pageBase">页</param>
/// <param name="conn">连接</param>
public void UpdateCommnad(PageModelBase pageBase, ConnModel conn)
{
// 执行命令
IPageCommandService pageCommandService = ApplicationDomainEx.ServiceManager.GetService<IPageCommandService>(ViewServiceKeys.PAGE_COMMAND_SERVICE);
if (pageCommandService == null)
return;
pageCommandService.BeginExecuteTakeUpdateCommand(pageBase, conn);
}
}
}
......@@ -172,6 +172,11 @@ namespace VIZ.Package.Module
private VizPreviewController vizPreviewController;
/// <summary>
/// Viz预览命令控制器
/// </summary>
private VizPreviewCmdController vizPreviewCmdController = new VizPreviewCmdController();
/// <summary>
/// VIZ命令服务
/// </summary>
private VizCommandService vizCommandService = new VizCommandService();
......@@ -349,8 +354,13 @@ namespace VIZ.Package.Module
this.vizCommandService.SetEnabledUpdate(conn, false);
try
{
this.vizCommandService.Start(conn, null, VizLayer.MAIN_LAYER);
view?.PreviewIn(conn);
if (ApplicationDomainEx.CurrentPage.PageType == PageType.Scene)
{
this.vizCommandService.Start(conn, null, VizLayer.MAIN_LAYER);
view?.PreviewIn(conn);
}
this.vizPreviewCmdController.TakeCommnad(ApplicationDomainEx.CurrentPage, conn);
}
catch (Exception ex)
{
......@@ -379,8 +389,13 @@ namespace VIZ.Package.Module
this.Execute((obj, view, conn) =>
{
this.vizCommandService.Continue(conn, null, VizLayer.MAIN_LAYER);
view?.PreviewContinue(conn);
if (ApplicationDomainEx.CurrentPage.PageType == PageType.Scene)
{
this.vizCommandService.Continue(conn, null, VizLayer.MAIN_LAYER);
view?.PreviewContinue(conn);
}
this.vizPreviewCmdController.ContinueCommnad(ApplicationDomainEx.CurrentPage, conn);
});
}
......@@ -403,8 +418,13 @@ namespace VIZ.Package.Module
this.Execute((obj, view, conn) =>
{
this.vizCommandService.Stop(conn, null, VizLayer.MAIN_LAYER);
view?.PreviewOut(conn);
if (ApplicationDomainEx.CurrentPage.PageType == PageType.Scene)
{
this.vizCommandService.Stop(conn, null, VizLayer.MAIN_LAYER);
view?.PreviewOut(conn);
}
this.vizPreviewCmdController.TakeOutCommnad(ApplicationDomainEx.CurrentPage, conn);
});
}
......@@ -436,21 +456,27 @@ namespace VIZ.Package.Module
// 执行更新流程
this.Execute((obj, view, conn) =>
{
this.vizCommandService.SetEnabledUpdate(conn, false);
try
if (ApplicationDomainEx.CurrentPage.PageType == PageType.Scene)
{
if (obj != null)
this.vizCommandService.SetEnabledUpdate(conn, false);
try
{
this.vizCommandControlObjectService.SetControlObject(conn, obj);
this.vizCommandControlObjectService.SetCustomControlFieldValue(conn, obj.AllFiledNodes);
if (obj != null)
{
this.vizCommandControlObjectService.SetControlObject(conn, obj);
this.vizCommandControlObjectService.SetCustomControlFieldValue(conn, obj.AllFiledNodes);
}
view?.PreviewUpdate(conn);
}
view?.PreviewUpdate(conn);
}
catch (Exception ex)
{
log.Error(ex);
catch (Exception ex)
{
log.Error(ex);
}
this.vizCommandService.SetEnabledUpdate(conn, true);
}
this.vizCommandService.SetEnabledUpdate(conn, true);
this.vizPreviewCmdController.UpdateCommnad(ApplicationDomainEx.CurrentPage, conn);
});
}
......@@ -547,7 +573,10 @@ namespace VIZ.Package.Module
ThreadHelper.SafeRun(() =>
{
this.vizCommandService.SetObject(ApplicationDomainEx.PreviewConn, msg.Page.ScenePath, VizLayer.MAIN_LAYER);
if (msg.Page.PageType == PageType.Scene)
{
this.vizCommandService.SetObject(ApplicationDomainEx.PreviewConn, msg.Page.ScenePath, VizLayer.MAIN_LAYER);
}
// 发送节目单项初始化完成消息
WPFHelper.BeginInvoke(() =>
......
......@@ -119,6 +119,10 @@
<Compile Include="ControlObject\FieldEdit\Edit\ListEdit\CellEdit\FontListCellEdit.xaml.cs">
<DependentUpon>FontListCellEdit.xaml</DependentUpon>
</Compile>
<Compile Include="ControlObject\FieldEdit\Edit\ScrollElementsEdit\CellEdit\ImageScrollElementCellEdit.cs" />
<Compile Include="ControlObject\FieldEdit\Edit\ScrollElementsEdit\CellEdit\RichTextScrollElementCellEdit.cs" />
<Compile Include="ControlObject\FieldEdit\Edit\ScrollElementsEdit\CellEdit\TextScrollElementCellEdit.cs" />
<Compile Include="ControlObject\FieldEdit\Edit\ScrollElementsEdit\ScrollElementEditPanelCellTemplateSelector.cs" />
<Compile Include="ControlObject\FieldEdit\Edit\ScrollElementsEdit\ScrollElementsEditPanel.xaml.cs">
<DependentUpon>ScrollElementsEditPanel.xaml</DependentUpon>
</Compile>
......@@ -144,6 +148,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>
......@@ -162,6 +173,7 @@
</Compile>
<Compile Include="Plugin\Model\PluginNavigationConfig.cs" />
<Compile Include="Plugin\Service\IPluginService.cs" />
<Compile Include="Preview\VizPreview\Controller\VizPreviewCmdController.cs" />
<Compile Include="ProjectManager\ViewModel\SaveProjectWindowModel.cs" />
<Compile Include="ProjectManager\ViewModel\ProjectTreePanelModel.cs" />
<Compile Include="ProjectManager\View\SaveProjectWindow.xaml.cs">
......@@ -470,6 +482,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>
......
......@@ -52,6 +52,7 @@
<Reference Include="CsvHelper, Version=30.0.0.0, Culture=neutral, PublicKeyToken=8c4959082be5c823, processorArchitecture=MSIL">
<HintPath>..\packages\CsvHelper.30.0.1\lib\net47\CsvHelper.dll</HintPath>
</Reference>
<Reference Include="DevExpress.Xpf.Grid.v22.2.Core, Version=22.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="LiteDB, Version=5.0.15.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
<HintPath>..\packages\LiteDB.5.0.15\lib\net45\LiteDB.dll</HintPath>
</Reference>
......@@ -102,9 +103,11 @@
<Compile Include="DB\RecordLog\RecordLogService.cs" />
<Compile Include="DB\RecordLog\RecordLogWriter.cs" />
<Compile Include="DB\Registry\RegistryService.cs" />
<Compile Include="DB\ScrollElement\ScrollElementService.cs" />
<Compile Include="Logic\Plugin\PluginService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Viz\VizCommandControlObjectService.Custom.cs" />
<Compile Include="Viz\VizCommandElementService.cs" />
<Compile Include="Viz\VizControlObjectDownloadService.cs" />
<Compile Include="Viz\GHResourceService.cs" />
<Compile Include="Viz\GHService.cs" />
......
......@@ -30,7 +30,7 @@ namespace VIZ.Package.Service
/// <remarks>
/// 不启用编辑则可以直接在GridControl的单元格中直径进行值修改
/// </remarks>
private static readonly List<VizControlFieldType> ALLOW_EDITING_FALSE_TYPES = new List<VizControlFieldType>
public static readonly List<VizControlFieldType> ALLOW_EDITING_FALSE_TYPES = new List<VizControlFieldType>
{
VizControlFieldType.none,
VizControlFieldType.boolean,
......@@ -524,6 +524,35 @@ namespace VIZ.Package.Service
conn.EndpointManager.Send(string.Format(VizEngineCommands.SCRIPT_INVOKE, ApplicationConstants.VIZ_COMMAND_CUSTOM_CONTROL_FIELD_SET, command));
}
/// <summary>
/// 根据控制字段实体创建控制对象字段模型
/// </summary>
/// <param name="entity">控制字段实体</param>
/// <returns>控制对象字段模型</returns>
public ControlFieldNodeModel CreateControlFieldNodeModeFromEntity(ControlFieldEntity entity)
{
if (string.IsNullOrWhiteSpace(entity.FieldDetail))
return null;
string[] pars = entity.FieldDetail.Split(':');
string num = pars[1].Split('*').FirstOrDefault();
ControlFieldNodeModel node = new ControlFieldNodeModel();
node.FieldDetail = entity.FieldDetail;
node.FieldIdentifier = pars[0];
node.Num = num;
node.TypeSchema = pars[2];
node.Type = this.GetControlFieldType(node.TypeSchema);
node.Value = entity.Value;
if (pars.Length >= 7)
{
node.Description = pars[6];
}
return node;
}
/// <summary>
/// 获取控制字段类型
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Domain;
namespace VIZ.Package.Service
{
/// <summary>
/// Viz元素命令服务
/// </summary>
public class VizCommandElementService
{
/// <summary>
/// 预览播放
/// </summary>
/// <param name="scrollElementField">底飞元素字段</param>
public void PreviewPlay(ControlFieldNodeModel scrollElementField)
{
if (ApplicationDomainEx.PreviewConn == null || !ApplicationDomainEx.PreviewConn.IsConnected)
return;
ApplicationDomainEx.PreviewConn.EndpointManager.Send($"{ApplicationDomainEx.VizPreviewRenderer}*TREE*$object*FUNCTION*ControlObject*in SET ON_CONTAINER {scrollElementField.FieldIdentifier} GEOM*start INVOKE");
}
/// <summary>
/// 预览继续
/// </summary>
/// <param name="scrollElementField">底飞元素字段</param>
public void PreviewContinue(ControlFieldNodeModel scrollElementField)
{
if (ApplicationDomainEx.PreviewConn == null || !ApplicationDomainEx.PreviewConn.IsConnected)
return;
ApplicationDomainEx.PreviewConn.EndpointManager.Send($"{ApplicationDomainEx.VizPreviewRenderer}*TREE*$object*FUNCTION*ControlObject*in SET ON_CONTAINER {scrollElementField.FieldIdentifier} GEOM*continue INVOKE");
}
/// <summary>
/// 预览停止
/// </summary>
/// <param name="scrollElementField">底飞元素字段</param>
public void PreviewStop(ControlFieldNodeModel scrollElementField)
{
if (ApplicationDomainEx.PreviewConn == null || !ApplicationDomainEx.PreviewConn.IsConnected)
return;
ApplicationDomainEx.PreviewConn.EndpointManager.Send($"{ApplicationDomainEx.VizPreviewRenderer}*TREE*$object*FUNCTION*ControlObject*in SET ON_CONTAINER {scrollElementField.FieldIdentifier} GEOM*stop INVOKE");
}
/// <summary>
/// 预览设置位置
/// </summary>
/// <param name="scrollElementField">底飞元素字段</param>
/// <param name="pos">位置值</param>
public void PreviewSetPos(ControlFieldNodeModel scrollElementField, double pos)
{
if (ApplicationDomainEx.PreviewConn == null || !ApplicationDomainEx.PreviewConn.IsConnected)
return;
ApplicationDomainEx.PreviewConn.EndpointManager.Send($"{ApplicationDomainEx.VizPreviewRenderer}*TREE*$object*FUNCTION*ControlObject*in SET ON_CONTAINER {scrollElementField.FieldIdentifier} GEOM*currentPos SET {pos}");
}
/// <summary>
/// 预览获取位置值
/// </summary>
/// <param name="scrollElementField">底飞元素字段</param>
/// <returns>位置值</returns>
public double? PreviewGetPos(ControlFieldNodeModel scrollElementField)
{
if (ApplicationDomainEx.PreviewConn == null || !ApplicationDomainEx.PreviewConn.IsConnected)
return null;
string result = ApplicationDomainEx.PreviewConn.EndpointManager.Request($"{ApplicationDomainEx.VizPreviewRenderer}*TREE*$object*FUNCTION*ControlObject*in SET ON_CONTAINER {scrollElementField.FieldIdentifier} GEOM*currentPos GET");
if (string.IsNullOrWhiteSpace(result) || result.StartsWith(ApplicationConstants.VIZ_COMMAND_RESULT_ERROR_PREFIX))
return null;
double.TryParse(result, out double value);
return value;
}
}
}
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; }
}
}
......@@ -8,9 +8,9 @@ using System.Threading.Tasks;
namespace VIZ.Package.Storage
{
/// <summary>
/// 底飞字段值
/// 底飞数据包
/// </summary>
public class ScrollElementFieldValue
public class ScrollElementPackageEntity
{
/// <summary>
/// 编号
......@@ -19,23 +19,23 @@ namespace VIZ.Package.Storage
public int Id { get; set; }
/// <summary>
/// 模板ID或者页ID
/// 模板页ID
/// </summary>
public Guid TemplateOrPageID { get; set; }
/// <summary>
/// 元素编号
/// 关联底飞字段
/// </summary>
public string ElementNum { get; set; }
public string FieldIdentifier { get; set; }
/// <summary>
/// 字段名称
/// 模板场景路径
/// </summary>
public string FieldIdentifier { get; set; }
public string TemplateScenePath { get; set; }
/// <summary>
/// 字段值
/// 模板字段
/// </summary>
public string Value { get; set; }
public List<ControlFieldEntity> TemplateFields { get; set; } = new List<ControlFieldEntity>();
}
}
......@@ -97,6 +97,13 @@ namespace VIZ.Package.Storage
custom_video,
/// <summary>
/// 自定义 视频
/// </summary>
[Description("系统 索引")]
system_index,
/// <summary>
/// 时钟
/// </summary>
[Description("时钟")]
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Storage
{
/// <summary>
/// 底飞元素根节点标志
/// </summary>
public enum VizScrollElementRootTag
{
/// <summary>
/// 全值更新
/// </summary>
entry,
/// <summary>
/// 更新部分值
/// </summary>
update,
/// <summary>
/// 插入值
/// </summary>
insert
}
}
......@@ -40,8 +40,8 @@ namespace VIZ.Package.Storage
this.ControlField = this.Database.GetCollection<ControlFieldEntity>();
this.ControlObject = this.Database.GetCollection<ControlObjectEntity>();
this.SceneThumbnailCache = this.Database.GetStorage<Guid>("_SceneThumbnailFiles", "_SceneThumbnailChunks");
this.ScrollElementTemplateControlField = this.Database.GetCollection<ControlFieldEntity>("ScrollElementTemplate");
this.ScrollElementFieldValue = this.Database.GetCollection<ScrollElementFieldValue>();
this.ScrollElementPackage = this.Database.GetCollection<ScrollElementPackageEntity>();
this.PageCommand = this.Database.GetCollection<PageCommandEntity>();
}
/// <summary>
......@@ -80,14 +80,14 @@ namespace VIZ.Package.Storage
public ILiteStorage<Guid> SceneThumbnailCache { get; private set; }
/// <summary>
/// 底飞模板字段
/// 底飞数据包
/// </summary>
public ILiteCollection<ControlFieldEntity> ScrollElementTemplateControlField { get; private set; }
public ILiteCollection<ScrollElementPackageEntity> ScrollElementPackage { get; private set; }
/// <summary>
/// 底飞字段值
/// 页命令
/// </summary>
public ILiteCollection<ScrollElementFieldValue> ScrollElementFieldValue { get; private set; }
public ILiteCollection<PageCommandEntity> PageCommand { get; private set; }
/// <summary>
/// 销毁
......@@ -100,8 +100,8 @@ namespace VIZ.Package.Storage
this.ControlField = null;
this.ControlObject = null;
this.SceneThumbnailCache = null;
this.ScrollElementTemplateControlField = null;
this.ScrollElementFieldValue = null;
this.ScrollElementPackage = null;
this.PageCommand = null;
this.Database?.Dispose();
}
......
......@@ -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" />
......@@ -108,7 +109,7 @@
<Compile Include="Entity\Page\PageGroupEntity.cs" />
<Compile Include="Entity\Page\PageTemplateEntity.cs" />
<Compile Include="Entity\Config\VizConfigEntity.cs" />
<Compile Include="Entity\ScrollElement\ScrollElementFieldValue.cs" />
<Compile Include="Entity\ScrollElement\ScrollElementPackageEntity.cs" />
<Compile Include="Enum\EngineFullType.cs" />
<Compile Include="Enum\EngineType.cs" />
<Compile Include="Enum\PageType.cs" />
......@@ -120,6 +121,7 @@
<Compile Include="Enum\VizLayer.cs" />
<Compile Include="Enum\EnginePreviewMode.cs" />
<Compile Include="Enum\VizScene.cs" />
<Compile Include="Enum\VizScrollElementRootTag.cs" />
<Compile Include="Ini\LogConfig.cs" />
<Compile Include="Ini\VizConfig.cs" />
<Compile Include="LocalDbContext.cs" />
......
......@@ -14,6 +14,21 @@ namespace VIZ.Package.Storage
public class ControlObject_Element_Node : IXmlSerialize
{
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 是否完成
/// </summary>
public bool? Complete { get; set; }
/// <summary>
/// 关联场景
/// </summary>
public string Scene { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
......@@ -24,12 +39,20 @@ namespace VIZ.Package.Storage
public List<ControlObject_Entry_Node> Entrys { get; set; } = new List<ControlObject_Entry_Node>();
/// <summary>
/// 字段定义
/// </summary>
public List<ControlObject_Schema_Node> Schemas { get; set; } = new List<ControlObject_Schema_Node>();
/// <summary>
/// 从XElement节点获取数据
/// </summary>
/// <param name="element">XElement节点</param>
public void FromXmlElement(XElement element)
{
this.Name = element.GetAttributeValue<string>("name");
this.Description = element.GetAttributeValue<string>("description");
this.Complete = element.GetAttributeValue<bool?>("complete");
this.Scene = element.GetAttributeValue<string>("scene");
foreach (var item in element.Elements("entry"))
{
......@@ -38,6 +61,14 @@ namespace VIZ.Package.Storage
this.Entrys.Add(entry);
}
foreach (var item in element.Elements("schema"))
{
ControlObject_Schema_Node schema = new ControlObject_Schema_Node();
schema.FromXmlElement(item);
this.Schemas.Add(schema);
}
}
/// <summary>
......@@ -46,10 +77,27 @@ namespace VIZ.Package.Storage
public XElement ToXmlElement()
{
XElement element = new XElement("element");
element.SetAttributeValue("description", this.Description);
element.SetAttributeValueIfValueNotNull("name", this.Name);
element.SetAttributeValueIfValueNotNull("description", this.Description);
element.SetAttributeValueIfValueNotNull("complete", this.Complete);
element.SetAttributeValueIfValueNotNull("scene", this.Scene);
foreach (var item in this.Entrys)
{
element.Add(item.ToXmlElement());
XElement entry = item.ToXmlElement();
if (entry == null)
continue;
element.Add(entry);
}
foreach (var item in this.Schemas)
{
XElement schema = item.ToXmlElement();
if (schema == null)
continue;
element.Add(schema);
}
return element;
......
......@@ -69,10 +69,7 @@ namespace VIZ.Package.Storage
public XElement ToXmlElement()
{
XElement entry = new XElement("entry");
if (!string.IsNullOrWhiteSpace(this.Name))
{
entry.SetAttributeValue("name", this.Name);
}
entry.SetAttributeValueIfValueNotNull("name", this.Name);
if (this.Value != null)
{
......
......@@ -30,6 +30,11 @@ namespace VIZ.Package.Storage
public string Description { get; set; }
/// <summary>
/// 位置
/// </summary>
public string Location { get; set; }
/// <summary>
/// 定义
/// </summary>
public ControlObject_Schema_Node Schema { get; set; }
......@@ -43,6 +48,7 @@ namespace VIZ.Package.Storage
this.Name = element.GetAttributeValue<string>("name");
this.Type = element.GetAttributeValue<string>("type");
this.Description = element.GetAttributeValue<string>("description");
this.Location = element.GetAttributeValue<string>("location");
var schema = element.Element("schema");
if (schema == null)
......@@ -57,7 +63,13 @@ namespace VIZ.Package.Storage
/// </summary>
public XElement ToXmlElement()
{
throw new NotImplementedException();
XElement entry = new XElement("field");
entry.SetAttributeValueIfValueNotNull("name", this.Name);
entry.SetAttributeValueIfValueNotNull("type", this.Type);
entry.SetAttributeValueIfValueNotNull("description", this.Description);
entry.SetAttributeValueIfValueNotNull("location", this.Location);
return entry;
}
}
}
......@@ -37,7 +37,17 @@ namespace VIZ.Package.Storage
/// </summary>
public XElement ToXmlElement()
{
throw new NotImplementedException();
XElement element = new XElement("schema");
if (this.Fields.Count == 0)
return element;
foreach (var item in this.Fields)
{
element.Add(item.ToXmlElement());
}
return element;
}
}
}
......@@ -6,6 +6,7 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "00-Doc", "00-Doc", "{4F55B183-4696-461C-8284-040FA7472C39}"
ProjectSection(SolutionItems) = preProject
Doc\底飞_insert.xml = Doc\底飞_insert.xml
Doc\底飞_set.xml = Doc\底飞_set.xml
Doc\底飞_update.xml = Doc\底飞_update.xml
Doc\控制对象自定义字段.txt = Doc\控制对象自定义字段.txt
EndProjectSection
......
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