Commit 009945af by liulongfei

1. 上版子

2. 三元数据编辑
parent f5e73f3a
<ResourceDictionary
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:VIZ.TVP.Common">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.TVP.Common;component/Widgets/TripletEdit/TripletEdit.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
......@@ -76,6 +76,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Widgets\TripletEdit\TripletEdit.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
......@@ -93,6 +97,8 @@
</Compile>
<Compile Include="Widgets\DragBoder\ResourceDragBorder.cs" />
<Compile Include="Widgets\DropTextEdit\DropTextEdit.cs" />
<Compile Include="Widgets\TripletEdit\LeftRightTextEdit.cs" />
<Compile Include="Widgets\TripletEdit\TripletEdit.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
......
using DevExpress.Xpf.Editors;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
namespace VIZ.TVP.Common
{
/// <summary>
/// 左右鼠标拖拽文本编辑器
/// </summary>
public class LeftRightTextEdit : TextEdit
{
#region MouseMinMove -- 鼠标最小移动值
/// <summary>
/// 鼠标最小移动值
/// </summary>
public double MouseMinMove
{
get { return (double)GetValue(MouseMinMoveProperty); }
set { SetValue(MouseMinMoveProperty, value); }
}
/// <summary>
/// Using a DependencyProperty as the backing store for MouseMinMove. This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty MouseMinMoveProperty =
DependencyProperty.Register("MouseMinMove", typeof(double), typeof(LeftRightTextEdit), new PropertyMetadata(5d));
#endregion
#region ValueChangeStep -- 值改变步长
/// <summary>
/// 值改变步长
/// </summary>
public double ValueChangeStep
{
get { return (double)GetValue(ValueChangeStepProperty); }
set { SetValue(ValueChangeStepProperty, value); }
}
/// <summary>
/// Using a DependencyProperty as the backing store for ValueChangeStep. This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty ValueChangeStepProperty =
DependencyProperty.Register("ValueChangeStep", typeof(double), typeof(LeftRightTextEdit), new PropertyMetadata(0.1d));
#endregion
/// <summary>
/// 鼠标是否按下
/// </summary>
private bool isMouseDown;
/// <summary>
/// 鼠标最后的值
/// </summary>
private double mouseLastPositionX;
/// <summary>
/// 鼠标按下
/// </summary>
protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
{
base.OnPreviewMouseLeftButtonDown(e);
this.mouseLastPositionX = e.GetPosition(this).X;
this.isMouseDown = true;
}
/// <summary>
/// 鼠标弹起
/// </summary>
protected override void OnPreviewMouseLeftButtonUp(MouseButtonEventArgs e)
{
base.OnPreviewMouseLeftButtonUp(e);
this.isMouseDown = false;
}
/// <summary>
/// 鼠标移动
/// </summary>
protected override void OnPreviewMouseMove(MouseEventArgs e)
{
base.OnPreviewMouseMove(e);
if (!this.isMouseDown || e.LeftButton != MouseButtonState.Pressed)
return;
Point position = e.GetPosition(this);
double move = position.X - this.mouseLastPositionX;
if (Math.Abs(move) < this.MouseMinMove)
return;
double.TryParse(this.EditValue?.ToString(), out double current);
this.EditValue = current + (int)(move / this.MouseMinMove) * this.ValueChangeStep;
this.mouseLastPositionX = position.X;
}
}
}
using DevExpress.ClipboardSource.SpreadsheetML;
using DevExpress.Xpf.Core;
using DevExpress.Xpf.Editors;
using DevExpress.Xpf.Grid;
using DevExpress.Xpf.Utils.About;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Dynamic;
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.Markup;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using VIZ.TVP.Domain;
namespace VIZ.TVP.Common
{
/// <summary>
/// 三元编辑器
/// </summary>
[TemplatePart(Name = "PART_X", Type = typeof(LeftRightTextEdit))]
[TemplatePart(Name = "PART_Y", Type = typeof(LeftRightTextEdit))]
[TemplatePart(Name = "PART_Z", Type = typeof(LeftRightTextEdit))]
public class TripletEdit : Control
{
static TripletEdit()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(TripletEdit), new FrameworkPropertyMetadata(typeof(TripletEdit)));
}
/// <summary>
/// 鼠标移动值改变步长
/// </summary>
public const double MOUSE_MOVE_STEP = 0.1d;
/// <summary>
/// 鼠标最小移动
/// </summary>
public const double MOUSE_MIN_MOVE = 5;
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
this.Loaded -= TripletEdit_Loaded;
this.Loaded += TripletEdit_Loaded;
this.DataContextChanged -= TripletEdit_DataContextChanged;
this.DataContextChanged += TripletEdit_DataContextChanged;
this.PART_X = this.Template.FindName("PART_X", this) as LeftRightTextEdit;
this.PART_Y = this.Template.FindName("PART_Y", this) as LeftRightTextEdit;
this.PART_Z = this.Template.FindName("PART_Z", this) as LeftRightTextEdit;
if (this.PART_X != null)
{
this.PART_X.EditValueChanged -= PART_X_EditValueChanged;
this.PART_X.EditValueChanged += PART_X_EditValueChanged;
}
if (this.PART_Y != null)
{
this.PART_Y.EditValueChanged -= PART_Y_EditValueChanged;
this.PART_Y.EditValueChanged += PART_Y_EditValueChanged;
}
if (this.PART_Z != null)
{
this.PART_Z.EditValueChanged -= PART_Z_EditValueChanged;
this.PART_Z.EditValueChanged += PART_Z_EditValueChanged;
}
}
#region PART
/// <summary>
/// X 值输入框
/// </summary>
private LeftRightTextEdit PART_X;
/// <summary>
/// Y 值输入框
/// </summary>
private LeftRightTextEdit PART_Y;
/// <summary>
/// Z 值输入框
/// </summary>
private LeftRightTextEdit PART_Z;
#endregion
/// <summary>
/// 是否处于初始化状态
/// </summary>
private bool isInInit;
// ------------------------------------------------------------
// 绑定值改变
/// <summary>
/// 加载完成
/// </summary>
private void TripletEdit_Loaded(object sender, RoutedEventArgs e)
{
this.InitTextEditValue();
}
/// <summary>
/// 绑定值改变
/// </summary>
private void TripletEdit_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
{
this.InitTextEditValue();
}
/// <summary>
/// 初始化文本编辑器值
/// </summary>
private void InitTextEditValue()
{
EditGridCellData cellData = this.DataContext as EditGridCellData;
if (cellData == null)
return;
this.isInInit = true;
if (cellData.Row is VizControlObjectFieldModel)
{
VizControlObjectFieldModel field = cellData.Row as VizControlObjectFieldModel;
double[] triplet = this.GetTripletValue(field.Value);
this.PART_X.EditValue = triplet[0];
this.PART_Y.EditValue = triplet[1];
this.PART_Z.EditValue = triplet[2];
}
if (cellData.Row is ExpandoObject)
{
IDictionary<string, object> dic = cellData.Row as IDictionary<string, object>;
object obj = dic[cellData.Column.FieldName];
double[] triplet = this.GetTripletValue(obj == null ? null : obj.ToString());
this.PART_X.EditValue = triplet[0];
this.PART_Y.EditValue = triplet[1];
this.PART_Z.EditValue = triplet[2];
}
this.isInInit = false;
}
// ------------------------------------------------------------
// 值改变
/// <summary>
/// X 值改变时触发
/// </summary>
private void PART_X_EditValueChanged(object sender, EditValueChangedEventArgs e)
{
this.TextEditValueChanged(0, e.NewValue?.ToString());
}
/// <summary>
/// Y 值改变时触发
/// </summary>
private void PART_Y_EditValueChanged(object sender, EditValueChangedEventArgs e)
{
this.TextEditValueChanged(1, e.NewValue?.ToString());
}
/// <summary>
/// Z 值改变时触发
/// </summary>
private void PART_Z_EditValueChanged(object sender, EditValueChangedEventArgs e)
{
this.TextEditValueChanged(2, e.NewValue?.ToString());
}
/// <summary>
/// 输入文本值改变时触发
/// </summary>
private void TextEditValueChanged(int index, string value)
{
if (this.isInInit)
return;
EditGridCellData cellData = this.DataContext as EditGridCellData;
if (cellData == null)
return;
double.TryParse(value, out double v);
if (cellData.Row is VizControlObjectFieldModel)
{
VizControlObjectFieldModel field = cellData.Row as VizControlObjectFieldModel;
double[] triplet = this.GetTripletValue(field.Value);
triplet[index] = v;
field.Value = string.Join(" ", triplet);
}
if (cellData.Row is ExpandoObject)
{
IDictionary<string, object> dic = cellData.Row as IDictionary<string, object>;
object obj = dic[cellData.Column.FieldName];
double[] triplet = this.GetTripletValue(obj?.ToString());
triplet[index] = v;
dic[cellData.Column.FieldName] = string.Join(" ", triplet);
}
}
// ------------------------------------------------------------
// Other
/// <summary>
/// 获取三元值
/// </summary>
/// <param name="value">值</param>
/// <returns>三元值列表</returns>
private double[] GetTripletValue(string value)
{
double[] result = new double[] { 0, 0, 0 };
if (string.IsNullOrWhiteSpace(value))
return result;
string[] pars = value.Split(' ');
for (int i = 0; i < pars.Length; i++)
{
if (!double.TryParse(pars[i], out double d))
continue;
result[i] = d;
}
return result;
}
}
}
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:local="clr-namespace:VIZ.TVP.Common">
<Style TargetType="local:TripletEdit">
<Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:TripletEdit">
<Grid Margin="0,2,0,2">
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- X -->
<TextBlock Text="X" Grid.Row="0" VerticalAlignment="Center"
HorizontalAlignment="Center"></TextBlock>
<local:LeftRightTextEdit x:Name="PART_X" Grid.Row="0" Grid.Column="1"
Margin="3"></local:LeftRightTextEdit>
<!-- Y -->
<TextBlock Text="Y" Grid.Row="1" VerticalAlignment="Center"
HorizontalAlignment="Center"></TextBlock>
<local:LeftRightTextEdit x:Name="PART_Y" Grid.Row="1" Grid.Column="1"
Margin="3"></local:LeftRightTextEdit>
<!-- Zs -->
<TextBlock Text="Z" Grid.Row="2" VerticalAlignment="Center"
HorizontalAlignment="Center"></TextBlock>
<local:LeftRightTextEdit x:Name="PART_Z" Grid.Row="2" Grid.Column="1"
Margin="3"></local:LeftRightTextEdit>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
\ No newline at end of file
......@@ -17,6 +17,11 @@ namespace VIZ.TVP.Domain
public const string LOG = "LOG";
/// <summary>
/// 上版面板
/// </summary>
public const string TAKE = "TAKE";
/// <summary>
/// VIZ渲染
/// </summary>
public const string VIZ_RENDER = "VIZ_RENDER";
......
......@@ -19,7 +19,7 @@ namespace VIZ.TVP.Domain
/// </summary>
public GridColumnDefinition()
{
Width = double.NaN;
Width = new GridColumnWidth(1, GridColumnUnitType.Star);
}
/// <summary>
......@@ -38,6 +38,11 @@ namespace VIZ.TVP.Domain
public GridColumnWidth Width { get; set; }
/// <summary>
/// 最小宽度
/// </summary>
public double MinWidth { get; set; } = 120;
/// <summary>
/// 头部
/// </summary>
public object Header { get; set; }
......
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
......@@ -15,5 +16,11 @@ namespace VIZ.TVP.Domain
/// VIZ渲染器名字
/// </summary>
public string VizRendererName { get; set; }
/// <summary>
/// VIZ渲染器进程
/// </summary>e
public Process VizRenderersProcess { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.TVP.Domain
{
......
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Domain
{
/// <summary>
/// 连接切换消息
/// </summary>
public class TVPConnectionChangedMessage
{
/// <summary>
/// 连接分组集合
/// </summary>
public ObservableCollection<TVPConnectionGroupModel> ConnectionGroups { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Domain
{
/// <summary>
/// Viz渲染引擎准备完成消息
/// </summary>
public class VizRenderReadyMessage
{
}
}
......@@ -56,6 +56,20 @@ namespace VIZ.TVP.Domain
#endregion
#region UseAllDirectors -- 使用所有的控制器
private bool useAllDirectors;
/// <summary>
/// 使用所有的控制器
/// </summary>
public bool UseAllDirectors
{
get { return useAllDirectors; }
set { useAllDirectors = value; this.RaisePropertyChanged(nameof(UseAllDirectors)); }
}
#endregion
// ======================================================================
// 扩展属性
// ======================================================================
......
......@@ -144,11 +144,11 @@ namespace VIZ.TVP.Domain
#region Layer --
private string layer;
private VizLayerEnum layer;
/// <summary>
/// 层
/// </summary>
public string Layer
public VizLayerEnum Layer
{
get { return layer; }
set { layer = value; this.RaisePropertyChanged(nameof(Layer)); }
......
......@@ -114,11 +114,11 @@ namespace VIZ.TVP.Domain
#region Layer --
private string layer;
private VizLayerEnum layer;
/// <summary>
/// 层
/// </summary>
public string Layer
public VizLayerEnum Layer
{
get { return layer; }
set { layer = value; this.RaisePropertyChanged(nameof(Layer)); }
......
......@@ -126,6 +126,24 @@ namespace VIZ.TVP.Domain
#endregion
// ======================================================================
// 扩展属性
// ======================================================================
#region IsLoading -- 是否正在加载
private bool isLoading;
/// <summary>
/// 是否正在加载
/// </summary>
public bool IsLoading
{
get { return isLoading; }
set { isLoading = value; this.RaisePropertySaveChanged(nameof(IsLoading)); }
}
#endregion
/// <summary>
/// 连接终结点
/// </summary>
......
......@@ -77,8 +77,10 @@
<Compile Include="Enum\PluginIDs.cs" />
<Compile Include="Enum\ServiceKeys.cs" />
<Compile Include="Info\GridColumnDefinition.cs" />
<Compile Include="Message\Connection\TVPConnectionChangedMessage.cs" />
<Compile Include="Message\ControlObject\VizControlObjectFieldValueChangedMessage.cs" />
<Compile Include="Message\Program\ProgramListItemInitedMessage.cs" />
<Compile Include="Message\Viz\VizRenderReadyMessage.cs" />
<Compile Include="Model\ControlObject\VizControlObjectFieldModel.cs" />
<Compile Include="Info\ControlObject\VizTreeNodeInfo.cs" />
<Compile Include="Manager\DataBaseManager.cs" />
......
......@@ -8,6 +8,7 @@ using System.Windows.Controls;
using System.Windows;
using VIZ.TVP.Storage;
using VIZ.TVP.Domain;
using System.Windows.Forms;
namespace VIZ.TVP.Module
{
......@@ -32,6 +33,11 @@ namespace VIZ.TVP.Module
public DataTemplate BooleanDataTemplate { get; set; }
/// <summary>
/// 三元组
/// </summary>
public DataTemplate TripletDataTemplate { get; set; }
/// <summary>
/// 筛选模板
/// </summary>
/// <param name="item">项</param>
......@@ -53,6 +59,7 @@ namespace VIZ.TVP.Module
case VizControlObjectFieldType.richtext: return this.TextDataTemplate;
case VizControlObjectFieldType.image: return this.ImageDataTemplate;
case VizControlObjectFieldType.list: return this.TextDataTemplate;
case VizControlObjectFieldType.triplet: return this.TripletDataTemplate;
default: return null;
}
}
......
......@@ -20,7 +20,7 @@
<!-- 文本编辑 -->
<DataTemplate x:Key="ColumnTemplate_Text">
<dxe:TextEdit x:Name="PART_Editor"></dxe:TextEdit>
<dxe:TextEdit x:Name="PART_Editor" AcceptsReturn="True"></dxe:TextEdit>
</DataTemplate>
<!-- 图片编辑 -->
......@@ -34,15 +34,23 @@
ItemsSource="{Binding Source={x:Static domain:ApplicationConstants.VIZ_CONTROL_OBJECT_BOOLEAN}}"></dxe:ComboBoxEdit>
</DataTemplate>
<!-- 三元组编辑 -->
<DataTemplate x:Key="ColumnTemplate_Triplet">
<common:TripletEdit></common:TripletEdit>
</DataTemplate>
<local:ControlListValueDataTemplateSelecter x:Key="ControlListValueDataTemplateSelecter"
TextDataTemplate="{StaticResource ColumnTemplate_Text}"
ImageDataTemplate="{StaticResource ColumnTemplate_Image}"
BooleanDataTemplate="{StaticResource ColumnTemplate_Boolean}">
BooleanDataTemplate="{StaticResource ColumnTemplate_Boolean}"
TripletDataTemplate="{StaticResource ColumnTemplate_Triplet}">
</local:ControlListValueDataTemplateSelecter>
<DataTemplate x:Key="ColumnTemplate">
<ContentControl>
<dxg:GridColumn FieldName="{Binding FieldName}" Width="{Binding Width}" Header="{Binding Header}" ReadOnly="{Binding ReadOnly}"
<dxg:GridColumn FieldName="{Binding FieldName}" Width="{Binding Width}"
MinWidth="{Binding MinWidth}"
Header="{Binding Header}" ReadOnly="{Binding ReadOnly}"
AllowEditing="True" AllowSorting="False" AllowColumnFiltering="False"
CellTemplate="{Binding CellEditTemplate}"
CellEditTemplate="{Binding CellEditTemplate}" />
......@@ -72,7 +80,7 @@
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView AllowEditing="True" ShowIndicator="True"
NavigationStyle="Cell"
NavigationStyle="Cell" EditorShowMode="MouseDown"
ShowGroupPanel="False"
AllowDrop="True"
ShowBandsPanel="False"
......@@ -94,7 +102,7 @@
</dxg:GridControl.ContextMenu>
<dxg:GridControl.View>
<dxg:TableView AllowEditing="True" ShowIndicator="True"
NavigationStyle="Cell"
NavigationStyle="Cell" EditorShowMode="MouseDown"
ShowGroupPanel="False"
AllowDrop="True"
ShowBandsPanel="False"
......
using System;
using DevExpress.Xpf.Editors;
using DevExpress.Xpf.Grid;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
......@@ -24,10 +26,5 @@ namespace VIZ.TVP.Module
{
InitializeComponent();
}
private void GridControl_Drop(object sender, DragEventArgs e)
{
}
}
}
<UserControl x:Class="VIZ.TVP.Module.MainViewBottomBar"
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"
d:DataContext="{d:DesignInstance Type=local:MainViewBottomBarViewModel}"
xmlns:core="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:local="clr-namespace:VIZ.TVP.Module" x:Name="uc"
mc:Ignorable="d"
d:DesignHeight="50" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.Framework.Common.Resource;component/Style/ListBox/ListBox_None.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<core:Bool2BoolConverter x:Key="Bool2BoolConverter"></core:Bool2BoolConverter>
<core:Bool2SolidColorBrushConverter x:Key="Bool2SolidColorBrushConverter"
TrueBrush="#FF92FF3D"
FalseBrush="#FFFF5353"
NoneBrush="#FFFF5353"></core:Bool2SolidColorBrushConverter>
</ResourceDictionary>
</UserControl.Resources>
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand Event="Loaded" Command="{Binding Path=LoadedCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<Grid>
<StackPanel Orientation="Horizontal">
<!-- 本机 -->
<Border>
<StackPanel Orientation="Horizontal" Background="Transparent" VerticalAlignment="Center"
IsEnabled="{Binding Path=LocalConnection.IsLoading,Converter={StaticResource Bool2BoolConverter}}"
TextBlock.Foreground="{Binding Path=LocalConnection.IsConnected,Converter={StaticResource Bool2SolidColorBrushConverter}}"
TextBlock.FontSize="14"
Cursor="Hand" MinWidth="120" Margin="10,0,0,0">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand Event="PreviewMouseLeftButtonDown"
CommandParameter="{Binding LocalConnection}"
Command="{Binding Path=ItemClickCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<TextBlock Text="{Binding Path=LocalConnection.IP}" VerticalAlignment="Center"></TextBlock>
<TextBlock Text=":" Margin="3,0,3,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding Path=LocalConnection.Port}" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="[" Margin="3,0,3,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="预览引擎" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="]" Margin="3,0,3,0" VerticalAlignment="Center"></TextBlock>
</StackPanel>
</Border>
<!-- 连接分组 -->
<ListBox Style="{StaticResource ListBox_None}" ItemsSource="{Binding Path=Items}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"></StackPanel>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Border>
<StackPanel Orientation="Horizontal" Background="Transparent" VerticalAlignment="Center"
IsEnabled="{Binding Path=IsLoading,Converter={StaticResource Bool2BoolConverter}}"
TextBlock.Foreground="{Binding Path=IsConnected,Converter={StaticResource Bool2SolidColorBrushConverter}}"
TextBlock.FontSize="14"
Cursor="Hand" MinWidth="120" Margin="10,0,0,0">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand Event="PreviewMouseLeftButtonDown"
CommandParameter="{Binding .}"
Command="{Binding Path=DataContext.ItemClickCommand,ElementName=uc}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<TextBlock Text="{Binding Path=IP}" VerticalAlignment="Center"></TextBlock>
<TextBlock Text=":" Margin="3,0,3,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding Path=Port}" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="[" Margin="3,0,3,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding Path=Remark}" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="]" Margin="3,0,3,0" VerticalAlignment="Center"></TextBlock>
</StackPanel>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</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.TVP.Module
{
/// <summary>
/// MainViewBottomBar.xaml 的交互逻辑
/// </summary>
public partial class MainViewBottomBar : UserControl
{
public MainViewBottomBar()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new MainViewBottomBarViewModel());
}
}
}
......@@ -11,7 +11,7 @@
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Horizontal" IsEnabled="{Binding Path=IsVizRenderReady}">
<dxb:MainMenuControl Caption="MainMenu" VerticalAlignment="Center">
<dxb:BarSubItem Content="项目">
<dxb:BarButtonItem Content="新建" Command="{Binding Path=CreateProjectCommand}" />
......
using log4net;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.TVP.Connection;
using VIZ.TVP.Domain;
namespace VIZ.TVP.Module
{
/// <summary>
/// 主视图底部工具条视图模型
/// </summary>
public class MainViewBottomBarViewModel : ViewModelBase
{
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(MainViewBottomBarViewModel));
public MainViewBottomBarViewModel()
{
// 初始化命令
this.initCommand();
// 初始化消息
this.initMessage();
}
/// <summary>
/// 初始化命令
/// </summary>
private void initCommand()
{
this.LoadedCommand = new VCommand(this.Loaded);
this.ItemClickCommand = new VCommand<TVPConnectionModel>(this.ItemClick);
}
/// <summary>
/// 初始化消息
/// </summary>
private void initMessage()
{
ApplicationDomainEx.MessageManager.Register<TVPConnectionChangedMessage>(this, this.OnTVPConnectionChangedMessage);
ApplicationDomainEx.MessageManager.Register<VizRenderReadyMessage>(this, this.OnVizRenderReadyMessage);
}
// ===================================================================
// Property
// ===================================================================
#region LocalConnection -- 本机连接
private TVPConnectionModel localConnection;
/// <summary>
/// 本机连接
/// </summary>
public TVPConnectionModel LocalConnection
{
get { return localConnection; }
set { localConnection = value; this.RaisePropertyChanged(nameof(LocalConnection)); }
}
#endregion
#region Items -- 连接项集合
private ObservableCollection<TVPConnectionModel> items;
/// <summary>
/// 连接项集合
/// </summary>
public ObservableCollection<TVPConnectionModel> Items
{
get { return items; }
set { items = value; this.RaisePropertyChanged(nameof(Items)); }
}
#endregion
// ===================================================================
// Command
// ===================================================================
#region LoadedCommand -- 加载命令
/// <summary>
/// 加载命令
/// </summary>
public VCommand LoadedCommand { get; set; }
/// <summary>
/// 加载
/// </summary>
private void Loaded()
{
if (this.IsAlreadyLoaded)
return;
this.IsAlreadyLoaded = true;
TVPConnectionGroupModel group = ApplicationDomainEx.TVPConnectionManager.ConnectionGroups.FirstOrDefault(p => p.IsEnabled);
if (group != null)
{
this.Items = group.Items.Where(p => p.IsEnabled).ToObservableCollection();
}
// 连接当前分组
this.ConnectCurrentGroup();
}
#endregion
#region ItemClickCommand -- 项点击命令
/// <summary>
/// 项点击命令
/// </summary>
public VCommand<TVPConnectionModel> ItemClickCommand { get; set; }
/// <summary>
/// 项点击命令
/// </summary>
/// <param name="model">连接模型</param>
private void ItemClick(TVPConnectionModel model)
{
model.IsLoading = true;
ThreadHelper.SafeRun(action: () =>
{
if (model.IsConnected)
{
model.EndpointManager.Disconnect();
}
else
{
model.EndpointManager.Connect();
}
}, final: () =>
{
model.IsLoading = false;
});
}
#endregion
// ===================================================================
// Message
// ===================================================================
/// <summary>
/// Viz渲染引擎准备完毕消息
/// </summary>
/// <param name="msg">消息</param>
private void OnVizRenderReadyMessage(VizRenderReadyMessage msg)
{
this.LocalConnection = ApplicationDomainEx.TVPConnectionManager.LocalConnection;
}
/// <summary>
/// TVP连接改变消息
/// </summary>
/// <param name="msg">消息</param>
private void OnTVPConnectionChangedMessage(TVPConnectionChangedMessage msg)
{
TVPConnectionGroupModel group = msg.ConnectionGroups.FirstOrDefault(p => p.IsEnabled);
if (group != null)
{
this.Items = group.Items.Where(p => p.IsEnabled).ToObservableCollection();
}
else
{
this.Items = null;
}
// 连接当前分组
this.ConnectCurrentGroup();
}
// ===================================================================
// Public Function
// ===================================================================
/// <summary>
/// 连接当前分组
/// </summary>
public void ConnectCurrentGroup()
{
if (ApplicationDomainEx.TVPConnectionManager.ConnectionGroups == null)
return;
var group = ApplicationDomainEx.TVPConnectionManager.ConnectionGroups.FirstOrDefault(p => p.IsEnabled);
if (group == null)
return;
foreach (var item in group.Items)
{
if (item.IsConnected || !item.IsEnabled)
continue;
ThreadHelper.SafeRun(action: () =>
{
item.IsLoading = true;
if (item.EndpointManager == null)
{
item.InitEndpointManager(new VizEndpointManager(item.Remark, item.IP, item.Port));
}
item.EndpointManager.Connect();
}, final: () =>
{
item.IsLoading = false;
});
}
}
}
}
......@@ -23,6 +23,9 @@ namespace VIZ.TVP.Module
// 初始化控制器
this.initController();
// 初始化消息
this.initMessage();
}
/// <summary>
......@@ -48,6 +51,18 @@ namespace VIZ.TVP.Module
}
/// <summary>
/// 初始化消息
/// </summary>
private void initMessage()
{
ApplicationDomainEx.MessageManager.Register<VizRenderReadyMessage>(this, this.OnVizRenderReadyMessage);
}
// ==================================================================
// Controller & Service
// ==================================================================
/// <summary>
/// 项目控制器
/// </summary>
private ProjectController projectController;
......@@ -70,6 +85,20 @@ namespace VIZ.TVP.Module
#endregion
#region IsVizRenderReady -- VIZ渲染引擎是否准备完毕
private bool isVizRenderReady;
/// <summary>
/// VIZ渲染引擎是否准备完毕
/// </summary>
public bool IsVizRenderReady
{
get { return isVizRenderReady; }
set { isVizRenderReady = value; this.RaisePropertyChanged(nameof(IsVizRenderReady)); }
}
#endregion
// ==================================================================
// Command
// ==================================================================
......@@ -191,7 +220,14 @@ namespace VIZ.TVP.Module
// Message
// ==================================================================
/// <summary>
/// Viz渲染引擎初始化完成消息
/// </summary>
/// <param name="msg">消息</param>
private void OnVizRenderReadyMessage(VizRenderReadyMessage msg)
{
this.IsVizRenderReady = true;
}
// ==================================================================
// Public Function
......
......@@ -73,7 +73,6 @@ namespace VIZ.TVP.Module
#endregion
// ==========================================================================
// Message
// ==========================================================================
......
......@@ -18,5 +18,11 @@ namespace VIZ.TVP.Module
/// </summary>
/// <param name="fileModel">文件模型</param>
void AddSceneTemplate(GHResourceFileModel fileModel);
/// <summary>
/// 获取当前选中的节目单项
/// </summary>
/// <returns>当前选中的节目单项</returns>
ProgramListItemModel GetSelectedProgramListItem();
}
}
......@@ -7,6 +7,7 @@ using System.Windows;
using VIZ.Framework.Core;
using VIZ.Framework.Plugin;
using VIZ.TVP.Domain;
using VIZ.TVP.Storage;
namespace VIZ.TVP.Module
{
......@@ -64,11 +65,11 @@ namespace VIZ.TVP.Module
#region Layer --
private string layer;
private VizLayerEnum layer;
/// <summary>
/// 层
/// </summary>
public string Layer
public VizLayerEnum Layer
{
get { return layer; }
set { layer = value; this.RaisePropertyChanged(nameof(Layer)); }
......
......@@ -36,7 +36,7 @@ namespace VIZ.TVP.Module
this.initMessage();
// 注册服务
ApplicationDomainEx.ServiceManager.AddService("PROGRAM_LIST_VIEW_SERVICE", this);
ApplicationDomainEx.ServiceManager.AddService(ServiceKeys.PROGRAM_LIST_VIEW_SERVICE, this);
}
/// <summary>
......@@ -633,7 +633,7 @@ namespace VIZ.TVP.Module
model.TemplateID = Guid.NewGuid().ToString();
model.SceneName = fileModel.Name;
model.Path = fileModel.Path;
model.Layer = VizLayerEnum.MAIN_LAYER.ToString();
model.Layer = VizLayerEnum.MAIN_LAYER;
model.TemplateType = Storage.ProgramTemplateType.Scene;
model.Thumbnail = fileModel.Thumbnail;
model.ThumbnailBitmap = fileModel.ThumbnailBitmap;
......@@ -654,5 +654,14 @@ namespace VIZ.TVP.Module
this.SceneTemplateModels.Add(model);
}
/// <summary>
/// 获取当前选中的节目单项
/// </summary>
/// <returns>当前选中的节目单项</returns>
public ProgramListItemModel GetSelectedProgramListItem()
{
return this.SelectedProgramListModel?.SelectedItem;
}
}
}
......@@ -6,6 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.TVP.Connection;
using VIZ.TVP.Domain;
using VIZ.TVP.Service;
using VIZ.TVP.Storage;
......@@ -240,7 +241,70 @@ namespace VIZ.TVP.Module
public void Save()
{
this.tvpConnectionService.SaveGroups(this.Groups);
// 断开当前的连接
this.DisConnectAll();
ApplicationDomainEx.TVPConnectionManager.ConnectionGroups = this.Groups;
// 发送连接改变消息
TVPConnectionChangedMessage msg = new TVPConnectionChangedMessage();
msg.ConnectionGroups = this.Groups;
ApplicationDomainEx.MessageManager.Send(msg);
}
/// <summary>
/// 断开所有连接
/// </summary>
/// <param name="groups">连接分组集合</param>
private void DisConnectAll()
{
if (ApplicationDomainEx.TVPConnectionManager.ConnectionGroups == null)
return;
foreach (TVPConnectionGroupModel group in ApplicationDomainEx.TVPConnectionManager.ConnectionGroups)
{
foreach (TVPConnectionModel item in group.Items)
{
if (item.IsConnected)
{
item.EndpointManager.Disconnect();
}
}
}
}
/// <summary>
/// 连接当前分组
/// </summary>
public void ConnectCurrentGroup()
{
if (ApplicationDomainEx.TVPConnectionManager.ConnectionGroups == null)
return;
var group = ApplicationDomainEx.TVPConnectionManager.ConnectionGroups.FirstOrDefault(p => p.IsEnabled);
if (group == null)
return;
foreach (var item in group.Items)
{
if (item.IsConnected)
continue;
ThreadHelper.SafeRun(action: () =>
{
item.IsLoading = true;
if (item.EndpointManager == null)
{
item.InitEndpointManager(new VizEndpointManager(item.Remark, item.IP, item.Port));
}
item.EndpointManager.Connect();
}, final: () =>
{
item.IsLoading = false;
});
}
}
}
}
......@@ -11,6 +11,7 @@ using VIZ.Framework.Storage;
using VIZ.Framework.Module;
using VIZ.TVP.Domain;
using VIZ.TVP.Service;
using VIZ.TVP.Connection;
namespace VIZ.TVP.Module
{
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using VIZ.Framework.Plugin;
using VIZ.TVP.Domain;
using VIZ.TVP.Plugin;
namespace VIZ.TVP.Module
{
/// <summary>
/// 上版插件生命周期
/// </summary>
public class TakePluginLifeCycle : IPluginLifeCycle
{
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
/// 插件ID不能包含点号
/// </remarks>
public const string PLUGIN_ID = PluginIDs.TAKE;
/// <summary>
/// 插件显示名称
/// </summary>
public const string PLUGIN_DISPLAY_NAME = "控制";
/// <summary>
/// 注册
/// </summary>
/// <returns>插件信息</returns>
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.ID = PLUGIN_ID;
info.DisplayName = PLUGIN_DISPLAY_NAME;
info.HasView = true;
info.HasSettingView = false;
info.ViewInfo = new PluginViewInfo(typeof(TakeView), typeof(TakeViewModel));
return info;
}
/// <summary>
/// 初始化
/// </summary>
public void Initialize()
{
}
/// <summary>
/// 销毁
/// </summary>
public void Dispose()
{
}
}
}
<UserControl x:Class="VIZ.TVP.Module.TakeView"
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:local="clr-namespace:VIZ.TVP.Module"
d:DataContext="{d:DesignInstance Type=local:TakeViewModel}"
mc:Ignorable="d"
d:DesignHeight="50" d:DesignWidth="600">
<StackPanel Orientation="Horizontal">
<Button Height="30" Width="80" Content="Take" Margin="10,0,10,0"
Command="{Binding TakeCommand}"></Button>
<Button Height="30" Width="80" Content="Continue" Margin="10,0,10,0"
Command="{Binding ContinueCommand}"></Button>
<Button Height="30" Width="80" Content="Take Out" Margin="10,0,10,0"
Command="{Binding TakeOutCommand}"></Button>
<Button Height="30" Width="80" Content="Update" Margin="10,0,10,0"
Command="{Binding UpdateCommand}"></Button>
</StackPanel>
</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;
namespace VIZ.TVP.Module
{
/// <summary>
/// TakeView.xaml 的交互逻辑
/// </summary>
public partial class TakeView : UserControl
{
public TakeView()
{
InitializeComponent();
}
}
}
using DevExpress.Xpf.Grid.TreeList;
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.Framework.Plugin;
using VIZ.TVP.Domain;
using VIZ.TVP.Service;
using VIZ.TVP.Storage;
namespace VIZ.TVP.Module
{
/// <summary>
/// 上版视图模型
/// </summary>
public class TakeViewModel : PluginViewModelBase
{
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(TakeViewModel));
public TakeViewModel()
{
// 初始化命令
this.initCommand();
}
/// <summary>
/// 初始化命令
/// </summary>
private void initCommand()
{
this.TakeCommand = new VCommand(this.Take);
this.ContinueCommand = new VCommand(this.Continue);
this.TakeOutCommand = new VCommand(this.TakeOut);
this.UpdateCommand = new VCommand(this.Update);
}
// ==============================================================
// Service & Controller
// ==============================================================
/// <summary>
/// Viz引擎命令服务
/// </summary>
private IVizCommandService vizCommandService = new VizCommandService();
/// <summary>
/// Viz引擎控制对象服务
/// </summary>
private IVizCommandControlObjectService VizCommandControlObjectService = new VizCommandControlObjectService();
// ==============================================================
// Property
// ==============================================================
// ==============================================================
// Command
// ==============================================================
#region TakeCommand -- 上版子命令
/// <summary>
/// 上版命令
/// </summary>
public VCommand TakeCommand { get; set; }
/// <summary>
/// 上板
/// </summary>
private void Take()
{
IProgramListViewService service = ApplicationDomainEx.ServiceManager.GetService<IProgramListViewService>(ServiceKeys.PROGRAM_LIST_VIEW_SERVICE);
if (service == null)
return;
ProgramListItemModel programListItem = service.GetSelectedProgramListItem();
if (programListItem == null)
return;
var group = ApplicationDomainEx.TVPConnectionManager.ConnectionGroups.FirstOrDefault(p => p.IsEnabled);
if (group == null)
return;
var items = group.Items.Where(p => p.IsEnabled).ToList();
foreach (var item in items)
{
try
{
if (!item.IsConnected)
continue;
VizControlObjectModel main = programListItem.ControlObjectList.FirstOrDefault();
this.vizCommandService.TakeIn(item, programListItem.Path, programListItem.Layer, main?.UseAllDirectors ?? false);
}
catch (Exception ex)
{
log.Error(ex);
}
}
}
#endregion
#region ContinueCommand -- 继续命令
/// <summary>
/// 继续命令
/// </summary>
public VCommand ContinueCommand { get; set; }
/// <summary>
/// 继续
/// </summary>
private void Continue()
{
IProgramListViewService service = ApplicationDomainEx.ServiceManager.GetService<IProgramListViewService>(ServiceKeys.PROGRAM_LIST_VIEW_SERVICE);
if (service == null)
return;
ProgramListItemModel programListItem = service.GetSelectedProgramListItem();
if (programListItem == null)
return;
var group = ApplicationDomainEx.TVPConnectionManager.ConnectionGroups.FirstOrDefault(p => p.IsEnabled);
if (group == null)
return;
var items = group.Items.Where(p => p.IsEnabled).ToList();
foreach (var item in items)
{
try
{
if (!item.IsConnected)
continue;
this.vizCommandService.TakeContinue(item, programListItem.Layer);
}
catch (Exception ex)
{
log.Error(ex);
}
}
}
#endregion
#region TakeOutCommand -- 下版命令
/// <summary>
/// 下版命令
/// </summary>
public VCommand TakeOutCommand { get; set; }
/// <summary>
/// 下版
/// </summary>
private void TakeOut()
{
IProgramListViewService service = ApplicationDomainEx.ServiceManager.GetService<IProgramListViewService>(ServiceKeys.PROGRAM_LIST_VIEW_SERVICE);
if (service == null)
return;
ProgramListItemModel programListItem = service.GetSelectedProgramListItem();
if (programListItem == null)
return;
var group = ApplicationDomainEx.TVPConnectionManager.ConnectionGroups.FirstOrDefault(p => p.IsEnabled);
if (group == null)
return;
var items = group.Items.Where(p => p.IsEnabled).ToList();
foreach (var item in items)
{
try
{
if (!item.IsConnected)
continue;
this.vizCommandService.TakeOut(item, programListItem.Layer);
}
catch (Exception ex)
{
log.Error(ex);
}
}
}
#endregion
#region UpdateCommand -- 更新命令
/// <summary>
/// 更新命令
/// </summary>
public VCommand UpdateCommand { get; set; }
/// <summary>
/// 更新
/// </summary>
private void Update()
{
IProgramListViewService service = ApplicationDomainEx.ServiceManager.GetService<IProgramListViewService>(ServiceKeys.PROGRAM_LIST_VIEW_SERVICE);
if (service == null)
return;
ProgramListItemModel programListItem = service.GetSelectedProgramListItem();
if (programListItem == null)
return;
var group = ApplicationDomainEx.TVPConnectionManager.ConnectionGroups.FirstOrDefault(p => p.IsEnabled);
if (group == null)
return;
var items = group.Items.Where(p => p.IsEnabled).ToList();
foreach (var item in items)
{
try
{
if (!item.IsConnected)
continue;
VizControlObjectModel main = programListItem.ControlObjectList.FirstOrDefault();
if (main == null)
continue;
this.VizCommandControlObjectService.SetControlObjectValue(item, VizSceneLayerEnum.MAIN_SCENE, main);
}
catch (Exception ex)
{
log.Error(ex);
}
}
}
#endregion
// ==============================================================
// Public Function
// ==============================================================
/// <summary>
/// 销毁
/// </summary>
public override void Dispose()
{
}
}
}
......@@ -90,6 +90,10 @@
<Reference Include="WindowsFormsIntegration" />
</ItemGroup>
<ItemGroup>
<Page Include="MainView\View\MainViewBottomBar.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Program\View\ProgramItemCreateWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......@@ -170,6 +174,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Take\View\TakeView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Generic.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
......@@ -192,6 +200,10 @@
<Compile Include="Control\ControlList\Controller\ControlObject\IControlObjectSupport.cs" />
<Compile Include="Control\ControlList\Core\ControlListDynamicValueDataTemplateSelecter.cs" />
<Compile Include="Control\ControlList\Core\ControlListValueDataTemplateSelecter.cs" />
<Compile Include="MainView\ViewModel\MainViewBottomBarViewModel.cs" />
<Compile Include="MainView\View\MainViewBottomBar.xaml.cs">
<DependentUpon>MainViewBottomBar.xaml</DependentUpon>
</Compile>
<Compile Include="Program\View\ProgramItemCreateWindow.xaml.cs">
<DependentUpon>ProgramItemCreateWindow.xaml</DependentUpon>
</Compile>
......@@ -299,6 +311,11 @@
<Compile Include="Common\View\TextInputView.xaml.cs">
<DependentUpon>TextInputView.xaml</DependentUpon>
</Compile>
<Compile Include="Take\ViewModel\TakeViewModel.cs" />
<Compile Include="Take\View\TakeView.xaml.cs">
<DependentUpon>TakeView.xaml</DependentUpon>
</Compile>
<Compile Include="Take\TakePluginLifeCycle.cs" />
<Compile Include="VizRender\Controller\VizController\IVizSupport.cs" />
<Compile Include="VizRender\Controller\VizController\VizController.cs" />
<Compile Include="VizRender\Model\VizConnectionModel.cs" />
......
......@@ -11,7 +11,6 @@ using VIZ.Framework.Core;
using VIZ.TVP.Connection;
using VIZ.TVP.Domain;
using VIZ.TVP.Storage;
using static DevExpress.Xpf.Core.HandleDecorator.Helpers.NativeMethods;
namespace VIZ.TVP.Module
{
......@@ -40,11 +39,6 @@ namespace VIZ.TVP.Module
public IVizSupport Support { get; private set; }
/// <summary>
/// VIZ进程
/// </summary>
public Process VizProcess { get; private set; }
/// <summary>
/// 启动VIZ引擎
/// </summary>
/// <param name="view"></param>
......@@ -68,26 +62,26 @@ namespace VIZ.TVP.Module
LocalInfoEntity info = ApplicationDomainEx.DataBaseManager.LocalInfo;
// Step 1. 启动进程
this.VizProcess = new Process();
this.VizProcess.StartInfo.WorkingDirectory = System.IO.Path.GetDirectoryName(path);
this.VizProcess.StartInfo.FileName = System.IO.Path.GetFileName(path);
ApplicationDomainEx.LocalVizManager.VizRenderersProcess = new Process();
ApplicationDomainEx.LocalVizManager.VizRenderersProcess.StartInfo.WorkingDirectory = System.IO.Path.GetDirectoryName(path);
ApplicationDomainEx.LocalVizManager.VizRenderersProcess.StartInfo.FileName = System.IO.Path.GetFileName(path);
//VIZ3: " -o -P -db Guest:@localhost/VizDbServer:19396"
//VIZ4: "-u1 -n -M -e Guest:@localhost/VizDbServer:19396"
LocalInfoEntity loginInfo = ApplicationDomainEx.DataBaseManager.LocalInfo;
if (info.LocalEngineType == LocalEngineType.Eng3)
{
this.VizProcess.StartInfo.Arguments = $" -o -P -db {loginInfo.VIZ_UserName}:@{loginInfo.VIZ_IP}/{loginInfo.GH_ServerName}:{loginInfo.GH_Port}";
ApplicationDomainEx.LocalVizManager.VizRenderersProcess.StartInfo.Arguments = $" -o -P -db {loginInfo.VIZ_UserName}:@{loginInfo.VIZ_IP}/{loginInfo.GH_ServerName}:{loginInfo.GH_Port}";
}
if (info.LocalEngineType == LocalEngineType.Eng4)
{
this.VizProcess.StartInfo.Arguments = $" -o -P -db {loginInfo.VIZ_UserName}:@{loginInfo.VIZ_IP}/{loginInfo.GH_ServerName}:{loginInfo.GH_Port}";
ApplicationDomainEx.LocalVizManager.VizRenderersProcess.StartInfo.Arguments = $" -o -P -db {loginInfo.VIZ_UserName}:@{loginInfo.VIZ_IP}/{loginInfo.GH_ServerName}:{loginInfo.GH_Port}";
//this.VizProcess.StartInfo.Arguments = $" -u1 -n -M -e {loginInfo.VIZ_UserName}:@{loginInfo.VIZ_IP}/{loginInfo.GH_ServerName}:{loginInfo.GH_Port}";
}
this.VizProcess.StartInfo.UseShellExecute = true;
this.VizProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
this.VizProcess.Start();
ApplicationDomainEx.LocalVizManager.VizRenderersProcess.StartInfo.UseShellExecute = true;
ApplicationDomainEx.LocalVizManager.VizRenderersProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
ApplicationDomainEx.LocalVizManager.VizRenderersProcess.Start();
// Step 2. 连接VIZ
do
......@@ -125,6 +119,10 @@ namespace VIZ.TVP.Module
WPFHelper.BeginInvoke(() =>
{
this.Support.IsEngineReady = true;
// 发送引擎嵌入完成消息
VizRenderReadyMessage msg = new VizRenderReadyMessage();
ApplicationDomainEx.MessageManager.Send(msg);
});
});
}
......
......@@ -9,7 +9,6 @@ using VIZ.TVP.Connection;
using VIZ.TVP.Domain;
using VIZ.TVP.Service;
using VIZ.TVP.Storage;
using static VIZ.Framework.Core.WPFHelper;
namespace VIZ.TVP.Module
{
......@@ -522,6 +521,8 @@ namespace VIZ.TVP.Module
}
local = new TVPConnectionModel(new TVPConnectionEntity());
local.IP = info.VIZ_IP;
local.Port = info.VIZ_Port;
local.InitEndpointManager(new VizEndpointManager("local", info.VIZ_IP, info.VIZ_Port));
ApplicationDomainEx.TVPConnectionManager.LocalConnection = local;
......
......@@ -171,6 +171,7 @@ namespace VIZ.TVP.Service
obj.TreeNodeName = info.NodeName;
obj.TreeNodePath = info.NodeFullPath;
obj.Description = this.GetControlObjectParameter(connection, layer, info.NodeNum, VizControlObjectParameters.description);
obj.UseAllDirectors = this.GetControlObjectParameter(connection, layer, info.NodeNum, VizControlObjectParameters.use_all_directors) == "1";
string str = this.GetControlObjectResult(connection, layer, info.NodeNum);
string[] lines = str.Split('\n');
......@@ -339,6 +340,9 @@ namespace VIZ.TVP.Service
if (type == "richtext")
return VizControlObjectFieldType.richtext;
if (type == "triplet")
return VizControlObjectFieldType.triplet;
if (type.StartsWith("<?xml"))
return VizControlObjectFieldType.list;
......
......@@ -218,5 +218,50 @@ namespace VIZ.TVP.Service
connection.EndpointManager.Send($"{ApplicationDomainEx.LocalVizManager.VizRendererName} SET_KEY 0,RENDERER*KEY_INTERNAL*IMAGE RESET,RENDERER*KEY_INTERNAL*ACTIVE SET 1");
}
}
/// <summary>
/// 上版子
/// </summary>
/// <param name="connection">连接</param>
/// <param name="scene">场景</param>
/// <param name="layer">层</param>s
/// <param name="use_all_directors">使用所有控制器</param>
public void TakeIn(TVPConnectionModel connection, string scene, VizLayerEnum layer, bool use_all_directors)
{
connection.EndpointManager.Send("RENDERER*UPDATE SET 0");
connection.EndpointManager.Send($"RENDERER*{layer} SET_OBJECT {scene}");
connection.EndpointManager.Send("RENDERER*UPDATE SET 1");
if (use_all_directors)
{
connection.EndpointManager.Send($"RENDERER*{layer}*STAGE START");
}
else
{
connection.EndpointManager.Send($"RENDERER*{layer}*STAGE START");
}
}
/// <summary>
/// 继续版子
/// </summary>
/// <param name="connection">连接</param>
/// <param name="layer">层</param>s
public void TakeContinue(TVPConnectionModel connection, VizLayerEnum layer)
{
connection.EndpointManager.Send($"RENDERER*UPDATE SET 1");
connection.EndpointManager.Send($"RENDERER*{layer}*STAGE CONTINUE");
}
/// <summary>
/// 下版子
/// </summary>
/// <param name="connection">连接</param>
/// <param name="layer">层</param>s
public void TakeOut(TVPConnectionModel connection, VizLayerEnum layer)
{
connection.EndpointManager.Send($"RENDERER*UPDATE SET 1");
connection.EndpointManager.Send($"RENDERER*{layer} SET_OBJECT");
}
}
}
......@@ -83,5 +83,28 @@ namespace VIZ.TVP.Service
/// </summary>
/// <param name="connection">连接</param>
void ShowKeyPreview(TVPConnectionModel connection);
/// <summary>
/// 上版子
/// </summary>
/// <param name="connection">连接</param>
/// <param name="scene">场景</param>
/// <param name="layer">层</param>s
/// <param name="use_all_directors">使用所有控制器</param>
void TakeIn(TVPConnectionModel connection, string scene, VizLayerEnum layer, bool use_all_directors);
/// <summary>
/// 继续版子
/// </summary>
/// <param name="connection">连接</param>
/// <param name="layer">层</param>s
void TakeContinue(TVPConnectionModel connection, VizLayerEnum layer);
/// <summary>
/// 下版子
/// </summary>
/// <param name="connection">连接</param>
/// <param name="layer">层</param>s
void TakeOut(TVPConnectionModel connection, VizLayerEnum layer);
}
}
......@@ -39,6 +39,11 @@ namespace VIZ.TVP.Storage
/// <summary>
/// 列表
/// </summary>
list
list,
/// <summary>
/// 三元组
/// </summary>
triplet
}
}
......@@ -27,7 +27,7 @@ namespace VIZ.TVP.Storage
viz_layer,
/// <summary>
///
/// 使用所有的控制器
/// </summary>
use_all_directors,
......
......@@ -54,7 +54,7 @@ namespace VIZ.TVP.Storage
/// <summary>
/// 层
/// </summary>
public string Layer { get; set; }
public VizLayerEnum Layer { get; set; }
/// <summary>
/// 引擎类型
......
......@@ -50,7 +50,7 @@ namespace VIZ.TVP.Storage
/// <summary>
/// 层
/// </summary>
public string Layer { get; set; }
public VizLayerEnum Layer { get; set; }
/// <summary>
/// 引擎类型
......
......@@ -6,9 +6,17 @@
xmlns:module="clr-namespace:VIZ.TVP.Module;assembly=VIZ.TVP.Module"
Height="800" Width="1000" WindowStartupLocation="CenterScreen" WindowState="Maximized">
<dx:ThemedWindow.ToolbarItems>
<!-- 主视图顶部 -->
<module:MainViewToolbar></module:MainViewToolbar>
</dx:ThemedWindow.ToolbarItems>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<!-- 主视图 -->
<module:MainView></module:MainView>
<!-- 主视图底部 -->
<module:MainViewBottomBar Grid.Row="1"></module:MainViewBottomBar>
</Grid>
</dx:ThemedWindow>
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