Commit b5b386d5 by liulongfei

编辑面板

parent d8aa0168
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Domain
{
/// <summary>
/// 控制字段改变消息
/// </summary>
public class ControlFieldChangedMessage
{
/// <summary>
/// 控制对象
/// </summary>
public ControlObjectModel ControlObject { get; set; }
/// <summary>
/// 控制字段
/// </summary>
public ControlFieldNodeModel ControlField { get; set; }
}
}
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
<Compile Include="Enum\ModulePluginIds.cs" /> <Compile Include="Enum\ModulePluginIds.cs" />
<Compile Include="Enum\ViewServiceKeys.cs" /> <Compile Include="Enum\ViewServiceKeys.cs" />
<Compile Include="Info\VizTreeNodeInfo.cs" /> <Compile Include="Info\VizTreeNodeInfo.cs" />
<Compile Include="Message\ControlObject\ControlFieldChangedMessage.cs" />
<Compile Include="Message\Page\PageOpenMessage.cs" /> <Compile Include="Message\Page\PageOpenMessage.cs" />
<Compile Include="Message\Page\PageInitedMessage.cs" /> <Compile Include="Message\Page\PageInitedMessage.cs" />
<Compile Include="Message\Project\ProjectSaveMessage.cs" /> <Compile Include="Message\Project\ProjectSaveMessage.cs" />
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using VIZ.Framework.Core;
using VIZ.Package.Domain;
using VIZ.Package.Service;
namespace VIZ.Package.Module
{
/// <summary>
/// 编辑面板模型基类
/// </summary>
public abstract class EditPanelModelBase : ViewModelBase
{
// ============================================================
// Service & Controller
// ============================================================
/// <summary>
/// Viz 控制对象服务
/// </summary>
protected VizCommandControlObjectService VizCommandControlObjectService = new VizCommandControlObjectService();
// ============================================================
// Property
// ============================================================
#region IsSendToPreview -- 是否向预览发送命令
private bool isSendToPreview;
/// <summary>
/// 是否向预览发送命令
/// </summary>
public bool IsSendToPreview
{
get { return isSendToPreview; }
set { isSendToPreview = value; this.RaisePropertyChanged(nameof(IsSendToPreview)); }
}
#endregion
#region ControlObject -- 控制对象
private ControlObjectModel controlObject;
/// <summary>
/// 控制对象
/// </summary>
public ControlObjectModel ControlObject
{
get { return controlObject; }
set { controlObject = value; this.RaisePropertyChanged(nameof(ControlObject)); }
}
#endregion
#region ControlField -- 所属控制字段
private ControlFieldNodeModel controlField;
/// <summary>
/// 所属控制字段
/// </summary>
public ControlFieldNodeModel ControlField
{
get { return controlField; }
set { controlField = value; this.RaisePropertyChanged(nameof(ControlField)); }
}
#endregion
/// <summary>
/// 更新
/// </summary>
/// <param name="controlObject">控制对象</param>
/// <param name="controlField">控制字段</param>
public virtual void Update(ControlObjectModel controlObject, ControlFieldNodeModel controlField)
{
this.ControlObject = controlObject;
this.ControlField = controlField;
this.IsSendToPreview = true;
}
}
}
<UserControl x:Class="VIZ.Package.Module.ImageEditPanel"
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:Background="White"
d:DataContext="{d:DesignInstance Type=local:ImageEditPanelModel}"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="120"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="值:" Margin="0,0,10,0" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
<dxe:TextEdit Grid.Column="1" Height="30" EditValue="{Binding Path=Path}" IsReadOnly="True"></dxe:TextEdit>
<Button Grid.Column="2" Width="80" Height="30" Content="本地文件" Command="{Binding OpenLocalFileCommand}"></Button>
</Grid>
<dx:DXTabControl Grid.Row="1">
<dx:DXTabItem Header="GH库" >
<!-- GH资源面板 -->
<local:GHResourcePanel x:Name="ghResourcePanel">
<local:GHResourcePanel.FolderContextMenu>
<ContextMenu>
<MenuItem Header="刷新" Command="{Binding Path=PlacementTarget.DataContext.RefreshFolderCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
</ContextMenu>
</local:GHResourcePanel.FolderContextMenu>
<local:GHResourcePanel.FileContextMenu>
<ContextMenu>
<MenuItem Header="刷新" Command="{Binding Path=PlacementTarget.DataContext.RefreshFileCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
</ContextMenu>
</local:GHResourcePanel.FileContextMenu>
</local:GHResourcePanel>
</dx:DXTabItem>
<dx:DXTabItem Header="媒资库">
</dx:DXTabItem>
</dx:DXTabControl>
</Grid>
</UserControl>
\ No newline at end of file
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>
/// ImageEditPanel.xaml 的交互逻辑
/// </summary>
public partial class ImageEditPanel : UserControl
{
public ImageEditPanel()
{
InitializeComponent();
ImageEditPanelModel vm = new ImageEditPanelModel();
WPFHelper.BindingViewModel(this.ghResourcePanel, vm.GHResourceEditPartModel);
WPFHelper.BindingViewModel(this, vm);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.Package.Domain;
using VIZ.Package.Storage;
namespace VIZ.Package.Module
{
/// <summary>
/// 图片编辑面板模型
/// </summary>
public class ImageEditPanelModel : ResourceEditPanelModelBase
{
public ImageEditPanelModel()
{
this.GHResourceEditPartModel.FilterResourceFileType = ResourceFileType.IMAGE;
this.GHResourceEditPartModel.OnSelectedFileModelChanged += GHResourceEditPartModel_OnSelectedFileModelChanged;
// 初始化命令
this.InitCommand();
}
/// <summary>
/// 初始化命令
/// </summary>
private void InitCommand()
{
this.OpenLocalFileCommand = new VCommand(this.OpenLocalFile);
}
// =====================================================================
// Field
// =====================================================================
/// <summary>
/// Viz资源图片筛选器
/// </summary>
private string VIZ_IMAGE_FILTER = ApplicationDomainEx.IniStorage.GetValue<VizConfig, string>(p => p.VIZ_IMAGE_FILTER);
// =====================================================================
// Property
// =====================================================================
#region Path -- 路径
private string path;
/// <summary>
/// 路径
/// </summary>
public string Path
{
get { return path; }
set
{
path = value;
this.RaisePropertyChanged(nameof(Path));
this.OnPathChanged();
}
}
#endregion
// =====================================================================
// Command
// =====================================================================
#region OpenLocalFileCommand -- 打开本地文件命令
/// <summary>
/// 打开本地文件命令
/// </summary>
public VCommand OpenLocalFileCommand { get; set; }
/// <summary>
/// 打开本地文件
/// </summary>
private void OpenLocalFile()
{
System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
ofd.Filter = VIZ_IMAGE_FILTER;
ofd.Multiselect = false;
if (ofd.ShowDialog() != System.Windows.Forms.DialogResult.OK)
return;
this.IsSendToPreview = false;
this.GHResourceEditPartModel.SelectedFileModel = null;
this.IsSendToPreview = true;
this.Path = ofd.FileName;
}
#endregion
// =====================================================================
// 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.Path = controlField?.Value;
}
// =====================================================================
// Private Function
// =====================================================================
/// <summary>
/// 路径切换时触发
/// </summary>
private void OnPathChanged()
{
// 不需要向预览发送值
if (!this.IsSendToPreview)
return;
// 没有预览连接
if (ApplicationDomainEx.PreviewConn == null)
return;
// 没有控制对象或控制字段
if (this.ControlObject == null || this.ControlField == null)
return;
this.ControlField.Value = this.Path;
this.VizCommandControlObjectService.SetControlObjectValue(
ApplicationDomainEx.PreviewConn,
this.ControlObject.TreeNodePath,
this.ControlField.FieldIdentifier,
this.ControlField.Value);
}
/// <summary>
/// GH库文件选择改变时触发
/// </summary>
private void GHResourceEditPartModel_OnSelectedFileModelChanged(object sender, GHResourceSelectedFileChangedEventArgs e)
{
if (e.File == null || string.IsNullOrWhiteSpace(e.File.ResourcePath))
return;
this.Path = e.File?.ResourcePath;
}
}
}
<UserControl x:Class="VIZ.Package.Module.ListEditPanel"
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:Background="White"
d:DataContext="{d:DesignInstance Type=local:ListEditPanelModel}"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary>
<!-- 行号转化器 -->
<resource:RowHandleConverter x:Key="RowHandleConverter"></resource:RowHandleConverter>
<!-- 列定义模板 -->
<DataTemplate x:Key="ColumnTemplate">
<ContentControl>
<dxg:GridColumn FieldName="{Binding FieldName}" Width="{Binding Width}"
MinWidth="{Binding MinWidth}"
Header="{Binding Header}" ReadOnly="{Binding ReadOnly}"
AllowEditing="True" AllowSorting="False" AllowColumnFiltering="False"
/>
</ContentControl>
</DataTemplate>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<dxg:GridControl ItemsSource="{Binding Path=ItemsSource}" ShowBorder="False" Grid.Column="1" AllowDrop="True"
ColumnsSource="{Binding Path=Columns}"
ColumnGeneratorTemplate="{StaticResource ColumnTemplate}">
<dxg:GridControl.ContextMenu>
<ContextMenu>
<MenuItem Header="刷新" Command="{Binding Path=PlacementTarget.DataContext.RefreshControlObjectFieldListCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
</ContextMenu>
</dxg:GridControl.ContextMenu>
<dxg:GridControl.View>
<dxg:TableView AllowEditing="True" ShowIndicator="True"
NavigationStyle="Cell" EditorShowMode="MouseDown"
ShowGroupPanel="False"
AllowDrop="True"
ShowBandsPanel="False"
ShowTotalSummary="False"
ShowFixedTotalSummary="False"
ShowDragDropHint="False"
ShowTargetInfoInDragDropHint="false">
</dxg:TableView>
</dxg:GridControl.View>
</dxg:GridControl>
</Grid>
</UserControl>
\ No newline at end of file
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;
namespace VIZ.Package.Module
{
/// <summary>
/// ListEditPanel.xaml 的交互逻辑
/// </summary>
public partial class ListEditPanel : UserControl
{
public ListEditPanel()
{
InitializeComponent();
}
}
}
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.Storage;
namespace VIZ.Package.Module
{
/// <summary>
/// 列编辑面板单元格模板选择器
/// </summary>
public class ListEditPanelCellTemplateSelector : DataTemplateSelector
{
/// <summary>
/// 文本模板
/// </summary>
public DataTemplate TextDataTemplate { get; set; }
/// <summary>
/// 图片模板
/// </summary>
public DataTemplate ImageDataTemplate { get; set; }
/// <summary>
/// Bool类型的模板
/// </summary>
public DataTemplate BooleanDataTemplate { get; set; }
/// <summary>
/// 三元组
/// </summary>
public DataTemplate TripletDataTemplate { 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;
//ExpandoObject model = data.RowData.Row as ExpandoObject;
//if (model == null)
// return null;
//switch (model.Type)
//{
// case VizControlFieldType.none: return null;
// case VizControlFieldType.text: return this.TextDataTemplate;
// case VizControlFieldType.boolean: return this.BooleanDataTemplate;
// case VizControlFieldType.richtext: return this.TextDataTemplate;
// case VizControlFieldType.image: return this.ImageDataTemplate;
// case VizControlFieldType.list: return this.TextDataTemplate;
// case VizControlFieldType.triplet: return this.TripletDataTemplate;
// default: return null;
//}
}
}
}
\ No newline at end of file
using DevExpress.Xpf.Grid;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using VIZ.Framework.Core;
namespace VIZ.Package.Module
{
/// <summary>
/// 列表编辑面板列定义
/// </summary>
public class ListEditPanelColumnDefinition
{
/// <summary>
/// 绑定字段
/// </summary>
public string FieldName { get; set; }
/// <summary>
/// 宽度
/// </summary>
public GridColumnWidth Width { get; set; } = new GridColumnWidth(1, GridColumnUnitType.Star);
/// <summary>
/// 最小宽度
/// </summary>
public double MinWidth { get; set; } = 120;
/// <summary>
/// 头部
/// </summary>
public object Header { get; set; }
/// <summary>
/// 是否只读
/// </summary>
public bool ReadOnly { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Module
{
/// <summary>
/// 列表编辑面板模型
/// </summary>
public class ListEditPanelModel : EditPanelModelBase
{
// ===================================================================
// Property
// ===================================================================
#region ItemsSource -- 数据源
private List<ExpandoObject> itemsSource;
/// <summary>
/// 数据源
/// </summary>
public List<ExpandoObject> ItemsSource
{
get { return itemsSource; }
set { itemsSource = value; this.RaisePropertyChanged(nameof(ItemsSource)); }
}
#endregion
#region Columns -- 列信息
private List<ListEditPanelColumnDefinition> columns;
/// <summary>
/// 列信息
/// </summary>
public List<ListEditPanelColumnDefinition> Columns
{
get { return columns; }
set { columns = value; this.RaisePropertyChanged(nameof(Columns)); }
}
#endregion
}
}
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>
/// GH资源编辑部分模型
/// </summary>
public class GHResourceEditPartModel : GHResourcePanelModel
{
#region OwnerViewModel -- 所属视图模型
private ResourceEditPanelModelBase ownerViewModel;
/// <summary>
/// 所属视图模型
/// </summary>
public ResourceEditPanelModelBase OwnerViewModel
{
get { return ownerViewModel; }
set { ownerViewModel = value; this.RaisePropertyChanged(nameof(OwnerViewModel)); }
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Module
{
/// <summary>
/// 资源编辑面板模型基类
/// </summary>
public abstract class ResourceEditPanelModelBase : EditPanelModelBase
{
public ResourceEditPanelModelBase()
{
// GH资源
this.GHResourceEditPartModel = new GHResourceEditPartModel();
this.GHResourceEditPartModel.OwnerViewModel = this;
// 媒资库
// 本地资源
}
#region GHResourceEditPartModel -- GH资源编辑部分模型
private GHResourceEditPartModel ghResourceEditPartModel;
/// <summary>
/// GH资源编辑部分模型
/// </summary>
public GHResourceEditPartModel GHResourceEditPartModel
{
get { return ghResourceEditPartModel; }
set { ghResourceEditPartModel = value; this.RaisePropertyChanged(nameof(GHResourceEditPartModel)); }
}
#endregion
}
}
<UserControl x:Class="VIZ.Package.Module.TextEditPanel"
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:TextEditPanelModel}"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<dxe:TextEdit AcceptsReturn="True"
VerticalContentAlignment="Top"
EditValue="{Binding Path=Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></dxe:TextEdit>
</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>
/// TextEditPanel.xaml 的交互逻辑
/// </summary>
public partial class TextEditPanel : UserControl
{
public TextEditPanel()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new TextEditPanelModel());
}
}
}
using System;
using System.Collections.Generic;
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>
/// 文本编辑面板模型
/// </summary>
public class TextEditPanelModel : EditPanelModelBase
{
// ============================================================
// Property
// ============================================================
#region Text -- 文本
private string text;
/// <summary>
/// 文本
/// </summary>
public string Text
{
get { return text; }
set
{
text = value;
this.RaisePropertyChanged(nameof(Text));
this.OnTextChanged();
}
}
#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;
this.Text = controlField?.Value;
this.IsSendToPreview = true;
}
// ============================================================
// Private Function
// ============================================================
/// <summary>
/// 文本值改变时触发
/// </summary>
private void OnTextChanged()
{
// 不需要向预览发送值
if (!this.IsSendToPreview)
return;
// 没有预览连接
if (ApplicationDomainEx.PreviewConn == null)
return;
// 没有控制对象或控制字段
if (this.ControlObject == null || this.ControlField == null)
return;
this.ControlField.Value = this.Text;
this.VizCommandControlObjectService.SetControlObjectValue(
ApplicationDomainEx.PreviewConn,
this.ControlObject.TreeNodePath,
this.ControlField.FieldIdentifier,
this.ControlField.Value);
}
}
}
...@@ -3,11 +3,13 @@ ...@@ -3,11 +3,13 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:common="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common"
xmlns:local="clr-namespace:VIZ.Package.Module" xmlns:local="clr-namespace:VIZ.Package.Module"
d:DataContext="{d:DesignInstance Type=local:FieldEditViewModel}"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<TextBlock Text="字段编辑" VerticalAlignment="Center" HorizontalAlignment="Center" <common:NavigationControl ItemsSource="{Binding Path=NavigationConfigs}"
FontSize="36" Foreground="Red"></TextBlock> SelectedValue="{Binding Path=SelectedNavigationConfig,Mode=OneWay}"></common:NavigationControl>
</Grid>
</UserControl> </UserControl>
...@@ -12,6 +12,7 @@ using System.Windows.Media; ...@@ -12,6 +12,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using VIZ.Framework.Core;
namespace VIZ.Package.Module namespace VIZ.Package.Module
{ {
...@@ -23,6 +24,8 @@ namespace VIZ.Package.Module ...@@ -23,6 +24,8 @@ namespace VIZ.Package.Module
public FieldEditView() public FieldEditView()
{ {
InitializeComponent(); InitializeComponent();
WPFHelper.BindingViewModel(this, new FieldEditViewModel());
} }
} }
} }
...@@ -3,7 +3,11 @@ using System.Collections.Generic; ...@@ -3,7 +3,11 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows;
using VIZ.Framework.Common;
using VIZ.Framework.Core; using VIZ.Framework.Core;
using VIZ.Package.Domain;
using VIZ.Package.Storage;
namespace VIZ.Package.Module namespace VIZ.Package.Module
{ {
...@@ -12,6 +16,161 @@ namespace VIZ.Package.Module ...@@ -12,6 +16,161 @@ namespace VIZ.Package.Module
/// </summary> /// </summary>
public class FieldEditViewModel : ViewModelBase public class FieldEditViewModel : ViewModelBase
{ {
public FieldEditViewModel()
{
// 初始化导航配置
this.InitNavigationConfigs();
// 初始化消息
this.InitMessage();
}
/// <summary>
/// 初始化消息
/// </summary>
private void InitMessage()
{
ApplicationDomainEx.MessageManager.Register<ControlFieldChangedMessage>(this, this.OnControlFieldChangedMessage);
}
/// <summary>
/// 初始化导航配置
/// </summary>
private void InitNavigationConfigs()
{
// 文本编辑器
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.text.ToString(),
ViewType = typeof(TextEditPanel),
ViewCreated = this.OnViewCreated
});
// 图片选择
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.image.ToString(),
ViewType = typeof(ImageEditPanel),
ViewCreated = this.OnViewCreated
});
}
// =============================================================
// Property
// =============================================================
#region NavigationConfigs -- 导航配置
private List<NavigationConfig> navigationConfigs = new List<NavigationConfig>();
/// <summary>
/// 导航配置
/// </summary>
public List<NavigationConfig> NavigationConfigs
{
get { return navigationConfigs; }
set { navigationConfigs = value; this.RaisePropertyChanged(nameof(NavigationConfigs)); }
}
#endregion
#region SelectedNavigationConfig -- 当前选中的导航配置
private NavigationConfig selectedNavigationConfig;
/// <summary>
/// 当前选中的导航配置
/// </summary>
public NavigationConfig SelectedNavigationConfig
{
get { return selectedNavigationConfig; }
set { selectedNavigationConfig = value; this.RaisePropertyChanged(nameof(SelectedNavigationConfig)); }
}
#endregion
#region ControlObject -- 控制对象
private ControlObjectModel controlObject;
/// <summary>
/// 控制对象
/// </summary>
public ControlObjectModel ControlObject
{
get { return controlObject; }
set { controlObject = value; this.RaisePropertyChanged(nameof(ControlObject)); }
}
#endregion
#region ControlField -- 控制字段
private ControlFieldNodeModel controlField;
/// <summary>
/// 控制字段
/// </summary>
public ControlFieldNodeModel ControlField
{
get { return controlField; }
set { controlField = value; this.RaisePropertyChanged(nameof(ControlField)); }
}
#endregion
// =============================================================
// Message
// =============================================================
/// <summary>
/// 控制字段切换消息
/// </summary>
/// <param name="msg">消息</param>
private void OnControlFieldChangedMessage(ControlFieldChangedMessage msg)
{
this.ControlObject = msg.ControlObject;
this.ControlField = msg.ControlField;
if (msg.ControlObject == null || msg.ControlField == null)
{
this.SelectedNavigationConfig = null;
return;
}
NavigationConfig config = this.NavigationConfigs.FirstOrDefault(p => p.Key == msg.ControlField.Type.ToString());
if (config != null && config.View != null && config.View.TryGetTarget(out object target))
{
FrameworkElement view = target as FrameworkElement;
if (view != null)
{
EditPanelModelBase model = view.DataContext as EditPanelModelBase;
model?.Update(this.ControlObject, this.ControlField);
}
}
this.SelectedNavigationConfig = config;
}
// =============================================================
// Private Function
// =============================================================
/// <summary>
/// 视图创建后触发
/// </summary>
/// <param name="config">导航配置</param>
/// <param name="obj">视图</param>
private void OnViewCreated(NavigationConfig config, object obj)
{
FrameworkElement view = obj as FrameworkElement;
if (view == null)
return;
EditPanelModelBase model = view.DataContext as EditPanelModelBase;
if (model == null)
return;
model.Update(this.ControlObject, this.ControlField);
}
} }
} }
...@@ -3,11 +3,41 @@ ...@@ -3,11 +3,41 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 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" xmlns:local="clr-namespace:VIZ.Package.Module"
xmlns:domain="clr-namespace:VIZ.Package.Domain;assembly=VIZ.Package.Domain"
d:DataContext="{d:DesignInstance Type=local:FieldTreeViewModel}"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<Grid> <Grid>
<TextBlock Text="字段树" VerticalAlignment="Center" HorizontalAlignment="Center" <dxg:GridControl ItemsSource="{Binding Path=ControlObject.FieldNodes}" ShowBorder="False"
FontSize="36" Foreground="Red"></TextBlock> SelectedItem="{Binding Path=SelectedControlField,Mode=TwoWay}">
<dxg:GridControl.Columns>
<dxg:GridColumn Header="字段" FieldName="FieldIdentifier" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="150" AllowResizing="True"></dxg:GridColumn>
<dxg:GridColumn Header="类型" FieldName="Type" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="100" 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>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TreeListView AllowEditing="False" ShowIndicator="True"
NavigationStyle="Row"
ShowBandsPanel="False"
ShowTotalSummary="False"
ShowFixedTotalSummary="False"
ShowDragDropHint="False"
ShowTargetInfoInDragDropHint="false">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="NodeExpanding" Command="{Binding Path=ExpandingCommand}" PassEventArgsToCommand="True"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
</dxg:TreeListView>
</dxg:GridControl.View>
</dxg:GridControl>
</Grid> </Grid>
</UserControl> </UserControl>
using System; using DevExpress.Xpf.Grid.TreeList;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
...@@ -16,11 +17,22 @@ namespace VIZ.Package.Module ...@@ -16,11 +17,22 @@ namespace VIZ.Package.Module
{ {
public FieldTreeViewModel() public FieldTreeViewModel()
{ {
// 初始化命令
this.InitCommand();
// 初始化消息 // 初始化消息
this.InitMessage(); this.InitMessage();
} }
/// <summary> /// <summary>
/// 初始化命令
/// </summary>
private void InitCommand()
{
this.ExpandingCommand = new VCommand<TreeListNodeAllowEventArgs>(this.Expanding);
}
/// <summary>
/// 初始化消息 /// 初始化消息
/// </summary> /// </summary>
private void InitMessage() private void InitMessage()
...@@ -41,10 +53,81 @@ namespace VIZ.Package.Module ...@@ -41,10 +53,81 @@ namespace VIZ.Package.Module
// Property // Property
// ============================================================= // =============================================================
#region IsLoading -- 是否正在加载
private bool isLoading;
/// <summary>
/// 是否正在加载
/// </summary>
public bool IsLoading
{
get { return isLoading; }
set { isLoading = value; this.RaisePropertyChanged(nameof(IsLoading)); }
}
#endregion
#region ControlObject -- 控制对象
private ControlObjectModel controlObject;
/// <summary>
/// 控制对象
/// </summary>
public ControlObjectModel ControlObject
{
get { return controlObject; }
set { controlObject = value; this.RaisePropertyChanged(nameof(ControlObject)); }
}
#endregion
#region SelectedControlField -- 当前选中的控制字段
private ControlFieldNodeModel selectedControlField;
/// <summary>
/// 当前选中的控制字段
/// </summary>
public ControlFieldNodeModel SelectedControlField
{
get { return selectedControlField; }
set
{
selectedControlField = value;
this.RaisePropertyChanged(nameof(SelectedControlField));
// 发送切换消息
ControlFieldChangedMessage msg = new ControlFieldChangedMessage();
msg.ControlObject = this.ControlObject;
msg.ControlField = value;
ApplicationDomainEx.MessageManager.Send(msg);
}
}
#endregion
// ============================================================= // =============================================================
// Command // Command
// ============================================================= // =============================================================
#region ExpandingCommand -- 展开前命令
/// <summary>
/// 展开节点命令
/// </summary>
public VCommand<TreeListNodeAllowEventArgs> ExpandingCommand { get; set; }
/// <summary>
/// 展开节点
/// </summary>
/// <param name="e"></param>
private void Expanding(TreeListNodeAllowEventArgs e)
{
}
#endregion
// ============================================================= // =============================================================
// Message // Message
// ============================================================= // =============================================================
...@@ -55,7 +138,23 @@ namespace VIZ.Package.Module ...@@ -55,7 +138,23 @@ namespace VIZ.Package.Module
/// <param name="msg">消息</param> /// <param name="msg">消息</param>
private void OnPageInitedMessage(PageInitedMessage msg) private void OnPageInitedMessage(PageInitedMessage msg)
{ {
var test = this.vizCommandControlObjectService.GetControlObject(ApplicationDomainEx.PreviewConn); this.IsLoading = true;
ThreadHelper.SafeRun(action: () =>
{
ControlObjectModel controlObject = this.vizCommandControlObjectService.GetControlObject(ApplicationDomainEx.PreviewConn);
WPFHelper.BeginInvoke(() =>
{
this.ControlObject = controlObject;
});
}, final: () =>
{
WPFHelper.BeginInvoke(() =>
{
this.IsLoading = false;
});
});
} }
} }
} }
\ No newline at end of file
...@@ -254,6 +254,9 @@ namespace VIZ.Package.Module ...@@ -254,6 +254,9 @@ namespace VIZ.Package.Module
if (this.SelectedPageModel == null) if (this.SelectedPageModel == null)
return; return;
if (ApplicationDomainEx.CurrentPage == this.SelectedPageModel)
return;
ApplicationDomainEx.CurrentPage = this.SelectedPageModel; ApplicationDomainEx.CurrentPage = this.SelectedPageModel;
PageOpenMessage msg = new PageOpenMessage(); PageOpenMessage msg = new PageOpenMessage();
......
...@@ -199,6 +199,9 @@ namespace VIZ.Package.Module ...@@ -199,6 +199,9 @@ namespace VIZ.Package.Module
if (this.SelectedSceneTemplateModel == null) if (this.SelectedSceneTemplateModel == null)
return; return;
if (ApplicationDomainEx.CurrentPage == this.SelectedSceneTemplateModel)
return;
ApplicationDomainEx.CurrentPage = this.SelectedSceneTemplateModel; ApplicationDomainEx.CurrentPage = this.SelectedSceneTemplateModel;
PageOpenMessage msg = new PageOpenMessage(); PageOpenMessage msg = new PageOpenMessage();
......
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>
/// GH资源选择文件改变事件参数
/// </summary>
public class GHResourceSelectedFileChangedEventArgs : EventArgs
{
/// <summary>
/// 文件
/// </summary>
public GHResourceFileModel File { get; set; }
}
}
...@@ -55,6 +55,16 @@ namespace VIZ.Package.Module ...@@ -55,6 +55,16 @@ namespace VIZ.Package.Module
this.ghResourceFileController = new GHResourceFileController(this); this.ghResourceFileController = new GHResourceFileController(this);
} }
// ==================================================================================
// Event
// ==================================================================================
/// <summary>
/// 选择文件改变时触发
/// </summary>
public event EventHandler<GHResourceSelectedFileChangedEventArgs> OnSelectedFileModelChanged;
// ================================================================================== // ==================================================================================
// Property // Property
// ================================================================================== // ==================================================================================
...@@ -116,7 +126,13 @@ namespace VIZ.Package.Module ...@@ -116,7 +126,13 @@ namespace VIZ.Package.Module
public GHResourceFileModel SelectedFileModel public GHResourceFileModel SelectedFileModel
{ {
get { return selectedFileModel; } get { return selectedFileModel; }
set { selectedFileModel = value; this.RaisePropertyChanged(nameof(SelectedFileModel)); } set
{
selectedFileModel = value;
this.RaisePropertyChanged(nameof(SelectedFileModel));
this.OnSelectedFileModelChanged?.Invoke(this, new GHResourceSelectedFileChangedEventArgs { File = value });
}
} }
#endregion #endregion
...@@ -289,14 +305,6 @@ namespace VIZ.Package.Module ...@@ -289,14 +305,6 @@ namespace VIZ.Package.Module
// ================================================================================== // ==================================================================================
/// <summary> /// <summary>
/// 当选择文件改变时触发
/// </summary>
public virtual void OnSelectedFileModelChanged()
{
}
/// <summary>
/// 文件过滤 /// 文件过滤
/// </summary> /// </summary>
/// <param name="type"></param> /// <param name="type"></param>
......
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:VIZ.Package.Module">
</ResourceDictionary>
...@@ -92,6 +92,14 @@ ...@@ -92,6 +92,14 @@
<Compile Include="ControlObject\Command\View\CommandView.xaml.cs"> <Compile Include="ControlObject\Command\View\CommandView.xaml.cs">
<DependentUpon>CommandView.xaml</DependentUpon> <DependentUpon>CommandView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="ControlObject\FieldEdit\Edit\EditPanelModelBase.cs" />
<Compile Include="ControlObject\FieldEdit\Edit\ImageEdit\ImageEditPanelModel.cs" />
<Compile Include="ControlObject\FieldEdit\Edit\ListEdit\ListEditPanelCellTemplateSelector.cs" />
<Compile Include="ControlObject\FieldEdit\Edit\ListEdit\ListEditPanelColumnDefinition.cs" />
<Compile Include="ControlObject\FieldEdit\Edit\ListEdit\ListEditPanelModel.cs" />
<Compile Include="ControlObject\FieldEdit\Edit\ResourceEdit\GHResourceEditPartModel.cs" />
<Compile Include="ControlObject\FieldEdit\Edit\ResourceEdit\ResourceEditPanelModelBase.cs" />
<Compile Include="ControlObject\FieldEdit\Edit\TextEdit\TextEditPanelModel.cs" />
<Compile Include="ControlObject\FieldEdit\FieldEditPluginLifeCycle.cs" /> <Compile Include="ControlObject\FieldEdit\FieldEditPluginLifeCycle.cs" />
<Compile Include="ControlObject\FieldEdit\ViewModel\FieldEditViewModel.cs" /> <Compile Include="ControlObject\FieldEdit\ViewModel\FieldEditViewModel.cs" />
<Compile Include="ControlObject\FieldTree\FieldTreePluginLifeCycle.cs" /> <Compile Include="ControlObject\FieldTree\FieldTreePluginLifeCycle.cs" />
...@@ -111,12 +119,19 @@ ...@@ -111,12 +119,19 @@
<Compile Include="ControlObject\FieldEdit\View\FieldEditView.xaml.cs"> <Compile Include="ControlObject\FieldEdit\View\FieldEditView.xaml.cs">
<DependentUpon>FieldEditView.xaml</DependentUpon> <DependentUpon>FieldEditView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="ControlObject\FieldEdit\Edit\ImageEdit\ImageEditPanel.xaml.cs">
<DependentUpon>ImageEditPanel.xaml</DependentUpon>
</Compile>
<Compile Include="ControlObject\FieldEdit\Edit\ListEdit\ListEditPanel.xaml.cs">
<DependentUpon>ListEditPanel.xaml</DependentUpon>
</Compile>
<Compile Include="Main\ViewModel\MainTopViewModel.cs" /> <Compile Include="Main\ViewModel\MainTopViewModel.cs" />
<Compile Include="Plugin\PluginPluginLifeCycle.cs" /> <Compile Include="Plugin\PluginPluginLifeCycle.cs" />
<Compile Include="Plugin\ViewModel\PluginViewModel.cs" /> <Compile Include="Plugin\ViewModel\PluginViewModel.cs" />
<Compile Include="Plugin\View\PluginView.xaml.cs"> <Compile Include="Plugin\View\PluginView.xaml.cs">
<DependentUpon>PluginView.xaml</DependentUpon> <DependentUpon>PluginView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Resource\GHResource\Core\GHResourceSelectedFileChangedEventArgs.cs" />
<Compile Include="Resource\MediaResource\MediaResourcePluginLifeCycle.cs" /> <Compile Include="Resource\MediaResource\MediaResourcePluginLifeCycle.cs" />
<Compile Include="Resource\MediaResource\ViewModel\MediaResourceViewModel.cs" /> <Compile Include="Resource\MediaResource\ViewModel\MediaResourceViewModel.cs" />
<Compile Include="Resource\MediaResource\View\MediaResourceView.xaml.cs"> <Compile Include="Resource\MediaResource\View\MediaResourceView.xaml.cs">
...@@ -191,6 +206,9 @@ ...@@ -191,6 +206,9 @@
<Compile Include="Preview\VizPreview\View\VizPreviewView.xaml.cs"> <Compile Include="Preview\VizPreview\View\VizPreviewView.xaml.cs">
<DependentUpon>VizPreviewView.xaml</DependentUpon> <DependentUpon>VizPreviewView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="ControlObject\FieldEdit\Edit\TextEdit\TextEditPanel.xaml.cs">
<DependentUpon>TextEditPanel.xaml</DependentUpon>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
...@@ -226,6 +244,14 @@ ...@@ -226,6 +244,14 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="ControlObject\FieldEdit\Edit\ImageEdit\ImageEditPanel.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ControlObject\FieldEdit\Edit\ListEdit\ListEditPanel.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Plugin\View\PluginView.xaml"> <Page Include="Plugin\View\PluginView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
...@@ -278,6 +304,14 @@ ...@@ -278,6 +304,14 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="ControlObject\FieldEdit\Edit\TextEdit\TextEditPanel.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Generic.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Common.Resource\VIZ.Framework.Common.Resource.csproj"> <ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Common.Resource\VIZ.Framework.Common.Resource.csproj">
......
...@@ -193,18 +193,19 @@ namespace VIZ.Package.Service ...@@ -193,18 +193,19 @@ namespace VIZ.Package.Service
continue; continue;
string[] pars = fieldDetail.Split(':'); string[] pars = fieldDetail.Split(':');
string num = pars[1].Split('*').FirstOrDefault();
if (!treeNodeDic.TryGetValue(pars[1], out VizTreeNodeInfo treeNodeInfo)) if (!treeNodeDic.TryGetValue(num, out VizTreeNodeInfo treeNodeInfo))
continue; continue;
ControlFieldNodeModel node = new ControlFieldNodeModel(); ControlFieldNodeModel node = new ControlFieldNodeModel();
node.FieldIdentifier = pars[0]; node.FieldIdentifier = pars[0];
node.Route = node.FieldIdentifier.Split('.').ToList();
node.TreeNodePath = treeNodeInfo.Path; node.TreeNodePath = treeNodeInfo.Path;
node.Route = node.TreeNodePath.Split('/').ToList();
node.TypeSchema = pars[2]; node.TypeSchema = pars[2];
node.Type = this.GetControlFieldType(node.TypeSchema); node.Type = this.GetControlFieldType(node.TypeSchema);
node.Value = this.GetControlFieldValue(conn, node.TreeNodePath, node.FieldIdentifier); node.Value = this.GetControlFieldValue(conn, obj.TreeNodePath, node.FieldIdentifier);
obj.AllFiledNodes.Add(node); obj.AllFiledNodes.Add(node);
} }
...@@ -292,13 +293,12 @@ namespace VIZ.Package.Service ...@@ -292,13 +293,12 @@ namespace VIZ.Package.Service
/// 设置控制对象值 /// 设置控制对象值
/// </summary> /// </summary>
/// <param name="connection">连接</param> /// <param name="connection">连接</param>
/// <param name="layer">场景图层</param>
/// <param name="treeNodePath">场景节点路径</param> /// <param name="treeNodePath">场景节点路径</param>
/// <param name="fieldIdentifier">字段</param> /// <param name="fieldIdentifier">字段</param>
/// <param name="value">值</param> /// <param name="value">值</param>
public void SetControlObjectValue(ConnModel connection, VizLayer layer, string treeNodePath, string fieldIdentifier, string value) public void SetControlObjectValue(ConnModel connection, string treeNodePath, string fieldIdentifier, string value)
{ {
connection.EndpointManager.Send($"{layer}*TREE*{treeNodePath}*FUNCTION*ControlObject*in SET ON {fieldIdentifier} SET {value}"); connection.EndpointManager.Send($"MAIN_SCENE*TREE*{treeNodePath}*FUNCTION*ControlObject*in SET ON {fieldIdentifier} SET {value}");
} }
/// <summary> /// <summary>
...@@ -323,14 +323,13 @@ namespace VIZ.Package.Service ...@@ -323,14 +323,13 @@ namespace VIZ.Package.Service
/// 设置列表控制对象的值 /// 设置列表控制对象的值
/// </summary> /// </summary>
/// <param name="connection">连接</param> /// <param name="connection">连接</param>
/// <param name="layer">场景图层</param>
/// <param name="listName">列表名称</param> /// <param name="listName">列表名称</param>
/// <param name="listLine">列表值位序</param> /// <param name="listLine">列表值位序</param>
/// <param name="fieldIdentifier">字段</param> /// <param name="fieldIdentifier">字段</param>
/// <param name="value">值</param> /// <param name="value">值</param>
public void SetxControlObjectListValue(ConnModel connection, VizLayer layer, string listName, int listLine, string fieldIdentifier, string value) public void SetxControlObjectListValue(ConnModel connection, string listName, int listLine, string fieldIdentifier, string value)
{ {
connection.EndpointManager.Send($"{layer}*TREE*$object*FUNCTION*ControlObject*in SET WITH {listName} INDEX {listLine} ON {fieldIdentifier} SET {value}"); connection.EndpointManager.Send($"MAIN_SCENE*TREE*$object*FUNCTION*ControlObject*in SET WITH {listName} INDEX {listLine} ON {fieldIdentifier} SET {value}");
} }
/// <summary> /// <summary>
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Storage;
namespace VIZ.Package.Storage
{
/// <summary>
/// Viz 配置
/// </summary>
public class VizConfig : IniConfigBase
{
/// <summary>
/// Viz资源图片筛选器
/// </summary>
[Ini(Section = "Viz", DefaultValue = "图片|*.jpg;*.jpeg;*.bmp;*.png;", Type = typeof(string))]
public string VIZ_IMAGE_FILTER { get; set; }
}
}
...@@ -82,6 +82,7 @@ ...@@ -82,6 +82,7 @@
<Compile Include="Enum\VizControlFieldType.cs" /> <Compile Include="Enum\VizControlFieldType.cs" />
<Compile Include="Enum\VizControlObjectParameters.cs" /> <Compile Include="Enum\VizControlObjectParameters.cs" />
<Compile Include="Enum\VizLayer.cs" /> <Compile Include="Enum\VizLayer.cs" />
<Compile Include="Ini\VizConfig.cs" />
<Compile Include="LocalDbContext.cs" /> <Compile Include="LocalDbContext.cs" />
<Compile Include="ProjectDbContext.cs" /> <Compile Include="ProjectDbContext.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
......
[Application] [Application]
APPLICATION_IS_DEBUG=true APPLICATION_IS_DEBUG=true
\ No newline at end of file [Viz]
VIZ_IMAGE_FILTER=ͼƬ|*.jpg;*.jpeg;*.bmp;*.png;
\ No newline at end of file
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