Commit cbc951d5 by liulongfei

radio 类型添加

parent e83d954d
...@@ -25,6 +25,11 @@ namespace VIZ.Package.Connection ...@@ -25,6 +25,11 @@ namespace VIZ.Package.Connection
private static ILog log = LogManager.GetLogger(typeof(VizEndpointManager)); private static ILog log = LogManager.GetLogger(typeof(VizEndpointManager));
/// <summary> /// <summary>
/// 图片获取超时时间(单位:毫秒)
/// </summary>
public const int IMAGE_GET_TIME_OUT = 10 * 1000;
/// <summary>
/// VIZ总结点管理器 /// VIZ总结点管理器
/// </summary> /// </summary>
/// <param name="key">键</param> /// <param name="key">键</param>
...@@ -128,6 +133,21 @@ namespace VIZ.Package.Connection ...@@ -128,6 +133,21 @@ namespace VIZ.Package.Connection
} }
/// <summary> /// <summary>
/// 请求图片
/// </summary>
/// <param name="message"></param>
public System.Drawing.Bitmap RequestImage(string message)
{
string errorMessage = null;
VizImage img = this.vizEnginePool.RequestImage(message, IMAGE_GET_TIME_OUT, ref errorMessage);
if (!string.IsNullOrWhiteSpace(errorMessage))
return null;
return img.Image;
}
/// <summary>
/// 销毁 /// 销毁
/// </summary> /// </summary>
public void Dispose() public void Dispose()
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" /> <Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
......
...@@ -39,5 +39,11 @@ namespace VIZ.Package.Domain ...@@ -39,5 +39,11 @@ namespace VIZ.Package.Domain
/// <param name="message">消息</param> /// <param name="message">消息</param>
/// <returns>返回值</returns> /// <returns>返回值</returns>
string Request(string message); string Request(string message);
/// <summary>
/// 请求图片
/// </summary>
/// <param name="message"></param>
System.Drawing.Bitmap RequestImage(string message);
} }
} }
...@@ -98,6 +98,20 @@ namespace VIZ.Package.Domain ...@@ -98,6 +98,20 @@ namespace VIZ.Package.Domain
#endregion #endregion
#region FieldDetail -- 字段描述
private string fieldDetail;
/// <summary>
/// 字段描述
/// </summary>
public string FieldDetail
{
get { return fieldDetail; }
set { fieldDetail = value; this.RaisePropertyChanged(nameof(FieldDetail)); }
}
#endregion
#region Items -- 子节点集合 #region Items -- 子节点集合
private List<ControlFieldNodeModel> items = new List<ControlFieldNodeModel>(); private List<ControlFieldNodeModel> items = new List<ControlFieldNodeModel>();
......
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using VIZ.Package.Storage;
namespace VIZ.Package.Module.Resource
{
/// <summary>
/// 控制字段类型字符串转化器
/// </summary>
public class VizControlFieldTypeStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!(value is VizControlFieldType))
return string.Empty;
VizControlFieldType fieldType = (VizControlFieldType)value;
if (fieldType == VizControlFieldType.none)
return string.Empty;
else
return fieldType.ToString();
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
...@@ -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\VizControlFieldTypeStringConverter.cs" />
<Compile Include="Converter\ResourceFileSelectionModeConverter.cs" /> <Compile Include="Converter\ResourceFileSelectionModeConverter.cs" />
<Compile Include="Converter\RichText2TextConverter.cs" /> <Compile Include="Converter\RichText2TextConverter.cs" />
<Compile Include="Converter\RowHandleConverter.cs" /> <Compile Include="Converter\RowHandleConverter.cs" />
...@@ -166,6 +167,10 @@ ...@@ -166,6 +167,10 @@
<Project>{dbaeae47-1f2d-4b05-82c3-abf7cc33aa2d}</Project> <Project>{dbaeae47-1f2d-4b05-82c3-abf7cc33aa2d}</Project>
<Name>VIZ.Package.Domain</Name> <Name>VIZ.Package.Domain</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\VIZ.Package.Storage\VIZ.Package.Storage.csproj">
<Project>{5bf08a07-9405-4f5d-a7f7-9d9ee17d6dd0}</Project>
<Name>VIZ.Package.Storage</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Icons\bb_36x36.png" /> <Resource Include="Icons\bb_36x36.png" />
......
<UserControl x:Class="VIZ.Package.Module.RadioEditPanel"
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: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"
d:DataContext="{d:DesignInstance Type=local:RadioEditPanelModel}"
d:Background="White"
mc:Ignorable="d"
d:DesignHeight="50" d:DesignWidth="400">
<Grid VerticalAlignment="Top" Margin="0,20,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="值:" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
<dxe:ComboBoxEdit VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Column="1"
Margin="20,0,0,0" MinWidth="240"
ItemsSource="{Binding Path=ItemsSource,Mode=OneWay}"
SelectedIndex="{Binding Path=EditValue,Mode=TwoWay}"></dxe:ComboBoxEdit>
</Grid>
</UserControl>
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>
/// RadioEditPanel.xaml 的交互逻辑
/// </summary>
public partial class RadioEditPanel : UserControl
{
public RadioEditPanel()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new RadioEditPanelModel());
}
}
}
using LiteDB.Engine;
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.Package.Domain;
using VIZ.Package.Service;
namespace VIZ.Package.Module
{
/// <summary>
/// Radio类型编辑面板模型
/// </summary>
public class RadioEditPanelModel : EditPanelModelBase
{
// ============================================================
// Property
// ============================================================
#region EditValue -- 编辑值
private int editValue;
/// <summary>
/// 编辑值
/// </summary>
public int EditValue
{
get { return editValue; }
set
{
editValue = value;
this.RaisePropertyChanged(nameof(EditValue));
this.OnEditValueChanged();
}
}
#endregion
#region ItemsSource -- 数据项集合
private List<string> itemsSource;
/// <summary>
/// 数据项集合
/// </summary>
public List<string> ItemsSource
{
get { return itemsSource; }
set { itemsSource = value; this.RaisePropertyChanged(nameof(ItemsSource)); }
}
#endregion
// ============================================================
// Message
// ============================================================
// ============================================================
// Public Function
// ============================================================
/// <summary>
/// 更新
/// </summary>
/// <param name="controlObject">控制对象</param>
/// <param name="controlField">控制字段</param>
public override void Update(ControlObjectModel controlObject, ControlFieldNodeModel controlField)
{
base.Update(controlObject, controlField);
this.IsSendToPreview = false;
string[] pars = controlField?.FieldDetail?.Split(new char[] { ':' }, StringSplitOptions.None);
string choices = string.Empty;
if (pars.Length >= 8)
{
choices = pars[7];
}
choices = choices.Replace("choices=", string.Empty);
this.ItemsSource = choices.Split('|').ToList();
int.TryParse(controlField?.Value, out int value);
this.EditValue = value;
this.IsSendToPreview = true;
}
/// <summary>
/// 更新动态数据
/// </summary>
/// <param name="listCellEdit">列单元格编辑器</param>
/// <param name="columnDefinition">列定义</param>
/// <param name="rowHandle">行号</param>
/// <param name="row">行数据</param>
public override void UpdateDynamic(ListCellEditBase listCellEdit, GridColumnControlFieldDefinition columnDefinition, int rowHandle, ExpandoObject row)
{
base.UpdateDynamic(listCellEdit, columnDefinition, rowHandle, row);
IDictionary<string, object> dic = row as IDictionary<string, object>;
this.IsSendToPreview = false;
string[] pars = columnDefinition?.ControlField?.FieldDetail?.Split(new char[] { ':' }, StringSplitOptions.None);
string choices = string.Empty;
if (pars.Length >= 8)
{
choices = pars[7];
}
choices = choices.Replace("choices=", string.Empty);
this.ItemsSource = choices.Split('|').ToList();
string str = dic?[columnDefinition.FieldName]?.ToString().Trim();
int.TryParse(str, out int value);
this.EditValue = value;
this.IsSendToPreview = true;
}
/// <summary>
/// 获取字段值
/// </summary>
/// <returns>字段值</returns>
public override string GetFieldValue()
{
return this.EditValue.ToString();
}
// ============================================================
// Private Function
// ============================================================
/// <summary>
/// 值改变时触发
/// </summary>
private void OnEditValueChanged()
{
// 不需要向预览发送值
if (!this.IsSendToPreview)
return;
// 没有预览连接
if (ApplicationDomainEx.PreviewConn == null)
return;
// 没有控制对象或控制字段
if (this.ControlObject == null || this.ControlField == null)
return;
// 正常模式编辑
if (this.FieldEditMode == FieldEditMode.Normal)
{
this.ControlField.Value = this.EditValue.ToString();
if (!this.ControlField.IsCustom)
{
this.VizCommandControlObjectService.SetControlObjectValue(
ApplicationDomainEx.PreviewConn,
this.ControlObject.TreeNodePath,
this.ControlField.FieldIdentifier,
this.ControlField.Value);
}
else
{
this.VizCommandControlObjectService.SetCustomControlFieldValue(ApplicationDomainEx.PreviewConn, new List<ControlFieldNodeModel> { this.ControlField });
}
return;
}
// 没有列信息或行数据
if (this.ColumnDefinition == null || this.Row == null)
return;
// 动态模式编辑
if (this.FieldEditMode == FieldEditMode.Dynamic)
{
IDictionary<string, object> dic = this.Row as IDictionary<string, object>;
dic[this.ColumnDefinition.FieldName] = this.EditValue.ToString();
this.ListCellEdit.UpdateEditValue(this.ColumnDefinition, this.RowHandle, this.Row);
return;
}
}
}
}
...@@ -111,6 +111,14 @@ namespace VIZ.Package.Module ...@@ -111,6 +111,14 @@ namespace VIZ.Package.Module
ViewCreated = this.OnViewCreated ViewCreated = this.OnViewCreated
}); });
// 单选
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.radio.ToString(),
ViewType = typeof(RadioEditPanel),
ViewCreated = this.OnViewCreated
});
// 自定义视频 // 自定义视频
this.NavigationConfigs.Add(new NavigationConfig this.NavigationConfigs.Add(new NavigationConfig
{ {
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources> <UserControl.Resources>
<fcore:Bool2VisibilityConverter x:Key="Bool2VisibilityConverter"></fcore:Bool2VisibilityConverter> <fcore:Bool2VisibilityConverter x:Key="Bool2VisibilityConverter"></fcore:Bool2VisibilityConverter>
<resource:VizControlFieldTypeStringConverter x:Key="VizControlFieldTypeStringConverter"></resource:VizControlFieldTypeStringConverter>
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
...@@ -33,7 +34,15 @@ ...@@ -33,7 +34,15 @@
</DataTemplate> </DataTemplate>
</dxg:GridColumn.CellTemplate> </dxg:GridColumn.CellTemplate>
</dxg:GridColumn> </dxg:GridColumn>
<dxg:GridColumn Header="类型" FieldName="Type" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="100" AllowResizing="True"></dxg:GridColumn> <dxg:GridColumn Header="类型" FieldName="Type" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="100" AllowResizing="True">
<dxg:GridColumn.CellTemplate>
<DataTemplate>
<Border Background="Transparent">
<TextBlock Text="{Binding Path=Row.Type,Converter={StaticResource VizControlFieldTypeStringConverter}}" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" Margin="4,0,4,0" VerticalAlignment="Center"></TextBlock>
</Border>
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
<dxg:GridColumn Header="描述" FieldName="Description" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="*" AllowResizing="True"></dxg:GridColumn> <dxg:GridColumn Header="描述" FieldName="Description" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="*" AllowResizing="True"></dxg:GridColumn>
<dxg:GridColumn Header="值" FieldName="Value" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="*" AllowResizing="True"> <dxg:GridColumn Header="值" FieldName="Value" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="*" AllowResizing="True">
<dxg:GridColumn.CellTemplate> <dxg:GridColumn.CellTemplate>
......
...@@ -93,6 +93,10 @@ ...@@ -93,6 +93,10 @@
<Reference Include="WindowsFormsIntegration" /> <Reference Include="WindowsFormsIntegration" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ControlObject\FieldEdit\Edit\RadioEdit\RadioEditPanel.xaml.cs">
<DependentUpon>RadioEditPanel.xaml</DependentUpon>
</Compile>
<Compile Include="ControlObject\FieldEdit\Edit\RadioEdit\RadioEditPanelModel.cs" />
<Compile Include="ControlObject\FieldEdit\Edit\CustomVideoEdit\CustomVideoEditPanel.xaml.cs"> <Compile Include="ControlObject\FieldEdit\Edit\CustomVideoEdit\CustomVideoEditPanel.xaml.cs">
<DependentUpon>CustomVideoEditPanel.xaml</DependentUpon> <DependentUpon>CustomVideoEditPanel.xaml</DependentUpon>
</Compile> </Compile>
...@@ -414,6 +418,10 @@ ...@@ -414,6 +418,10 @@
<Folder Include="ProjectManager\Model\" /> <Folder Include="ProjectManager\Model\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Page Include="ControlObject\FieldEdit\Edit\RadioEdit\RadioEditPanel.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="ControlObject\FieldEdit\Edit\CustomVideoEdit\CustomVideoEditPanel.xaml"> <Page Include="ControlObject\FieldEdit\Edit\CustomVideoEdit\CustomVideoEditPanel.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
......
...@@ -43,6 +43,7 @@ namespace VIZ.Package.Service ...@@ -43,6 +43,7 @@ namespace VIZ.Package.Service
entity.FieldIdentifier = field.FieldIdentifier; entity.FieldIdentifier = field.FieldIdentifier;
entity.Value = field.Value; entity.Value = field.Value;
entity.Type = field.Type; entity.Type = field.Type;
entity.FieldDetail = field.FieldDetail;
entity.IsCustom = field.IsCustom; entity.IsCustom = field.IsCustom;
list.Add(entity); list.Add(entity);
......
...@@ -536,6 +536,9 @@ namespace VIZ.Package.Service ...@@ -536,6 +536,9 @@ namespace VIZ.Package.Service
if (type == "font") if (type == "font")
return VizControlFieldType.font; return VizControlFieldType.font;
if (type == "radio")
return VizControlFieldType.radio;
if (type.StartsWith("<?xml")) if (type.StartsWith("<?xml"))
return VizControlFieldType.list; return VizControlFieldType.list;
...@@ -570,6 +573,7 @@ namespace VIZ.Package.Service ...@@ -570,6 +573,7 @@ namespace VIZ.Package.Service
ControlFieldNodeModel node = new ControlFieldNodeModel(); ControlFieldNodeModel node = new ControlFieldNodeModel();
node.FieldDetail = fieldDetail;
node.FieldIdentifier = pars[0]; node.FieldIdentifier = pars[0];
node.Num = num; node.Num = num;
node.TypeSchema = pars[2]; node.TypeSchema = pars[2];
......
...@@ -44,6 +44,19 @@ namespace VIZ.Package.Service ...@@ -44,6 +44,19 @@ namespace VIZ.Package.Service
} }
/// <summary> /// <summary>
/// 获取场景图片
/// </summary>
/// <param name="conn">连接</param>
/// <param name="scenePath">场景路径</param>
public System.Drawing.Bitmap GetSceneImage(ConnModel conn, string scenePath)
{
if (conn == null)
throw new ArgumentNullException(nameof(conn));
return conn.EndpointManager.RequestImage($"peak_get_icon SCENE*{scenePath}");
}
/// <summary>
/// 播放 /// 播放
/// </summary> /// </summary>
/// <param name="conn">连接</param> /// <param name="conn">连接</param>
......
...@@ -39,6 +39,11 @@ namespace VIZ.Package.Storage ...@@ -39,6 +39,11 @@ namespace VIZ.Package.Storage
public VizControlFieldType Type { get; set; } public VizControlFieldType Type { get; set; }
/// <summary> /// <summary>
/// 字段定义
/// </summary>
public string FieldDetail { get; set; }
/// <summary>
/// 是否是自定义字段 /// 是否是自定义字段
/// </summary> /// </summary>
public bool IsCustom { get; set; } public bool IsCustom { get; set; }
......
...@@ -34,6 +34,11 @@ namespace VIZ.Package.Storage ...@@ -34,6 +34,11 @@ namespace VIZ.Package.Storage
public string ThumbnailUri { get; set; } public string ThumbnailUri { get; set; }
/// <summary> /// <summary>
/// 缩略图数据
/// </summary>
public byte[] ThumbnailBuffer { get; set; }
/// <summary>
/// 备注 /// 备注
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
......
...@@ -79,6 +79,18 @@ namespace VIZ.Package.Storage ...@@ -79,6 +79,18 @@ namespace VIZ.Package.Storage
font, font,
/// <summary> /// <summary>
/// 单选
/// </summary>
[Description("单选")]
radio,
/// <summary>
/// 底飞
/// </summary>
[Description("底飞")]
scroll_elements,
/// <summary>
/// 自定义 视频 /// 自定义 视频
/// </summary> /// </summary>
[Description("自定义 视频")] [Description("自定义 视频")]
......
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