Commit c7af1699 by liulongfei

Viz 命令日志窗口

异常日志窗口
parent bfc47cfa
......@@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Domain;
namespace VIZ.Package.Common
{
......@@ -32,10 +33,20 @@ namespace VIZ.Package.Common
/// <param name="loggingEvent">日志事件</param>
public void DoAppend(LoggingEvent loggingEvent)
{
try
{
if (loggingEvent.Level != Level.Error)
return;
ErrorLogMessage msg = new ErrorLogMessage();
msg.Error = loggingEvent.RenderedMessage;
ApplicationDomainEx.MessageManager.Send(msg);
}
catch
{
// nothing can do.
}
}
}
}
......@@ -81,6 +81,7 @@
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Log\ErrorMessageAppender.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
......@@ -105,6 +106,19 @@
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Core\VIZ.Framework.Core.csproj">
<Project>{75b39591-4bc3-4b09-bd7d-ec9f67efa96e}</Project>
<Name>VIZ.Framework.Core</Name>
</ProjectReference>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Domain\VIZ.Framework.Domain.csproj">
<Project>{28661e82-c86a-4611-a028-c34f6ac85c97}</Project>
<Name>VIZ.Framework.Domain</Name>
</ProjectReference>
<ProjectReference Include="..\VIZ.Package.Domain\VIZ.Package.Domain.csproj">
<Project>{dbaeae47-1f2d-4b05-82c3-abf7cc33aa2d}</Project>
<Name>VIZ.Package.Domain</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
......@@ -103,8 +103,7 @@ namespace VIZ.Package.Connection
this.vizEnginePool.Send(message);
// 记录日志
LogMessage msg = new LogMessage();
msg.Type = LogType.VizLog;
VizCommandLogMessage msg = new VizCommandLogMessage();
msg.Log = $"[{this.RemoteIP}:{this.RemotePort}] 发送: {message}";
ApplicationDomainEx.MessageManager.Send(msg);
......@@ -120,8 +119,7 @@ namespace VIZ.Package.Connection
string result = this.vizEnginePool.Request(message);
// 记录日志
LogMessage msg = new LogMessage();
msg.Type = LogType.VizLog;
VizCommandLogMessage msg = new VizCommandLogMessage();
msg.Log = $"[{this.RemoteIP}:{this.RemotePort}] 发送: {message} 返回: {result}";
ApplicationDomainEx.MessageManager.Send(msg);
......
......@@ -40,6 +40,16 @@ namespace VIZ.Package.Domain
/// </summary>
public static Window FieldEditWindow { get; set; }
/// <summary>
/// Viz命令日志窗口
/// </summary>
public static Window VizCommandLogWindow { get; set; }
/// <summary>
/// 错误日志窗口
/// </summary>
public static Window ErrorLogWindow { get; set; }
// =============================================================
// 数据
// =============================================================
......
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
}
}
......@@ -12,11 +12,6 @@ namespace VIZ.Package.Domain
public static class ModulePluginIds
{
/// <summary>
/// 日志
/// </summary>
public const string LOG = "LOG";
/// <summary>
/// Viz预览
/// </summary>
public const string VIZ_PREVIEW = "VIZ_PREVIEW";
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Domain.Message.Log
{
internal class ErrorLogMessaeg
{
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Domain
{
/// <summary>
/// 日志消息
/// </summary>
public class LogMessage
{
/// <summary>
/// 日志类型
/// </summary>
public LogType Type { get; set; }
/// <summary>
/// 日志信息
/// </summary>
public string Log { get; set; }
}
}
......@@ -75,7 +75,6 @@
<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" />
......@@ -83,7 +82,8 @@
<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\Log\ErrorLogMessage.cs" />
<Compile Include="Message\Log\VizCommandLogMessage.cs" />
<Compile Include="Message\Page\PageOpenMessage.cs" />
<Compile Include="Message\Page\PageInitedMessage.cs" />
<Compile Include="Message\Project\ProjectSaveMessage.cs" />
......
......@@ -35,8 +35,7 @@
</GroupBox>
<GroupBox Header="日志测试" Grid.Column="1">
<StackPanel>
<Button Content="添加日志" Command="{Binding AddLogCommand}"></Button>
<Button Content="清理日志" Command="{Binding ClearLogCommand}"></Button>
<Button Content="错误日志" Command="{Binding ErrorLogCommand}"></Button>
</StackPanel>
</GroupBox>
</Grid>
......
using System;
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
......@@ -13,6 +14,11 @@ namespace VIZ.Package.Module
/// </summary>
public class DebugViewModel : ViewModelBase
{
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(DebugViewModel));
public DebugViewModel()
{
// 初始化命令
......@@ -28,9 +34,8 @@ namespace VIZ.Package.Module
this.SaveLayoutCommand = new VCommand(this.SaveLayout);
this.LoadLayoutCommand = new VCommand(this.LoadLayout);
// 日志
this.AddLogCommand = new VCommand(this.AddLog);
this.ClearLogCommand = new VCommand(this.ClearLog);
// Log
this.ErrorLogCommand = new VCommand(this.ErrorLog);
}
// ======================================================================
......@@ -83,46 +88,21 @@ namespace VIZ.Package.Module
#endregion
// ---------------------------------------------------------
// 日志
#region AddLogCommand -- 添加日志命令
/// <summary>
/// 添加日志命令
/// </summary>
public VCommand AddLogCommand { get; set; }
/// <summary>
/// 添加日志
/// </summary>
private void AddLog()
{
ILogService service = ApplicationDomainEx.ServiceManager.GetService<ILogService>(ViewServiceKeys.LOG_VIEW_SERVICE);
if (service == null)
return;
service.AppendLog("this is a try.");
}
// Log
#endregion
#region ClearLogCommand -- 清理日志命令
#region ErrorLogCommand -- 错误日志命令
/// <summary>
/// 清理日志命令
/// 错误日志命令
/// </summary>
public VCommand ClearLogCommand { get; set; }
public VCommand ErrorLogCommand { get; set; }
/// <summary>
/// 清理日志
/// 错误日志
/// </summary>
private void ClearLog()
private void ErrorLog()
{
ILogService service = ApplicationDomainEx.ServiceManager.GetService<ILogService>(ViewServiceKeys.LOG_VIEW_SERVICE);
if (service == null)
return;
service.ClearLog();
log.Error("测试错误日志!");
}
#endregion
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Domain;
using VIZ.Package.Plugin;
namespace VIZ.Package.Module
{
/// <summary>
/// 日志插件生命周期
/// </summary>
public class LogPluginLifeCycle : IPluginLifeCycle
{
/// <summary>
/// 插件分组
/// </summary>
public const string PLUGIN_GROUP = ApplicationConstants.APPLICATION_GROUP_NAME;
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
/// 插件ID不能包含点号
/// </remarks>
public const string PLUGIN_ID = ModulePluginIds.LOG;
/// <summary>
/// 插件名称
/// </summary>
public const string PLUGIN_NAME = "日志";
/// <summary>
/// 注册
/// </summary>
/// <returns>插件信息</returns>
public PluginInfo Register()
{
PluginInfo info = new PluginInfo();
info.Group = PLUGIN_GROUP;
info.ID = PLUGIN_ID;
info.Name = PLUGIN_NAME;
info.ViewType = typeof(LogView);
return info;
}
/// <summary>
/// 销毁
/// </summary>
public void Dispose()
{
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.Package.Module
{
/// <summary>
/// 日志服务
/// </summary>
public interface ILogService : IService
{
/// <summary>
/// 添加日志
/// </summary>
/// <param name="log">日志</param>
void AppendLog(string log);
/// <summary>
/// 清理日志
/// </summary>
void ClearLog();
}
}
\ No newline at end of file
<dx:ThemedWindow x:Class="VIZ.Package.Module.ErrorWindow"
<dx:ThemedWindow x:Class="VIZ.Package.Module.ErrorLogWindow"
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"
......@@ -6,8 +6,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:VIZ.Package.Module"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=local:ErrorWindowModel}"
Title="Viz命令窗口" Height="800" Width="1200"
d:DataContext="{d:DesignInstance Type=local:ErrorLogWindowModel}"
Title="错误消息窗口" Height="800" Width="1200"
WindowStartupLocation="CenterScreen">
<Grid>
......
......@@ -16,15 +16,15 @@ using VIZ.Framework.Core;
namespace VIZ.Package.Module
{
/// <summary>
/// Interaction logic for ErrorWindow.xaml
/// Interaction logic for ErrorLogWindow.xaml
/// </summary>
public partial class ErrorWindow : ThemedWindow
public partial class ErrorLogWindow : ThemedWindow
{
public ErrorWindow()
public ErrorLogWindow()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new ErrorWindowModel());
WPFHelper.BindingViewModel(this, new ErrorLogWindowModel());
this.Closing += VizCommandWindow_Closing;
}
......
<dx:ThemedWindow
x:Class="VIZ.Package.Module.ErrorWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
Title="ErrorWindow" Height="800" Width="1000"
>
<Grid>
</Grid>
</dx:ThemedWindow>
using DevExpress.Xpf.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace VIZ.Package.Module
{
/// <summary>
/// Interaction logic for ErrorWindow.xaml
/// </summary>
public partial class ErrorWindow : ThemedWindow
{
public ErrorWindow()
{
InitializeComponent();
}
}
}
<UserControl x:Class="VIZ.Package.Module.LogView"
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: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>
<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>
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>
/// LogView.xaml 的交互逻辑
/// </summary>
public partial class LogView : UserControl
{
public LogView()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new LogViewModel());
}
}
}
<dx:ThemedWindow
x:Class="VIZ.Package.Module.VizCommandWindow"
<dx:ThemedWindow x:Class="VIZ.Package.Module.VizCommandWindow"
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:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
Title="VizCommandWindow" Height="800" Width="1000"
>
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:VIZ.Package.Module"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=local:VizCommandWindowModel}"
Title="Viz命令窗口" Height="800" Width="1200"
WindowStartupLocation="CenterScreen">
<Grid>
<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" HorizontalScrollBarVisibility="Auto"
Grid.Row="1"></TextBox>
</Grid>
</dx:ThemedWindow>
......@@ -11,7 +11,7 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using VIZ.Framework.Core;
namespace VIZ.Package.Module
{
......@@ -23,6 +23,17 @@ namespace VIZ.Package.Module
public VizCommandWindow()
{
InitializeComponent();
WPFHelper.BindingViewModel(this, new VizCommandWindowModel());
this.Closing += VizCommandWindow_Closing;
}
private void VizCommandWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
this.Visibility = Visibility.Collapsed;
}
}
}
......@@ -12,17 +12,17 @@ namespace VIZ.Package.Module
/// <summary>
/// 错误窗口模型
/// </summary>
public class ErrorWindowModel : ViewModelBase
public class ErrorLogWindowModel : ViewModelBase
{
/// <summary>
/// 日志
/// </summary>
private static readonly ILog log = LogManager.GetLogger(typeof(ErrorWindowModel));
private static readonly ILog log = LogManager.GetLogger(typeof(ErrorLogWindowModel));
/// <summary>
/// 错误窗口模型
/// </summary>
public ErrorWindowModel()
public ErrorLogWindowModel()
{
// 初始化命令
this.InitCommand();
......@@ -44,7 +44,7 @@ namespace VIZ.Package.Module
/// </summary>
private void InitMessage()
{
ApplicationDomainEx.MessageManager.Register<VizCommandLogMessage>(this, this.OnVizCommandLogMessage);
ApplicationDomainEx.MessageManager.Register<ErrorLogMessage>(this, this.OnErrorLogMessage);
}
// ==================================================================================
......@@ -77,18 +77,18 @@ namespace VIZ.Package.Module
// ==================================================================================
/// <summary>
/// Viz命令日志
/// 错误日志消息
/// </summary>
/// <param name="msg">消息</param>
private void OnVizCommandLogMessage(VizCommandLogMessage msg)
private void OnErrorLogMessage(ErrorLogMessage msg)
{
WPFHelper.BeginInvoke(() =>
{
VizCommandWindow view = this.GetView<VizCommandWindow>();
ErrorLogWindow view = this.GetView<ErrorLogWindow>();
if (view == null)
return;
string log = $"{DateTime.Now.ToString("HH:mm:ss")} {msg.Log}";
string log = $"{DateTime.Now.ToString("HH:mm:ss")} {msg.Error}";
view.tb.AppendText($"{log}\r\n");
view.tb.ScrollToEnd();
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Module.Log.ViewModel
{
internal class ErrorWindowModel
{
}
}
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.Package.Domain;
namespace VIZ.Package.Module
{
/// <summary>
/// 日志视图模型
/// </summary>
public class LogViewModel : ViewModelBase, ILogService
{
/// <summary>
/// 日志
/// </summary>
private static readonly ILog log = LogManager.GetLogger(typeof(LogViewModel));
/// <summary>
/// 日志视图模型
/// </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
// ==================================================================================
/// <summary>
/// 添加日志
/// </summary>
/// <param name="log"></param>
public void AppendLog(string log)
{
WPFHelper.BeginInvoke(() =>
{
LogView view = this.GetView<LogView>();
if (view == null)
return;
view.tb.AppendText($"{log}\r\n");
});
}
/// <summary>
/// 清理日志
/// </summary>
public void ClearLog()
{
WPFHelper.BeginInvoke(() =>
{
LogView view = this.GetView<LogView>();
if (view == null)
return;
view.tb.Clear();
});
}
}
}
\ No newline at end of file
using System;
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.Package.Domain;
namespace VIZ.Package.Module.Log.ViewModel
namespace VIZ.Package.Module
{
internal class VizCommandWindowModel
/// <summary>
/// Viz命令窗口模型
/// </summary>
public class VizCommandWindowModel : ViewModelBase
{
/// <summary>
/// 日志
/// </summary>
private static readonly ILog log = LogManager.GetLogger(typeof(VizCommandWindowModel));
/// <summary>
/// 日志视图模型
/// </summary>
public VizCommandWindowModel()
{
// 初始化命令
this.InitCommand();
// 初始化消息
this.InitMessage();
}
/// <summary>
/// 初始化命令
/// </summary>
private void InitCommand()
{
this.ClearCommand = new VCommand(this.Clear);
}
/// <summary>
/// 初始化消息
/// </summary>
private void InitMessage()
{
ApplicationDomainEx.MessageManager.Register<VizCommandLogMessage>(this, this.OnVizCommandLogMessage);
}
// ==================================================================================
// Command
// ==================================================================================
#region ClearCommand -- 清除消息
/// <summary>
/// 清除消息
/// </summary>
public VCommand ClearCommand { get; set; }
/// <summary>
/// 清除
/// </summary>
private void Clear()
{
VizCommandWindow view = this.GetView<VizCommandWindow>();
if (view == null)
return;
view.tb.Clear();
}
#endregion
// ==================================================================================
// Message
// ==================================================================================
/// <summary>
/// Viz命令日志
/// </summary>
/// <param name="msg">消息</param>
private void OnVizCommandLogMessage(VizCommandLogMessage msg)
{
WPFHelper.BeginInvoke(() =>
{
VizCommandWindow view = this.GetView<VizCommandWindow>();
if (view == null)
return;
string log = $"{DateTime.Now.ToString("HH:mm:ss")} {msg.Log}";
view.tb.AppendText($"{log}\r\n");
view.tb.ScrollToEnd();
});
}
// ==================================================================================
// Public Function
// ==================================================================================
}
}
\ No newline at end of file
......@@ -45,7 +45,7 @@
<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"
TextBlock.FontSize="12"
Cursor="Hand" MinWidth="120" Margin="10,0,0,0">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand Event="PreviewMouseLeftButtonDown"
......
......@@ -8,12 +8,24 @@
mc:Ignorable="d"
d:DesignHeight="35" d:DesignWidth="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="200"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<!-- 項目名 -->
<TextBlock Text="项目:" Margin="10,0,0,0" Opacity="0.6"></TextBlock>
<TextBlock Text="{Binding ProjectName}" Margin="10,0,0,0"></TextBlock>
<TextBlock Text="{Binding ProjectName}" Margin="10,0,0,0"
ToolTip="{Binding ProjectName}"></TextBlock>
<TextBlock Text="场景:" Margin="40,0,0,0" Opacity="0.6"></TextBlock>
<TextBlock Text="{Binding Scene}" Margin="10,0,0,0"></TextBlock>
<TextBlock Text="{Binding Scene}" Margin="10,0,0,0"
ToolTip="{Binding Scene}"></TextBlock>
</StackPanel>
<!-- 命令组 -->
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Column="1">
<Button Content="Viz Command Log" Command="{Binding Path=OpenVizCommandLogWindowCommand}"></Button>
<Button Content="Errors" Margin="10,0,5,0" Command="{Binding Path=OpenErrorLogWindowCommand}"></Button>
</StackPanel>
</Grid>
</UserControl>
......@@ -8,6 +8,7 @@
xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:dxdove="http://schemas.devexpress.com/winfx/2008/xaml/docking/visualelements"
xmlns:fcore="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:plugin="clr-namespace:VIZ.Package.Plugin;assembly=VIZ.Package.Plugin"
xmlns:domain="clr-namespace:VIZ.Package.Domain;assembly=VIZ.Package.Domain"
......@@ -20,6 +21,13 @@
<DataTemplate DataType="{x:Type domain:PluginInfo}">
<plugin:PluginLoader ViewType="{Binding ViewType,Mode=OneWay}"></plugin:PluginLoader>
</DataTemplate>
<!--<Style x:Key="CaptionImageStyle" TargetType="dxdove:CaptionImage">
<Setter Property="Width" Value="20"/>
<Setter Property="Height" Value="20"/>
<Setter Property="Stretch" Value="Fill"/>
</Style>-->
<Style TargetType="{x:Type dxdo:LayoutPanel}">
<Setter Property="BindableName" Value="{Binding ID}" />
<Setter Property="Caption" Value="{Binding Name}" />
......@@ -38,7 +46,8 @@
<dxmvvm:EventToCommand EventName="Loaded" Command="{Binding Path=LoadedCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<dxdo:DockLayoutManager x:Name="dockLayoutManager" FloatingMode="Desktop" EnableWin32Compatibility="True">
<dxdo:DockLayoutManager x:Name="dockLayoutManager" FloatingMode="Desktop" EnableWin32Compatibility="True"
AutoHideExpandMode="MouseDown">
<dxdo:LayoutGroup ItemsSource="{Binding ItemsSource}"></dxdo:LayoutGroup>
</dxdo:DockLayoutManager>
</UserControl>
......@@ -18,6 +18,27 @@ namespace VIZ.Package.Module
/// </summary>
public MainStatusViewModel()
{
// 初始化命令
this.InitCommand();
// 初始化消息
this.InitMessage();
}
/// <summary>
/// 初始化命令
/// </summary>
private void InitCommand()
{
this.OpenVizCommandLogWindowCommand = new VCommand(this.OpenVizCommandLogWindow);
this.OpenErrorLogWindowCommand = new VCommand(this.OpenErrorLogWindow);
}
/// <summary>
/// 初始化消息
/// </summary>
private void InitMessage()
{
ApplicationDomainEx.MessageManager.Register<ProjectOpenMessage>(this, this.OnProjectOpenMessage);
ApplicationDomainEx.MessageManager.Register<ProjectCloseMessage>(this, this.OnProjectCloseMessage);
ApplicationDomainEx.MessageManager.Register<PageOpenMessage>(this, this.OnPageOpenMessage);
......@@ -56,6 +77,44 @@ namespace VIZ.Package.Module
#endregion
// ======================================================================
// Command
// ======================================================================
#region OpenVizCommandLogWindowCommand -- 打开Viz命令日志窗口命令
/// <summary>
/// 打开Viz命令日志窗口命令
/// </summary>
public VCommand OpenVizCommandLogWindowCommand { get; set; }
/// <summary>
/// 打开Viz命令日志窗口
/// </summary>
private void OpenVizCommandLogWindow()
{
ApplicationDomainEx.VizCommandLogWindow.Visibility = System.Windows.Visibility.Visible;
}
#endregion
#region OpenErrorLogWindowCommand -- 打开错误日志窗口命令
/// <summary>
/// 打开错误日志窗口命令
/// </summary>
public VCommand OpenErrorLogWindowCommand { get; set; }
/// <summary>
/// 打开错误日志窗口
/// </summary>
private void OpenErrorLogWindow()
{
ApplicationDomainEx.ErrorLogWindow.Visibility = System.Windows.Visibility.Visible;
}
#endregion
// ======================================================================
// Message
// ======================================================================
......
......@@ -94,8 +94,11 @@ namespace VIZ.Package.Module
// 加载布局
this.LoadLayout();
//
// 创建VizCommand窗口
ApplicationDomainEx.VizCommandLogWindow = new VizCommandWindow();
// 创建Error窗口
ApplicationDomainEx.ErrorLogWindow = new ErrorLogWindow();
}
#endregion
......
......@@ -89,7 +89,7 @@
<dx:WaitIndicator DeferedVisibility="{Binding IsFolderLoading}" Content="Loading..." Margin="0,0,6,0" />
<GridSplitter HorizontalAlignment="Right" Width="10" Style="{StaticResource GridSplitter_None}"></GridSplitter>
<dxg:GridControl x:Name="fileGrid" Grid.Column="1" ShowBorder="False"
<dxg:GridControl x:Name="fileGrid" Grid.Column="1" ShowBorder="True"
ContextMenu="{Binding Path=FileContextMenu,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type local:GHResourcePanel}}}"
SelectionMode="Row"
CustomRowFilterCommand="{Binding Path=FileRowFilterCommand}"
......
......@@ -104,6 +104,10 @@
<Compile Include="ControlObject\FieldEdit\Edit\ListEdit\CellEdit\FontListCellEdit.xaml.cs">
<DependentUpon>FontListCellEdit.xaml</DependentUpon>
</Compile>
<Compile Include="Log\ViewModel\ErrorLogWindowModel.cs" />
<Compile Include="Log\View\ErrorLogWindow.xaml.cs">
<DependentUpon>ErrorLogWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Help\About\View\AboutWindow.xaml.cs">
<DependentUpon>AboutWindow.xaml</DependentUpon>
</Compile>
......@@ -112,6 +116,7 @@
<Compile Include="ControlObject\FieldEdit\Service\IFieldEditService.cs" />
<Compile Include="ControlObject\FieldEdit\ViewModel\FieldEditViewModelBase.cs" />
<Compile Include="ControlObject\FieldTree\Service\IFieldTreeService.cs" />
<Compile Include="Log\ViewModel\VizCommandWindowModel.cs" />
<Compile Include="Main\ViewModel\MainConnViewModel.cs" />
<Compile Include="Main\View\MainConnView.xaml.cs">
<DependentUpon>MainConnView.xaml</DependentUpon>
......@@ -279,12 +284,6 @@
<Compile Include="Login\View\LoginView.xaml.cs">
<DependentUpon>LoginView.xaml</DependentUpon>
</Compile>
<Compile Include="Log\LogPluginLifeCycle.cs" />
<Compile Include="Log\Service\ILogService.cs" />
<Compile Include="Log\ViewModel\LogViewModel.cs" />
<Compile Include="Log\View\LogView.xaml.cs">
<DependentUpon>LogView.xaml</DependentUpon>
</Compile>
<Compile Include="Main\Service\IMainViewService.cs" />
<Compile Include="Main\View\MainTopView.xaml.cs">
<DependentUpon>MainTopView.xaml</DependentUpon>
......@@ -333,6 +332,9 @@
<Compile Include="Setting\VizConfig\View\VizConfigSettingView.xaml.cs">
<DependentUpon>VizConfigSettingView.xaml</DependentUpon>
</Compile>
<Compile Include="Log\View\VizCommandWindow.xaml.cs">
<DependentUpon>VizCommandWindow.xaml</DependentUpon>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
......@@ -364,6 +366,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Log\View\ErrorLogWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Help\About\View\AboutWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......@@ -504,10 +510,6 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Log\View\LogView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Main\View\MainTopView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
......@@ -544,6 +546,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Log\View\VizCommandWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\VIZ.Framework\VIZ.Framework.Common.Resource\VIZ.Framework.Common.Resource.csproj">
......
......@@ -118,5 +118,8 @@
<Name>VIZ.Framework.Storage</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Json\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
......@@ -8,6 +8,7 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls.Primitives;
using VIZ.Framework.Module;
using VIZ.Package.Common;
using VIZ.Package.Domain;
using VIZ.Package.Module;
......
......@@ -18,8 +18,12 @@
<!-- 主视图 -->
<module:MainView></module:MainView>
<!-- 状态视图 -->
<module:MainStatusView Grid.Row="1"></module:MainStatusView>
<Border BorderBrush="#ff3f3f46" BorderThickness="1" Grid.Row="1" Margin="0,5,0,0">
<module:MainStatusView></module:MainStatusView>
</Border>
<!-- 连接视图 -->
<module:MainConnView Grid.Row="2"></module:MainConnView>
<Border BorderBrush="#ff3f3f46" BorderThickness="1" Grid.Row="2" Margin="0,5,0,0">
<module:MainConnView></module:MainConnView>
</Border>
</Grid>
</dx:ThemedWindow>
[Application]
APPLICATION_IS_DEBUG=false
APPLICATION_IS_DEBUG=true
[Viz]
VIZ_IMAGE_FILTER=ͼƬ|*.jpg;*.jpeg;*.bmp;*.png;
\ No newline at end of file
......@@ -60,14 +60,18 @@
<conversionPattern value="%date %logger - %message%newline" />
</layout>
</appender>
<appender name="errorMessageAppender" type="VIZ.Package.Common.ErrorMessageAppender, VIZ.Package.Common">
</appender>
<root>
<level value="ALL" />
<appender-ref ref="errorAppender" />
<appender-ref ref="infoAppender" />
<appender-ref ref="debugAppender" />
<appender-ref ref="errorMessageAppender" />
</root>
<logger name="Performance" additivity="false">
<level value="ALL" />
<appender-ref ref="perfAppender" />
<appender-ref ref="errorMessageAppender" />
</logger>
</log4net>
\ 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