Commit d4cf00b2 by liulongfei

命令模板窗口

parent 4db1bb43
...@@ -215,6 +215,11 @@ namespace VIZ.Package.Domain ...@@ -215,6 +215,11 @@ namespace VIZ.Package.Domain
public const string OPERATE_PAGE_ADD = "添加页"; public const string OPERATE_PAGE_ADD = "添加页";
/// <summary> /// <summary>
/// 添加命令模板页
/// </summary>
public const string OPERATE_PAGE_ADD_CMD = "添加命令模板页";
/// <summary>
/// 修改页号 /// 修改页号
/// </summary> /// </summary>
public const string OPERATE_PAGE_CHANGE_PAGE_NUM = "修改页号"; public const string OPERATE_PAGE_CHANGE_PAGE_NUM = "修改页号";
......
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 { ...@@ -59,15 +59,5 @@ namespace VIZ.Package.Module.Resource.Properties {
resourceCulture = value; 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 @@ ...@@ -117,8 +117,4 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </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> </root>
\ No newline at end of file
...@@ -104,6 +104,7 @@ ...@@ -104,6 +104,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Converter\ConnGroupStatus2BrushConverter.cs" /> <Compile Include="Converter\ConnGroupStatus2BrushConverter.cs" />
<Compile Include="Converter\PageThumbnailConverter.cs" />
<Compile Include="Converter\VizControlFieldTypeStringConverter.cs" /> <Compile Include="Converter\VizControlFieldTypeStringConverter.cs" />
<Compile Include="Converter\ResourceFileSelectionModeConverter.cs" /> <Compile Include="Converter\ResourceFileSelectionModeConverter.cs" />
<Compile Include="Converter\RichText2TextConverter.cs" /> <Compile Include="Converter\RichText2TextConverter.cs" />
...@@ -138,9 +139,6 @@ ...@@ -138,9 +139,6 @@
<Resource Include="Icons\project_24x24.png" /> <Resource Include="Icons\project_24x24.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Resources\cmd_template.jpg" />
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\take_continue_30x30.png" /> <Resource Include="Icons\take_continue_30x30.png" />
<Resource Include="Icons\take_in_30x30.png" /> <Resource Include="Icons\take_in_30x30.png" />
<Resource Include="Icons\take_out_30x30.png" /> <Resource Include="Icons\take_out_30x30.png" />
...@@ -289,5 +287,8 @@ ...@@ -289,5 +287,8 @@
<ItemGroup> <ItemGroup>
<Resource Include="Icons\down_32x32.png" /> <Resource Include="Icons\down_32x32.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="Images\cmd_template.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>
\ No newline at end of file
...@@ -64,13 +64,6 @@ namespace VIZ.Package.Module ...@@ -64,13 +64,6 @@ namespace VIZ.Package.Module
} }
this.vizCommandService.SetEnabledUpdate(conn, true); this.vizCommandService.SetEnabledUpdate(conn, true);
this.vizCommandService.Start(conn, ApplicationDomainEx.CurrentPage.Layer); this.vizCommandService.Start(conn, ApplicationDomainEx.CurrentPage.Layer);
// 执行命令
IPageCommandService pageCommandService = ApplicationDomainEx.ServiceManager.GetService<IPageCommandService>(ViewServiceKeys.PAGE_COMMAND_SERVICE);
if (pageCommandService == null)
return;
pageCommandService.BeginExecuteTakeCommand(ApplicationDomainEx.CurrentPage, conn);
} }
/// <summary> /// <summary>
...@@ -184,13 +177,21 @@ namespace VIZ.Package.Module ...@@ -184,13 +177,21 @@ namespace VIZ.Package.Module
transitionLogicLayer.SceneIdentifier = newPageBase.Scene; transitionLogicLayer.SceneIdentifier = newPageBase.Scene;
transitionLogicLayer.StateIdentifier = newPageBase.StateIdentifier; transitionLogicLayer.StateIdentifier = newPageBase.StateIdentifier;
transitionLogicLayer.ControlObject = controlObjectValue; 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); IPageCommandService pageCommandService = ApplicationDomainEx.ServiceManager.GetService<IPageCommandService>(ViewServiceKeys.PAGE_COMMAND_SERVICE);
if (pageCommandService == null) if (pageCommandService == null)
return; return;
pageCommandService.BeginExecuteTakeCommand(ApplicationDomainEx.CurrentPage, conn); pageCommandService.BeginExecuteTakeCommand(pageBase, conn);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
...@@ -251,6 +252,21 @@ namespace VIZ.Package.Module ...@@ -251,6 +252,21 @@ namespace VIZ.Package.Module
pageCommandService.BeginExecuteTakeContinueCommand(ApplicationDomainEx.CurrentPage, conn); 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);
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// 下板 // 下板
...@@ -266,13 +282,6 @@ namespace VIZ.Package.Module ...@@ -266,13 +282,6 @@ namespace VIZ.Package.Module
{ {
this.vizCommandService.TakeOut(conn, newPageBase.Layer); this.vizCommandService.TakeOut(conn, newPageBase.Layer);
view?.TakeOut(conn); view?.TakeOut(conn);
// 执行命令
IPageCommandService pageCommandService = ApplicationDomainEx.ServiceManager.GetService<IPageCommandService>(ViewServiceKeys.PAGE_COMMAND_SERVICE);
if (pageCommandService == null)
return;
pageCommandService.BeginExecuteTakeOutCommand(ApplicationDomainEx.CurrentPage, conn);
} }
/// <summary> /// <summary>
...@@ -306,13 +315,21 @@ namespace VIZ.Package.Module ...@@ -306,13 +315,21 @@ namespace VIZ.Package.Module
SceneInfoModel sceneInfo = newPageBase.GetSceneInfo(); SceneInfoModel sceneInfo = newPageBase.GetSceneInfo();
TransitionLogicLayerInfo logicLayer = bgSceneInfo.TransitionLogic.LayerInfos.FirstOrDefault(p => p.LayerIdentifier == newPageBase.LayerIdentifier); TransitionLogicLayerInfo logicLayer = bgSceneInfo.TransitionLogic.LayerInfos.FirstOrDefault(p => p.LayerIdentifier == newPageBase.LayerIdentifier);
bgSceneInfo.TransitionLogic.LayerInfos.Remove(logicLayer); 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); IPageCommandService pageCommandService = ApplicationDomainEx.ServiceManager.GetService<IPageCommandService>(ViewServiceKeys.PAGE_COMMAND_SERVICE);
if (pageCommandService == null) if (pageCommandService == null)
return; return;
pageCommandService.BeginExecuteTakeOutCommand(ApplicationDomainEx.CurrentPage, conn); pageCommandService.BeginExecuteTakeOutCommand(pageBase, conn);
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
...@@ -343,13 +360,6 @@ namespace VIZ.Package.Module ...@@ -343,13 +360,6 @@ namespace VIZ.Package.Module
log.Error(ex); log.Error(ex);
} }
this.vizCommandService.SetEnabledUpdate(conn, true); this.vizCommandService.SetEnabledUpdate(conn, true);
// 执行命令
IPageCommandService pageCommandService = ApplicationDomainEx.ServiceManager.GetService<IPageCommandService>(ViewServiceKeys.PAGE_COMMAND_SERVICE);
if (pageCommandService == null)
return;
pageCommandService.BeginExecuteTakeUpdateCommand(ApplicationDomainEx.CurrentPage, conn);
} }
/// <summary> /// <summary>
...@@ -376,13 +386,21 @@ namespace VIZ.Package.Module ...@@ -376,13 +386,21 @@ namespace VIZ.Package.Module
{ {
view.TakeUpdate(conn); 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); IPageCommandService pageCommandService = ApplicationDomainEx.ServiceManager.GetService<IPageCommandService>(ViewServiceKeys.PAGE_COMMAND_SERVICE);
if (pageCommandService == null) if (pageCommandService == null)
return; return;
pageCommandService.BeginExecuteTakeUpdateCommand(ApplicationDomainEx.CurrentPage, conn); pageCommandService.BeginExecuteTakeUpdateCommand(pageBase, conn);
} }
} }
} }
...@@ -141,14 +141,18 @@ namespace VIZ.Package.Module ...@@ -141,14 +141,18 @@ namespace VIZ.Package.Module
this.Execute( this.Execute(
action: (obj, view, conn) => action: (obj, view, conn) =>
{ {
if (obj.TransitionLogic) if (ApplicationDomainEx.CurrentPage.PageType == PageType.Scene)
{ {
this.controlController.ContinueTransitionLogic(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn); if (obj.TransitionLogic)
} {
else this.controlController.ContinueTransitionLogic(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn);
{ }
this.controlController.ContinueNormal(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); over: null);
} }
...@@ -173,14 +177,18 @@ namespace VIZ.Package.Module ...@@ -173,14 +177,18 @@ namespace VIZ.Package.Module
this.Execute( this.Execute(
action: (obj, view, conn) => action: (obj, view, conn) =>
{ {
if (obj.TransitionLogic) if (ApplicationDomainEx.CurrentPage.PageType == PageType.Scene)
{ {
this.controlController.TakeOutTransitionLogic(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn); if (obj.TransitionLogic)
} {
else this.controlController.TakeOutTransitionLogic(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn);
{ }
this.controlController.TakeOutNormal(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: () => over: () =>
{ {
...@@ -225,14 +233,18 @@ namespace VIZ.Package.Module ...@@ -225,14 +233,18 @@ namespace VIZ.Package.Module
this.Execute( this.Execute(
action: (obj, view, conn) => action: (obj, view, conn) =>
{ {
if (obj.TransitionLogic) if (ApplicationDomainEx.CurrentPage.PageType == PageType.Scene)
{ {
this.controlController.UpdateTransitionLogic(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn); if (obj.TransitionLogic)
} {
else this.controlController.UpdateTransitionLogic(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn);
{ }
this.controlController.UpdateNormal(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); over: null);
} }
...@@ -363,14 +375,18 @@ namespace VIZ.Package.Module ...@@ -363,14 +375,18 @@ namespace VIZ.Package.Module
this.Execute( this.Execute(
action: (obj, view, conn) => action: (obj, view, conn) =>
{ {
if (obj.TransitionLogic) if (ApplicationDomainEx.CurrentPage.PageType == PageType.Scene)
{ {
this.controlController.TakeTransitionLogic(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn); if (obj.TransitionLogic)
} {
else this.controlController.TakeTransitionLogic(ApplicationDomainEx.CurrentTake, ApplicationDomainEx.CurrentPage, obj, view, conn);
{ }
this.controlController.TakeNormal(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: () => over: () =>
{ {
......
...@@ -152,6 +152,9 @@ namespace VIZ.Package.Module ...@@ -152,6 +152,9 @@ namespace VIZ.Package.Module
ThreadHelper.SafeRun(action: () => ThreadHelper.SafeRun(action: () =>
{ {
if (msg.Page.PageType != PageType.Scene)
return;
// 从本地数据库获取控制对象 // 从本地数据库获取控制对象
ControlObjectEntity entity = this.controlObjectService.GetControlObject(msg.Page)?.FirstOrDefault(); ControlObjectEntity entity = this.controlObjectService.GetControlObject(msg.Page)?.FirstOrDefault();
ControlObjectModel controlObject = new ControlObjectModel(); ControlObjectModel controlObject = new ControlObjectModel();
......
...@@ -14,6 +14,12 @@ namespace VIZ.Package.Module ...@@ -14,6 +14,12 @@ namespace VIZ.Package.Module
public interface IPageGroupService : IService public interface IPageGroupService : IService
{ {
/// <summary> /// <summary>
/// 创建并添加命令模板页
/// </summary>
/// <returns>页</returns>
PageModel AddCmdPage();
/// <summary>
/// 添加页 /// 添加页
/// </summary> /// </summary>
/// <param name="template">模板</param> /// <param name="template">模板</param>
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
<resource:RowHandleConverter x:Key="RowHandleConverter"></resource:RowHandleConverter> <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:Bitmap2ImageSourceConverter x:Key="Bitmap2ImageSourceConverter"></fcore:Bitmap2ImageSourceConverter>
<fcore:Enum2EnumDescriptionConverter x:Key="Enum2EnumDescriptionConverter" EnumType="{x:Type storage:PageType}"></fcore:Enum2EnumDescriptionConverter> <fcore:Enum2EnumDescriptionConverter x:Key="Enum2EnumDescriptionConverter" EnumType="{x:Type storage:PageType}"></fcore:Enum2EnumDescriptionConverter>
<fcore:Bool2SolidColorBrushConverter x:Key="RowHandleBgConverter" <fcore:Bool2SolidColorBrushConverter x:Key="RowHandleBgConverter"
...@@ -173,7 +175,7 @@ ...@@ -173,7 +175,7 @@
VisibleIndex="{Binding Path=VisibleIndex,Mode=TwoWay}"> VisibleIndex="{Binding Path=VisibleIndex,Mode=TwoWay}">
<common:GridColumnResizeMinHeight.CellTemplate> <common:GridColumnResizeMinHeight.CellTemplate>
<DataTemplate> <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" IconSource="/VIZ.Package.Module.Resource;component/Icons/image_20x20.png"
ShowImageMinWidth="50" ShowImageMinHeight="50"> ShowImageMinWidth="50" ShowImageMinHeight="50">
</fcommon:ResizeImageControl> </fcommon:ResizeImageControl>
...@@ -398,6 +400,8 @@ ...@@ -398,6 +400,8 @@
ColumnGeneratorTemplateSelector="{StaticResource ResourceKey=ColumnDefintionGeneratorTemplateSelector}"> ColumnGeneratorTemplateSelector="{StaticResource ResourceKey=ColumnDefintionGeneratorTemplateSelector}">
<dxg:GridControl.ContextMenu> <dxg:GridControl.ContextMenu>
<common:ContextMenuEx BindingTargetType="{x:Type dx:DXTabControl}"> <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}}}"/> <MenuItem Header="粘贴页" Command="{Binding Path=DataContext.PastePageCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type common:ContextMenuEx}}}"/>
</common:ContextMenuEx> </common:ContextMenuEx>
</dxg:GridControl.ContextMenu> </dxg:GridControl.ContextMenu>
...@@ -439,6 +443,10 @@ ...@@ -439,6 +443,10 @@
Command="{Binding ElementName=uc,Path=DataContext.OpenPageCommand}" Command="{Binding ElementName=uc,Path=DataContext.OpenPageCommand}"
Tag="{x:Static Member=common:GridControlHelper.KEEP_MENU_TAG}"/> Tag="{x:Static Member=common:GridControlHelper.KEEP_MENU_TAG}"/>
<dxb:BarItemLinkSeparator /> <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="更新选中页" <dxb:BarButtonItem Name="Update" Content="更新选中页"
Command="{Binding ElementName=uc,Path=DataContext.UpdateCommand}" Command="{Binding ElementName=uc,Path=DataContext.UpdateCommand}"
Tag="{x:Static Member=common:GridControlHelper.KEEP_MENU_TAG}"/> Tag="{x:Static Member=common:GridControlHelper.KEEP_MENU_TAG}"/>
......
...@@ -94,6 +94,7 @@ namespace VIZ.Package.Module ...@@ -94,6 +94,7 @@ namespace VIZ.Package.Module
this.AddGroupCommand = new VCommand(this.AddGroup); this.AddGroupCommand = new VCommand(this.AddGroup);
this.RenameGroupCommand = new VCommand(this.RenameGroup); this.RenameGroupCommand = new VCommand(this.RenameGroup);
this.DeleteGroupCommand = new VCommand(this.DeleteGroup); this.DeleteGroupCommand = new VCommand(this.DeleteGroup);
this.CreateCmdPageCommand = new VCommand(this.CreateCmdPage, this.CanCreateCmdPage);
this.DeleteItemCommand = new VCommand(this.DeleteItem); this.DeleteItemCommand = new VCommand(this.DeleteItem);
this.OpenPageCommand = new VCommand(this.OpenPage, this.CanOpenPage); this.OpenPageCommand = new VCommand(this.OpenPage, this.CanOpenPage);
this.OpenAndTakePageCommand = new VCommand(this.OpenAndTakePage, this.CanOpenAndTakePage); this.OpenAndTakePageCommand = new VCommand(this.OpenAndTakePage, this.CanOpenAndTakePage);
...@@ -393,6 +394,32 @@ namespace VIZ.Package.Module ...@@ -393,6 +394,32 @@ namespace VIZ.Package.Module
#endregion #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 -- 刪除項命令 #region DeleteItemCommand -- 刪除項命令
/// <summary> /// <summary>
...@@ -1177,6 +1204,33 @@ namespace VIZ.Package.Module ...@@ -1177,6 +1204,33 @@ namespace VIZ.Package.Module
// ====================================================================================== // ======================================================================================
/// <summary> /// <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> /// </summary>
/// <param name="template">模板</param> /// <param name="template">模板</param>
......
...@@ -44,17 +44,12 @@ ...@@ -44,17 +44,12 @@
<TextBlock Text="{Binding PageID}" Margin="10,0,0,0" MinWidth="40" d:Foreground="White"></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="场景:" 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="{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> </StackPanel>
</Border> </Border>
<!-- 命令输入框 --> <!-- 命令输入框 -->
<dx:DXTabControl Grid.Row="1" Margin="0,10,0,0" Padding="0,5,0,0"> <dx:DXTabControl Grid.Row="1" Margin="0,10,0,0" Padding="0,5,0,0">
<dx:DXTabControl.View>
<dx:TabControlStretchView HeaderLocation="Top" ShowHeaderMenu="False"
NewButtonShowMode="NoWhere"
HideButtonShowMode="NoWhere"
PinnedTabSize="60">
</dx:TabControlStretchView>
</dx:DXTabControl.View>
<dx:DXTabItem Header="Take"> <dx:DXTabItem Header="Take">
<dxe:TextEdit AcceptsReturn="True" EditValue="{Binding Path=TakeCommand,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="5" <dxe:TextEdit AcceptsReturn="True" EditValue="{Binding Path=TakeCommand,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="5"
VerticalContentAlignment="Top"></dxe:TextEdit> VerticalContentAlignment="Top"></dxe:TextEdit>
......
...@@ -159,6 +159,20 @@ namespace VIZ.Package.Module ...@@ -159,6 +159,20 @@ namespace VIZ.Package.Module
#endregion #endregion
#region PageType -- 页类型
private string pageType;
/// <summary>
/// 页类型
/// </summary>
public string PageType
{
get { return pageType; }
set { pageType = value; this.RaisePropertyChanged(nameof(pageType)); }
}
#endregion
// ====================================================================================== // ======================================================================================
// Command // Command
// ====================================================================================== // ======================================================================================
...@@ -183,6 +197,7 @@ namespace VIZ.Package.Module ...@@ -183,6 +197,7 @@ namespace VIZ.Package.Module
} }
this.Scene = msg.Page.Scene; this.Scene = msg.Page.Scene;
this.PageType = msg.Page.PageType.GetDescription();
Guid templateIdOrPageId = msg.Page.GetTemplateIdOrPageId(); Guid templateIdOrPageId = msg.Page.GetTemplateIdOrPageId();
......
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 ...@@ -172,6 +172,11 @@ namespace VIZ.Package.Module
private VizPreviewController vizPreviewController; private VizPreviewController vizPreviewController;
/// <summary> /// <summary>
/// Viz预览命令控制器
/// </summary>
private VizPreviewCmdController vizPreviewCmdController = new VizPreviewCmdController();
/// <summary>
/// VIZ命令服务 /// VIZ命令服务
/// </summary> /// </summary>
private VizCommandService vizCommandService = new VizCommandService(); private VizCommandService vizCommandService = new VizCommandService();
...@@ -349,15 +354,13 @@ namespace VIZ.Package.Module ...@@ -349,15 +354,13 @@ namespace VIZ.Package.Module
this.vizCommandService.SetEnabledUpdate(conn, false); this.vizCommandService.SetEnabledUpdate(conn, false);
try try
{ {
this.vizCommandService.Start(conn, null, VizLayer.MAIN_LAYER); if (ApplicationDomainEx.CurrentPage.PageType == PageType.Scene)
view?.PreviewIn(conn); {
this.vizCommandService.Start(conn, null, VizLayer.MAIN_LAYER);
// 执行命令 view?.PreviewIn(conn);
IPageCommandService pageCommandService = ApplicationDomainEx.ServiceManager.GetService<IPageCommandService>(ViewServiceKeys.PAGE_COMMAND_SERVICE); }
if (pageCommandService == null)
return;
pageCommandService.BeginExecuteTakeCommand(ApplicationDomainEx.CurrentPage, conn); this.vizPreviewCmdController.TakeCommnad(ApplicationDomainEx.CurrentPage, conn);
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -386,15 +389,13 @@ namespace VIZ.Package.Module ...@@ -386,15 +389,13 @@ namespace VIZ.Package.Module
this.Execute((obj, view, conn) => this.Execute((obj, view, conn) =>
{ {
this.vizCommandService.Continue(conn, null, VizLayer.MAIN_LAYER); if (ApplicationDomainEx.CurrentPage.PageType == PageType.Scene)
view?.PreviewContinue(conn); {
this.vizCommandService.Continue(conn, null, VizLayer.MAIN_LAYER);
// 执行命令 view?.PreviewContinue(conn);
IPageCommandService pageCommandService = ApplicationDomainEx.ServiceManager.GetService<IPageCommandService>(ViewServiceKeys.PAGE_COMMAND_SERVICE); }
if (pageCommandService == null)
return;
pageCommandService.BeginExecuteTakeContinueCommand(ApplicationDomainEx.CurrentPage, conn); this.vizPreviewCmdController.ContinueCommnad(ApplicationDomainEx.CurrentPage, conn);
}); });
} }
...@@ -417,15 +418,13 @@ namespace VIZ.Package.Module ...@@ -417,15 +418,13 @@ namespace VIZ.Package.Module
this.Execute((obj, view, conn) => this.Execute((obj, view, conn) =>
{ {
this.vizCommandService.Stop(conn, null, VizLayer.MAIN_LAYER); if (ApplicationDomainEx.CurrentPage.PageType == PageType.Scene)
view?.PreviewOut(conn); {
this.vizCommandService.Stop(conn, null, VizLayer.MAIN_LAYER);
// 执行命令 view?.PreviewOut(conn);
IPageCommandService pageCommandService = ApplicationDomainEx.ServiceManager.GetService<IPageCommandService>(ViewServiceKeys.PAGE_COMMAND_SERVICE); }
if (pageCommandService == null)
return;
pageCommandService.BeginExecuteTakeOutCommand(ApplicationDomainEx.CurrentPage, conn); this.vizPreviewCmdController.TakeOutCommnad(ApplicationDomainEx.CurrentPage, conn);
}); });
} }
...@@ -457,28 +456,27 @@ namespace VIZ.Package.Module ...@@ -457,28 +456,27 @@ namespace VIZ.Package.Module
// 执行更新流程 // 执行更新流程
this.Execute((obj, view, conn) => this.Execute((obj, view, conn) =>
{ {
this.vizCommandService.SetEnabledUpdate(conn, false); if (ApplicationDomainEx.CurrentPage.PageType == PageType.Scene)
try
{ {
if (obj != null)
this.vizCommandService.SetEnabledUpdate(conn, false);
try
{ {
this.vizCommandControlObjectService.SetControlObject(conn, obj); if (obj != null)
this.vizCommandControlObjectService.SetCustomControlFieldValue(conn, obj.AllFiledNodes); {
this.vizCommandControlObjectService.SetControlObject(conn, obj);
this.vizCommandControlObjectService.SetCustomControlFieldValue(conn, obj.AllFiledNodes);
}
view?.PreviewUpdate(conn);
} }
view?.PreviewUpdate(conn); catch (Exception ex)
} {
catch (Exception ex) log.Error(ex);
{ }
log.Error(ex); this.vizCommandService.SetEnabledUpdate(conn, true);
} }
this.vizCommandService.SetEnabledUpdate(conn, true);
// 执行命令 this.vizPreviewCmdController.UpdateCommnad(ApplicationDomainEx.CurrentPage, conn);
IPageCommandService pageCommandService = ApplicationDomainEx.ServiceManager.GetService<IPageCommandService>(ViewServiceKeys.PAGE_COMMAND_SERVICE);
if (pageCommandService == null)
return;
pageCommandService.BeginExecuteTakeUpdateCommand(ApplicationDomainEx.CurrentPage, conn);
}); });
} }
...@@ -575,7 +573,10 @@ namespace VIZ.Package.Module ...@@ -575,7 +573,10 @@ namespace VIZ.Package.Module
ThreadHelper.SafeRun(() => 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(() => WPFHelper.BeginInvoke(() =>
......
...@@ -169,6 +169,7 @@ ...@@ -169,6 +169,7 @@
</Compile> </Compile>
<Compile Include="Plugin\Model\PluginNavigationConfig.cs" /> <Compile Include="Plugin\Model\PluginNavigationConfig.cs" />
<Compile Include="Plugin\Service\IPluginService.cs" /> <Compile Include="Plugin\Service\IPluginService.cs" />
<Compile Include="Preview\VizPreview\Controller\VizPreviewCmdController.cs" />
<Compile Include="ProjectManager\ViewModel\SaveProjectWindowModel.cs" /> <Compile Include="ProjectManager\ViewModel\SaveProjectWindowModel.cs" />
<Compile Include="ProjectManager\ViewModel\ProjectTreePanelModel.cs" /> <Compile Include="ProjectManager\ViewModel\ProjectTreePanelModel.cs" />
<Compile Include="ProjectManager\View\SaveProjectWindow.xaml.cs"> <Compile Include="ProjectManager\View\SaveProjectWindow.xaml.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