Commit f3befbca by liulongfei

命令窗口辅助

parent a261c56c
...@@ -35,6 +35,11 @@ namespace VIZ.Package.Domain ...@@ -35,6 +35,11 @@ namespace VIZ.Package.Domain
/// </summary> /// </summary>
public const string SYSTEM_HOT_KEY = "触发快捷键"; public const string SYSTEM_HOT_KEY = "触发快捷键";
/// <summary>
/// 页命令日志
/// </summary>
public const string SYSTEM_PAGE_CMD_LOG = "页命令日志";
// ============================================================================= // =============================================================================
// Task // Task
// ============================================================================= // =============================================================================
......
...@@ -11,13 +11,14 @@ using System.Windows.Data; ...@@ -11,13 +11,14 @@ using System.Windows.Data;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using VIZ.Package.Domain; using VIZ.Package.Domain;
using VIZ.Package.Storage;
namespace VIZ.Package.Module.Resource namespace VIZ.Package.Module.Resource
{ {
/// <summary> /// <summary>
/// 页缩略图转化器 /// 页缩略图转化器
/// </summary> /// </summary>
public class PageThumbnailConverter : IValueConverter public class PageThumbnailMultiConverter : IMultiValueConverter
{ {
[DllImport("gdi32.dll", SetLastError = true)] [DllImport("gdi32.dll", SetLastError = true)]
private static extern bool DeleteObject(IntPtr hObject); private static extern bool DeleteObject(IntPtr hObject);
...@@ -27,20 +28,21 @@ namespace VIZ.Package.Module.Resource ...@@ -27,20 +28,21 @@ namespace VIZ.Package.Module.Resource
/// </summary> /// </summary>
public ImageSource CommandThumbnail { get; set; } public ImageSource CommandThumbnail { get; set; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{ {
PageModelBase pageBase = value as PageModelBase; if (values == null || values.Length != 2)
if (pageBase == null)
return null; return null;
if (pageBase.PageType == Storage.PageType.Command) if (!(values[1] is PageType type))
return null;
if (type == PageType.Command)
return this.CommandThumbnail; return this.CommandThumbnail;
Bitmap bitmap = pageBase.ThumbnailBitmap; if (!(values[0] is Bitmap bmp))
if (bitmap == null)
return null; return null;
IntPtr hBitmap = bitmap.GetHbitmap(); IntPtr hBitmap = bmp.GetHbitmap();
ImageSource wpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( ImageSource wpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
hBitmap, hBitmap,
IntPtr.Zero, IntPtr.Zero,
...@@ -53,7 +55,7 @@ namespace VIZ.Package.Module.Resource ...@@ -53,7 +55,7 @@ namespace VIZ.Package.Module.Resource
return wpfBitmap; return wpfBitmap;
} }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
......
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Converter\ConnGroupStatus2BrushConverter.cs" /> <Compile Include="Converter\ConnGroupStatus2BrushConverter.cs" />
<Compile Include="Converter\PageThumbnailConverter.cs" /> <Compile Include="Converter\PageThumbnailMultiConverter.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" />
...@@ -290,5 +290,8 @@ ...@@ -290,5 +290,8 @@
<ItemGroup> <ItemGroup>
<Resource Include="Images\cmd_template.png" /> <Resource Include="Images\cmd_template.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="Icons\icon_cmd_32x32.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>
\ No newline at end of file
...@@ -103,14 +103,10 @@ ...@@ -103,14 +103,10 @@
<!-- 数据 --> <!-- 数据 -->
<dxg:GridControl ItemsSource="{Binding Path=ItemsSource}" ShowBorder="True" Grid.Row="1" AllowDrop="True" <dxg:GridControl ItemsSource="{Binding Path=ItemsSource}" ShowBorder="True" Grid.Row="1" AllowDrop="True"
ColumnsSource="{Binding Path=Columns}" SelectionMode="Cell" Margin="10" ColumnsSource="{Binding Path=Columns}" SelectionMode="Row" Margin="10"
SelectedItem="{Binding Path=SelectedValue}" SelectedItem="{Binding Path=SelectedValue}"
SelectedItems="{Binding Path=SelectedValues}"
ColumnGeneratorTemplate="{StaticResource ColumnTemplate}"> ColumnGeneratorTemplate="{StaticResource ColumnTemplate}">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="SelectionChanged" PassEventArgsToCommand="True" Command="{Binding Path=SelectionChangedCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<dxg:GridControl.ContextMenu> <dxg:GridControl.ContextMenu>
<ContextMenu> <ContextMenu>
<MenuItem Header="添加" Command="{Binding Path=PlacementTarget.DataContext.AddCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/> <MenuItem Header="添加" Command="{Binding Path=PlacementTarget.DataContext.AddCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
......
...@@ -34,6 +34,9 @@ namespace VIZ.Package.Module ...@@ -34,6 +34,9 @@ namespace VIZ.Package.Module
{ {
// 初始化命令 // 初始化命令
this.InitCommand(); this.InitCommand();
// 初始化消息
this.InitMessage();
} }
/// <summary> /// <summary>
...@@ -51,6 +54,16 @@ namespace VIZ.Package.Module ...@@ -51,6 +54,16 @@ namespace VIZ.Package.Module
this.PreviewSetPosCommand = new VCommand(this.PreviewSetPos); this.PreviewSetPosCommand = new VCommand(this.PreviewSetPos);
} }
/// <summary>
/// 初始化消息
/// </summary>
private void InitMessage()
{
ApplicationDomainEx.MessageManager.Register<PageOpenMessage>(this, this.OnPageOpenMessage);
ApplicationDomainEx.MessageManager.Register<PageSaveMessage>(this, this.OnPageSaveMessage);
ApplicationDomainEx.MessageManager.Register<PageSaveAsMessage>(this, this.OnPageSaveAsMessage);
}
// ============================================================ // ============================================================
// Service & Controller // Service & Controller
// ============================================================ // ============================================================
...@@ -149,6 +162,20 @@ namespace VIZ.Package.Module ...@@ -149,6 +162,20 @@ namespace VIZ.Package.Module
#endregion #endregion
#region SelectedValues -- 当前选中项的集合
private ObservableCollection<ExpandoObject> selectedValues = new ObservableCollection<ExpandoObject>();
/// <summary>
/// 当前选中项的集合
/// </summary>
public ObservableCollection<ExpandoObject> SelectedValues
{
get { return selectedValues; }
set { selectedValues = value; this.RaisePropertyChanged(nameof(SelectedValues)); }
}
#endregion
#region ScrollElementPackage -- 底飞数据包 #region ScrollElementPackage -- 底飞数据包
private ScrollElementPackageEntity scrollElementPackage; private ScrollElementPackageEntity scrollElementPackage;
...@@ -255,10 +282,14 @@ namespace VIZ.Package.Module ...@@ -255,10 +282,14 @@ namespace VIZ.Package.Module
/// </summary> /// </summary>
private void Remove() private void Remove()
{ {
if (this.SelectedValue == null) if (this.SelectedValues == null || this.SelectedValues.Count == 0)
return; return;
this.ItemsSource.Remove(this.SelectedValue); List<ExpandoObject> list = this.SelectedValues.ToList();
foreach (ExpandoObject item in list)
{
this.ItemsSource.Remove(item);
}
} }
#endregion #endregion
...@@ -336,6 +367,57 @@ namespace VIZ.Package.Module ...@@ -336,6 +367,57 @@ namespace VIZ.Package.Module
// Message // Message
// ============================================================ // ============================================================
/// <summary>
/// 页打开消息
/// </summary>
/// <param name="msg">消息</param>
private void OnPageOpenMessage(PageOpenMessage msg)
{
this.ScrollElementPackage = null;
this.SceneTemplateModels = null;
this.SelectedSceneTemplateModel = null;
this.Columns = null;
this.ItemsSource = null;
this.SelectedValue = null;
this.PreviewPosition = 0;
}
/// <summary>
/// 页保存消息
/// </summary>
/// <param name="msg">消息</param>
private void OnPageSaveMessage(PageSaveMessage msg)
{
if (this.ScrollElementPackage == null || ApplicationDomainEx.CurrentPage == null || this.ControlField == null)
return;
if (this.ScrollElementPackage.TemplateOrPageID != ApplicationDomainEx.CurrentPage.GetTemplateIdOrPageId())
return;
if (this.ScrollElementPackage.FieldIdentifier != this.ControlField.FieldIdentifier)
return;
this.scrollElementService.SaveScrollElementPackageToDB(this.ScrollElementPackage);
}
/// <summary>
/// 页另存为消息
/// </summary>
/// <param name="msg">消息</param>
private void OnPageSaveAsMessage(PageSaveAsMessage msg)
{
if (this.ScrollElementPackage == null || ApplicationDomainEx.CurrentPage == null || this.ControlField == null)
return;
if (this.ScrollElementPackage.TemplateOrPageID != ApplicationDomainEx.CurrentPage.GetTemplateIdOrPageId())
return;
if (this.ScrollElementPackage.FieldIdentifier != this.ControlField.FieldIdentifier)
return;
this.scrollElementService.SaveScrollElementPackageToDB(this.ScrollElementPackage);
}
// ============================================================ // ============================================================
// Public Function // Public Function
// ============================================================ // ============================================================
...@@ -364,10 +446,14 @@ namespace VIZ.Package.Module ...@@ -364,10 +446,14 @@ namespace VIZ.Package.Module
// 只处理文本与图片类型 // 只处理文本与图片类型
List<ControlFieldNodeModel> fields = new List<ControlFieldNodeModel>(); List<ControlFieldNodeModel> fields = new List<ControlFieldNodeModel>();
if (this.ScrollElementPackage != null && this.ScrollElementPackage.TemplateFields != null)
{
foreach (var field in this.ScrollElementPackage.TemplateFields) foreach (var field in this.ScrollElementPackage.TemplateFields)
{ {
fields.Add(this.vizCommandControlObjectService.CreateControlFieldNodeModeFromEntity(field)); fields.Add(this.vizCommandControlObjectService.CreateControlFieldNodeModeFromEntity(field));
} }
}
this.Columns = this.scrollElementService.GetDynamicColumns(ApplicationDomainEx.CurrentPage, controlObject, fields).ToObservableCollection(); this.Columns = this.scrollElementService.GetDynamicColumns(ApplicationDomainEx.CurrentPage, controlObject, fields).ToObservableCollection();
this.ItemsSource = this.scrollElementService.GetDynamicList(fields, this.ControlField.Value).ToObservableCollection(); this.ItemsSource = this.scrollElementService.GetDynamicList(fields, this.ControlField.Value).ToObservableCollection();
...@@ -418,6 +504,9 @@ namespace VIZ.Package.Module ...@@ -418,6 +504,9 @@ namespace VIZ.Package.Module
/// <returns>字段值</returns> /// <returns>字段值</returns>
public override string GetFieldValue() public override string GetFieldValue()
{ {
if (this.ScrollElementPackage == null)
return string.Empty;
string value = this.scrollElementService.GetScrollElementValue(this.ScrollElementPackage.TemplateScenePath, this.ScrollElementPackage.TemplateFields, this.ItemsSource, VizScrollElementRootTag.entry); string value = this.scrollElementService.GetScrollElementValue(this.ScrollElementPackage.TemplateScenePath, this.ScrollElementPackage.TemplateFields, this.ItemsSource, VizScrollElementRootTag.entry);
return value; return value;
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
</StackPanel> </StackPanel>
</Border> </Border>
<!-- 字段编辑 --> <!-- 字段编辑 -->
<fcommon:NavigationControl ItemsSource="{Binding Path=NavigationConfigs}" Grid.Row="2" Margin="0,5,0,0" <fcommon:NavigationControl ItemsSource="{Binding Path=NavigationConfigs}" Grid.Row="2" Margin="0,5,0,0" PreviewMouseLeftButtonDown="NavigationControl_PreviewMouseLeftButtonDown"
SelectedValue="{Binding Path=SelectedNavigationConfig,Mode=OneWay}"></fcommon:NavigationControl> SelectedValue="{Binding Path=SelectedNavigationConfig,Mode=OneWay}"></fcommon:NavigationControl>
</Grid> </Grid>
</UserControl> </UserControl>
...@@ -27,5 +27,10 @@ namespace VIZ.Package.Module ...@@ -27,5 +27,10 @@ namespace VIZ.Package.Module
WPFHelper.BindingViewModel(this, new FieldEditViewModel()); WPFHelper.BindingViewModel(this, new FieldEditViewModel());
} }
private void NavigationControl_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
}
} }
} }
...@@ -148,9 +148,7 @@ namespace VIZ.Package.Module ...@@ -148,9 +148,7 @@ namespace VIZ.Package.Module
{ {
// 当前没有打开的页或模板 || 当前没有打开的项目 // 当前没有打开的页或模板 || 当前没有打开的项目
if (ApplicationDomainEx.CurrentPage == null || ApplicationDomainEx.ProjectDbContext == null) if (ApplicationDomainEx.CurrentPage == null || ApplicationDomainEx.ProjectDbContext == null)
{
return; return;
}
// 字段树服务不可用 // 字段树服务不可用
IFieldTreeService service = ApplicationDomainEx.ServiceManager.GetService<IFieldTreeService>(ViewServiceKeys.FIELD_TREE_SERVICE); IFieldTreeService service = ApplicationDomainEx.ServiceManager.GetService<IFieldTreeService>(ViewServiceKeys.FIELD_TREE_SERVICE);
......
...@@ -153,7 +153,11 @@ namespace VIZ.Package.Module ...@@ -153,7 +153,11 @@ namespace VIZ.Package.Module
ThreadHelper.SafeRun(action: () => ThreadHelper.SafeRun(action: () =>
{ {
if (msg.Page.PageType != PageType.Scene) if (msg.Page.PageType != PageType.Scene)
{
this.ControlObject = null;
this.SelectedControlField = null;
return; return;
}
// 从本地数据库获取控制对象 // 从本地数据库获取控制对象
ControlObjectEntity entity = this.controlObjectService.GetControlObject(msg.Page)?.FirstOrDefault(); ControlObjectEntity entity = this.controlObjectService.GetControlObject(msg.Page)?.FirstOrDefault();
......
<dx:ThemedWindow x:Class="VIZ.Package.Module.AboutPageCommandWindow"
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:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:local="clr-namespace:VIZ.Package.Module"
mc:Ignorable="d" d:Background="Black"
d:DataContext="{d:DesignInstance Type=local:AboutCustomControlFieldWindowModel}"
WindowStartupLocation="CenterScreen"
Title="摩羯座播控系统" Height="700" Width="1200">
<Grid>
<RichTextBox IsReadOnly="True" Background="Transparent" Margin="5" Foreground="White">
<FlowDocument>
<!-- 注册字段 -->
<Paragraph FontSize="18" FontWeight="Bold">页命令</Paragraph>
<Table>
<Table.Columns>
<TableColumn Width="100"></TableColumn>
<TableColumn Width="160"></TableColumn>
<TableColumn Width="Auto"></TableColumn>
<TableColumn Width="Auto"></TableColumn>
</Table.Columns>
<TableRowGroup>
<TableRow>
<TableCell>
<Paragraph FontSize="14" FontWeight="Bold">命令</Paragraph>
</TableCell>
<TableCell>
<Paragraph FontSize="14" FontWeight="Bold">参数</Paragraph>
</TableCell>
<TableCell>
<Paragraph FontSize="14" FontWeight="Bold">示例</Paragraph>
</TableCell>
<TableCell>
<Paragraph FontSize="14" FontWeight="Bold">示例描述</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell>
<Paragraph Margin="0,10,0,0">delay</Paragraph>
</TableCell>
<TableCell>
<Paragraph Margin="0,10,0,0">毫秒</Paragraph>
</TableCell>
<TableCell>
<Paragraph Margin="0,10,0,0">delay 5000</Paragraph>
</TableCell>
<TableCell>
<Paragraph Margin="0,10,0,0">延时5000毫秒</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell>
<Paragraph Margin="0,10,0,0">log</Paragraph>
</TableCell>
<TableCell>
<Paragraph Margin="0,10,0,0">日志内容</Paragraph>
</TableCell>
<TableCell>
<Paragraph Margin="0,10,0,0">log hello word!</Paragraph>
</TableCell>
<TableCell>
<Paragraph Margin="0,10,0,0">在操作日志中记录"hello word!"</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell>
<Paragraph Margin="0,10,0,0">send</Paragraph>
</TableCell>
<TableCell>
<Paragraph Margin="0,10,0,0">VIZ命令</Paragraph>
</TableCell>
<TableCell>
<Paragraph Margin="0,10,0,0">send RENDERER*MAIN_LAYER SET_OBJECT SCENE*TestScene</Paragraph>
</TableCell>
<TableCell>
<Paragraph Margin="0,10,0,0">向Viz引擎发送命令"RENDERER*MAIN_LAYER SET_OBJECT SCENE*TestScene"</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</FlowDocument>
</RichTextBox>
</Grid>
</dx:ThemedWindow>
using DevExpress.Xpf.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.Shapes;
using VIZ.Framework.Core;
namespace VIZ.Package.Module
{
/// <summary>
/// Interaction logic for AboutPageCommandWindow.xaml
/// </summary>
public partial class AboutPageCommandWindow : ThemedWindow
{
public AboutPageCommandWindow()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new AboutPageCommandWindowModel());
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.Package.Module
{
/// <summary>
/// 关于页命令模型
/// </summary>
public class AboutPageCommandWindowModel : ViewModelBase
{
public AboutPageCommandWindowModel()
{
}
// ==========================================================
// 属性
// ==========================================================
// ==========================================================
// 命令
// ==========================================================
}
}
...@@ -87,6 +87,8 @@ ...@@ -87,6 +87,8 @@
Command="{Binding Path=AboutCommand}"/> Command="{Binding Path=AboutCommand}"/>
<dxb:BarButtonItem Content="关于自定义控制字段" Glyph="/VIZ.Package.Module.Resource;component/Icons/icon_custom_32x32.png" <dxb:BarButtonItem Content="关于自定义控制字段" Glyph="/VIZ.Package.Module.Resource;component/Icons/icon_custom_32x32.png"
Command="{Binding Path=AboutCustomControlFieldCommand}"/> Command="{Binding Path=AboutCustomControlFieldCommand}"/>
<dxb:BarButtonItem Content="关于页命令" Glyph="/VIZ.Package.Module.Resource;component/Icons/icon_cmd_32x32.png"
Command="{Binding Path=AboutPageCommandCommand}"/>
</dxb:BarSubItem> </dxb:BarSubItem>
</dxb:MainMenuControl> </dxb:MainMenuControl>
</StackPanel> </StackPanel>
......
...@@ -53,6 +53,7 @@ namespace VIZ.Package.Module ...@@ -53,6 +53,7 @@ namespace VIZ.Package.Module
this.ResetLayoutCommand = new VCommand(this.ResetLayout); this.ResetLayoutCommand = new VCommand(this.ResetLayout);
this.AboutCommand = new VCommand(this.About); this.AboutCommand = new VCommand(this.About);
this.AboutCustomControlFieldCommand = new VCommand(this.AboutCustomControlField); this.AboutCustomControlFieldCommand = new VCommand(this.AboutCustomControlField);
this.AboutPageCommandCommand = new VCommand(this.AboutPageCommand);
} }
/// <summary> /// <summary>
...@@ -465,6 +466,25 @@ namespace VIZ.Package.Module ...@@ -465,6 +466,25 @@ namespace VIZ.Package.Module
#endregion #endregion
#region AboutPageCommandCommand -- 关于页命令命令
/// <summary>
/// 关于页命令命令
/// </summary>
public VCommand AboutPageCommandCommand { get; set; }
/// <summary>
/// 关于页命令
/// </summary>
private void AboutPageCommand()
{
AboutPageCommandWindow window = new AboutPageCommandWindow();
window.Owner = ApplicationDomainEx.MainWindow;
window.ShowDialog();
}
#endregion
// ===================================================================== // =====================================================================
// Message // Message
// ===================================================================== // =====================================================================
......
...@@ -31,8 +31,8 @@ ...@@ -31,8 +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" <resource:PageThumbnailMultiConverter x:Key="PageThumbnailMultiConverter"
CommandThumbnail="/VIZ.Package.Module.Resource;component/Images/cmd_template.png"></resource:PageThumbnailConverter> CommandThumbnail="/VIZ.Package.Module.Resource;component/Images/cmd_template.png"></resource:PageThumbnailMultiConverter>
<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"
...@@ -175,9 +175,14 @@ ...@@ -175,9 +175,14 @@
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,Converter={StaticResource PageThumbnailConverter}}" <fcommon:ResizeImageControl 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.ImageSource>
<MultiBinding Converter="{StaticResource PageThumbnailMultiConverter}">
<Binding Path="Row.ThumbnailBitmap"/>
<Binding Path="Row.PageType"/>
</MultiBinding>
</fcommon:ResizeImageControl.ImageSource>
</fcommon:ResizeImageControl> </fcommon:ResizeImageControl>
</DataTemplate> </DataTemplate>
</common:GridColumnResizeMinHeight.CellTemplate> </common:GridColumnResizeMinHeight.CellTemplate>
......
...@@ -5,6 +5,8 @@ using System.Text; ...@@ -5,6 +5,8 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using VIZ.Framework.Core; using VIZ.Framework.Core;
using VIZ.Package.Domain; using VIZ.Package.Domain;
using VIZ.Package.Service;
using VIZ.Package.Storage;
namespace VIZ.Package.Module namespace VIZ.Package.Module
{ {
...@@ -14,6 +16,11 @@ namespace VIZ.Package.Module ...@@ -14,6 +16,11 @@ namespace VIZ.Package.Module
public class PageCommandController public class PageCommandController
{ {
/// <summary> /// <summary>
/// 操作日志服务
/// </summary>
private RecordLogService recordLogService = new RecordLogService();
/// <summary>
/// 延时 /// 延时
/// </summary> /// </summary>
/// <remarks> /// <remarks>
...@@ -32,6 +39,15 @@ namespace VIZ.Package.Module ...@@ -32,6 +39,15 @@ namespace VIZ.Package.Module
public const string CMD_SEND = "send"; public const string CMD_SEND = "send";
/// <summary> /// <summary>
/// 记录日志
/// </summary>
/// <remarks>
/// 示例:log xxx
/// 描述:记录命令日志
/// </remarks>
public const string CMD_LOG = "log";
/// <summary>
/// 开始执行命令 /// 开始执行命令
/// </summary> /// </summary>
/// <param name="pageBase">页</param> /// <param name="pageBase">页</param>
...@@ -83,6 +99,7 @@ namespace VIZ.Package.Module ...@@ -83,6 +99,7 @@ namespace VIZ.Package.Module
{ {
case CMD_DELAY: this.ExecuteLine_Delay(pageBase, conn, cmd, args); break; case CMD_DELAY: this.ExecuteLine_Delay(pageBase, conn, cmd, args); break;
case CMD_SEND: this.ExecuteLine_Send(pageBase, conn, cmd, args); break; case CMD_SEND: this.ExecuteLine_Send(pageBase, conn, cmd, args); break;
case CMD_LOG: this.ExecuteLine_Log(pageBase, conn, cmd, args); break;
} }
} }
...@@ -117,5 +134,18 @@ namespace VIZ.Package.Module ...@@ -117,5 +134,18 @@ namespace VIZ.Package.Module
conn.EndpointManager.Send(args); conn.EndpointManager.Send(args);
} }
/// <summary>
/// 执行 -- 记录命令日志
/// </summary>
/// <param name="pageBase">页</param>
/// <param name="conn">连接</param>
/// <param name="cmd">命令</param>
/// <param name="args">参数</param>
private void ExecuteLine_Log(PageModelBase pageBase, ConnModel conn, string cmd, string args)
{
// 记录操作日志
this.recordLogService.AppendLog(ApplicationConstants.APPLICATION_GROUP_NAME, RecordLogOperate.System, RecordLogTrigger.System, RecordLogConstants.SYSTEM_PAGE_CMD_LOG, args);
}
} }
} }
...@@ -42,6 +42,7 @@ namespace VIZ.Package.Module ...@@ -42,6 +42,7 @@ namespace VIZ.Package.Module
info.ID = PLUGIN_ID; info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME; info.Name = PLUGIN_NAME;
info.ViewType = typeof(PageCommandView); info.ViewType = typeof(PageCommandView);
info.Icon = "/VIZ.Package.Module.Resource;component/Icons/icon_cmd_32x32.png";
return info; return info;
} }
......
...@@ -129,7 +129,11 @@ ...@@ -129,7 +129,11 @@
<Compile Include="ControlObject\FieldEdit\Edit\ScrollElementsEdit\ScrollElementsEditPanelModel.cs" /> <Compile Include="ControlObject\FieldEdit\Edit\ScrollElementsEdit\ScrollElementsEditPanelModel.cs" />
<Compile Include="Control\Controller\ControlController.cs" /> <Compile Include="Control\Controller\ControlController.cs" />
<Compile Include="Control\Service\IControlService.cs" /> <Compile Include="Control\Service\IControlService.cs" />
<Compile Include="Help\About\ViewModel\AboutPageCommandWindowModel.cs" />
<Compile Include="Help\About\ViewModel\AboutCustomControlFieldWindowModel.cs" /> <Compile Include="Help\About\ViewModel\AboutCustomControlFieldWindowModel.cs" />
<Compile Include="Help\About\View\AboutPageCommandWindow.xaml.cs">
<DependentUpon>AboutPageCommandWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Help\About\View\AboutCustomControlFieldWindow.xaml.cs"> <Compile Include="Help\About\View\AboutCustomControlFieldWindow.xaml.cs">
<DependentUpon>AboutCustomControlFieldWindow.xaml</DependentUpon> <DependentUpon>AboutCustomControlFieldWindow.xaml</DependentUpon>
</Compile> </Compile>
...@@ -470,6 +474,10 @@ ...@@ -470,6 +474,10 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="Help\About\View\AboutPageCommandWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Help\About\View\AboutCustomControlFieldWindow.xaml"> <Page Include="Help\About\View\AboutCustomControlFieldWindow.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
......
...@@ -4,6 +4,7 @@ using log4net.Repository.Hierarchy; ...@@ -4,6 +4,7 @@ using log4net.Repository.Hierarchy;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Drawing;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
...@@ -290,14 +291,21 @@ namespace VIZ.Package.Service ...@@ -290,14 +291,21 @@ namespace VIZ.Package.Service
return; return;
} }
using (Bitmap dest = new Bitmap(bmp.Width, bmp.Height, bmp.PixelFormat))
using (Graphics g = Graphics.FromImage(dest))
{
g.DrawImage(bmp, 0, 0);
using (System.IO.MemoryStream ms = new System.IO.MemoryStream()) using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
{ {
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); dest.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
ms.Position = 0; ms.Position = 0;
ApplicationDomainEx.ProjectDbContext.SceneThumbnailCache.Upload(id, $"{id}", ms); ApplicationDomainEx.ProjectDbContext.SceneThumbnailCache.Upload(id, $"{id}", ms);
} }
} }
}
catch (Exception ex) catch (Exception ex)
{ {
log.Error(ex); log.Error(ex);
......
...@@ -71,7 +71,8 @@ namespace VIZ.Package.Service ...@@ -71,7 +71,8 @@ namespace VIZ.Package.Service
if (ApplicationDomainEx.PreviewConn == null || !ApplicationDomainEx.PreviewConn.IsConnected) if (ApplicationDomainEx.PreviewConn == null || !ApplicationDomainEx.PreviewConn.IsConnected)
return null; return null;
string result = ApplicationDomainEx.PreviewConn.EndpointManager.Request($"{ApplicationDomainEx.VizPreviewRenderer}*TREE*$object*FUNCTION*ControlObject*in SET ON_CONTAINER {scrollElementField.FieldIdentifier} GEOM*currentPos GET"); ApplicationDomainEx.PreviewConn.EndpointManager.Request($"{ApplicationDomainEx.VizPreviewRenderer}*TREE*$object*FUNCTION*ControlObject*in SET ON_CONTAINER {scrollElementField.FieldIdentifier} GEOM*currentPos GET");
string result = ApplicationDomainEx.PreviewConn.EndpointManager.Request($"{ApplicationDomainEx.VizPreviewRenderer}*TREE*$object*FUNCTION*ControlObject**result GET");
if (string.IsNullOrWhiteSpace(result) || result.StartsWith(ApplicationConstants.VIZ_COMMAND_RESULT_ERROR_PREFIX)) if (string.IsNullOrWhiteSpace(result) || result.StartsWith(ApplicationConstants.VIZ_COMMAND_RESULT_ERROR_PREFIX))
return null; return null;
......
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