Commit 2ecdc430 by liulongfei

添加日志, 添加List单元格聚焦

parent d560862c
......@@ -101,6 +101,13 @@ namespace VIZ.Package.Connection
public void Send(string message)
{
this.vizEnginePool.Send(message);
// 记录日志
LogMessage msg = new LogMessage();
msg.Type = LogType.VizLog;
msg.Log = $"[{this.RemoteIP}:{this.RemotePort}] 发送: {message}";
ApplicationDomainEx.MessageManager.Send(msg);
}
/// <summary>
......@@ -110,7 +117,16 @@ namespace VIZ.Package.Connection
/// <returns>返回值</returns>
public string Request(string message)
{
return this.vizEnginePool.Request(message);
string result = this.vizEnginePool.Request(message);
// 记录日志
LogMessage msg = new LogMessage();
msg.Type = LogType.VizLog;
msg.Log = $"[{this.RemoteIP}:{this.RemotePort}] 发送: {message} 返回: {result}";
ApplicationDomainEx.MessageManager.Send(msg);
return result;
}
/// <summary>
......
......@@ -21,5 +21,6 @@ namespace VIZ.Package.Domain
/// Viz 层集合
/// </summary>
public readonly static List<VizLayer> VIZ_LAYERS = new List<VizLayer> { VizLayer.FRONT_LAYER, VizLayer.MAIN_LAYER, VizLayer.BACK_LAYER };
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Domain
{
/// <summary>
/// 日志等级
/// </summary>
public enum LogType
{
/// <summary>
/// 日志
/// </summary>
Log,
/// <summary>
/// Viz日志
/// </summary>
VizLog,
/// <summary>
/// 错误
/// </summary>
Error
}
}
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Domain
{
/// <summary>
/// 控制列字段改变消息
/// </summary>
public class ControlListFieldChangedMessage
{
/// <summary>
/// 控制对象
/// </summary>
public ControlObjectModel ControlObject { get; set; }
/// <summary>
/// 控制字段
/// </summary>
public ControlFieldNodeModel ControlField { get; set; }
/// <summary>
/// 动态对象
/// </summary>
public object Object { get; set; }
/// <summary>
/// 行索引
/// </summary>
public int ListLine { get; set; }
/// <summary>
/// 字段名
/// </summary>
public string FieldIdentifier { get; set; }
}
}
......@@ -11,7 +11,10 @@ namespace VIZ.Package.Domain
/// </summary>
public class LogMessage
{
/// <summary>
/// 日志类型
/// </summary>
public LogType Type { get; set; }
/// <summary>
/// 日志信息
......
......@@ -75,12 +75,15 @@
<Compile Include="ApplicationConstants.cs" />
<Compile Include="ApplicationDomainEx.cs" />
<Compile Include="Core\GridColumnDefinition.cs" />
<Compile Include="Enum\LogType.cs" />
<Compile Include="Enum\ModulePluginIds.cs" />
<Compile Include="Enum\ViewServiceKeys.cs" />
<Compile Include="Info\VizTreeNodeInfo.cs" />
<Compile Include="Message\Application\ApplicationCloseMessage.cs" />
<Compile Include="Message\Conn\ConnChangedMessage.cs" />
<Compile Include="Message\ControlObject\ControlListFieldChangedMessage.cs" />
<Compile Include="Message\ControlObject\ControlFieldChangedMessage.cs" />
<Compile Include="Message\Log\LogMessage.cs" />
<Compile Include="Message\Page\PageOpenMessage.cs" />
<Compile Include="Message\Page\PageInitedMessage.cs" />
<Compile Include="Message\Project\ProjectSaveMessage.cs" />
......
......@@ -100,7 +100,7 @@ namespace VIZ.Package.Module
this.Execute(
controlObjectAction: (obj, conn) =>
{
this.vizCommandService.Continue(conn, ApplicationDomainEx.CurrentPage.ScenePath, ApplicationDomainEx.CurrentPage.Layer);
this.vizCommandService.TakeContinue(conn, ApplicationDomainEx.CurrentPage.Layer);
},
pluginAction: (view, conns) =>
{
......
using System;
using DevExpress.Data;
using log4net;
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
......@@ -19,6 +21,7 @@ namespace VIZ.Package.Module
public ListCellEditBase()
{
this.DataContextChanged += CellEditBase_DataContextChanged;
this.PreviewMouseLeftButtonDown += ListCellEditBase_PreviewMouseLeftButtonDown;
}
/// <summary>
......@@ -64,6 +67,29 @@ namespace VIZ.Package.Module
}
/// <summary>
/// 鼠标点击时触发
/// </summary>
private void ListCellEditBase_PreviewMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
DevExpress.Xpf.Grid.EditGridCellData cellData = this.DataContext as DevExpress.Xpf.Grid.EditGridCellData;
if (cellData == null)
return;
GridColumnDefinition columnDefinition = cellData.Column.DataContext as GridColumnDefinition;
if (columnDefinition == null)
return;
ControlListFieldChangedMessage msg = new ControlListFieldChangedMessage();
msg.ControlObject = columnDefinition.ControlObject;
msg.ControlField = columnDefinition.ControlField;
msg.Object = cellData.Row;
msg.ListLine = cellData.RowData.RowHandle.Value;
msg.FieldIdentifier = columnDefinition.FieldName;
ApplicationDomainEx.MessageManager.Send(msg);
}
/// <summary>
/// 更新
/// </summary>
/// <param name="columnDefinition">列定义</param>
......
......@@ -103,7 +103,7 @@
</UserControl.Resources>
<Grid>
<dxg:GridControl ItemsSource="{Binding Path=ItemsSource}" ShowBorder="False" Grid.Column="1" AllowDrop="True"
<dxg:GridControl x:Name="grid" ItemsSource="{Binding Path=ItemsSource}" ShowBorder="False" Grid.Column="1" AllowDrop="True"
ColumnsSource="{Binding Path=Columns}"
ColumnGeneratorTemplate="{StaticResource ColumnTemplate}">
<dxg:GridControl.ContextMenu>
......
......@@ -3,10 +3,20 @@
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:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:fcommon="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common"
xmlns:local="clr-namespace:VIZ.Package.Module"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=local:LogViewModel}"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<TextBox x:Name="tb" IsReadOnly="True" AcceptsReturn="False" VerticalScrollBarVisibility="Auto"></TextBox>
<Grid.RowDefinitions>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Button Width="80" Height="20" Content="清除" Command="{Binding Path=ClearCommand}" HorizontalAlignment="Left"></Button>
<TextBox x:Name="tb" IsReadOnly="True" AcceptsReturn="False" VerticalScrollBarVisibility="Auto"
Grid.Row="1"></TextBox>
</Grid>
</UserControl>
......@@ -24,9 +24,68 @@ namespace VIZ.Package.Module
/// </summary>
public LogViewModel()
{
// 初始化命令
this.InitCommand();
// 初始化消息
this.InitMessage();
/// 注册服务
ApplicationDomainEx.ServiceManager.AddService(ViewServiceKeys.LOG_VIEW_SERVICE, this);
}
/// <summary>
/// 初始化命令
/// </summary>
private void InitCommand()
{
this.ClearCommand = new VCommand(this.Clear);
}
/// <summary>
/// 初始化消息
/// </summary>
private void InitMessage()
{
ApplicationDomainEx.MessageManager.Register<LogMessage>(this, this.OnLogMessage);
}
// ==================================================================================
// Command
// ==================================================================================
#region ClearCommand -- 清除消息
/// <summary>
/// 清除消息
/// </summary>
public VCommand ClearCommand { get; set; }
/// <summary>
/// 清除
/// </summary>
private void Clear()
{
this.ClearLog();
}
#endregion
// ==================================================================================
// Message
// ==================================================================================
/// <summary>
/// 处理日志消息
/// </summary>
/// <param name="msg">消息</param>
private void OnLogMessage(LogMessage msg)
{
string log = $"{DateTime.Now.ToString("HH:mm:ss")} <{msg.Type}> {msg.Log}";
this.AppendLog(log);
}
// ==================================================================================
// Public Function
// ==================================================================================
......
......@@ -67,6 +67,7 @@ namespace VIZ.Package.Module
ApplicationDomainEx.MessageManager.Register<PageOpenMessage>(this, this.OnPageOpenMessage);
ApplicationDomainEx.MessageManager.Register<ApplicationCloseMessage>(this, this.OnApplicationCloseMessage);
ApplicationDomainEx.MessageManager.Register<ControlFieldChangedMessage>(this, this.OnControlFieldChangedMessage);
ApplicationDomainEx.MessageManager.Register<ControlListFieldChangedMessage>(this, this.OnControlListFieldChangedMessage);
}
// ================================================================================
......@@ -449,6 +450,23 @@ namespace VIZ.Package.Module
this.vizCommandControlObjectService.ShowFocus(ApplicationDomainEx.PreviewConn, msg.ControlObject, msg.ControlField);
}
/// <summary>
/// 控制列字段改变时触发
/// </summary>
/// <param name="msg">消息</param>
private void OnControlListFieldChangedMessage(ControlListFieldChangedMessage msg)
{
// 引擎未准备好 || 当前没有选中的节目单项目 则不处理
if (!this.IsEngineReady || ApplicationDomainEx.CurrentPage == null)
return;
// 不需要显示区域
if (!this.IsShowBB)
return;
this.vizCommandControlObjectService.ShowFocus(ApplicationDomainEx.PreviewConn, msg.ControlObject, msg.ControlField, msg.ListLine, msg.FieldIdentifier);
}
// ================================================================================
// Public Function
// ================================================================================
......
......@@ -379,6 +379,31 @@ namespace VIZ.Package.Service
}
/// <summary>
/// 设置控制字段聚焦
/// </summary>
/// <param name="conn">连接</param>
/// <param name="obj">控制对象</param>
/// <param name="field">控制字段</param>
/// <param name="listLine">行数</param>
/// <param name="fieldIdentifier">字段名</param>
public void ShowFocus(ConnModel conn, ControlObjectModel obj, ControlFieldNodeModel field, int listLine, string fieldIdentifier)
{
if (conn == null)
throw new ArgumentNullException(nameof(conn));
VizConfigEntity config = ApplicationDomainEx.VizConfig;
if (config.EngineFullType == EngineFullType.VIZ_Eng3)
{
conn.EndpointManager.Send($"RENDERER*TREE*{obj.TreeNodePath}*FUNCTION*ControlObject*in SET WITH LIST INDEX {listLine} FOCUS {fieldIdentifier}");
}
else if (config.EngineFullType == EngineFullType.VIZ_Eng4)
{
conn.EndpointManager.Send($"{ApplicationDomainEx.VizPreviewRenderer}*TREE*{obj.TreeNodePath}*FUNCTION*ControlObject*in SET WITH LIST INDEX {listLine} FOCUS {fieldIdentifier}");
}
}
/// <summary>
/// 获取控制字段类型
/// </summary>
/// <param name="type">字段类型</param>
......
......@@ -248,7 +248,7 @@ namespace VIZ.Package.Service
/// 继续版子
/// </summary>
/// <param name="conn">连接</param>
/// <param name="layer">层</param>s
/// <param name="layer">层</param>
public void TakeContinue(ConnModel conn, VizLayer layer)
{
conn.EndpointManager.Send($"RENDERER*UPDATE SET 1");
......
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