NavisworksTransport/src/UI/WPF/Views/LogViewerDialog.xaml

175 lines
7.7 KiB
XML

<!--
NavisworksTransport 日志查看器对话框 - 采用与主界面一致的Navisworks 2026风格
功能说明:
1. 实时显示和刷新日志内容
2. 支持搜索、过滤和导出功能
3. 提供清空日志和自动滚动选项
4. 与主界面保持一致的视觉风格
设计原则:使用统一的蓝色主题和样式规范,针对大量文本显示优化
-->
<Window x:Class="NavisworksTransport.UI.WPF.Views.LogViewerDialog"
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"
mc:Ignorable="d"
Title="日志查看器"
Height="1200"
Width="900"
ResizeMode="CanResize"
WindowStartupLocation="CenterOwner"
MinHeight="800"
MinWidth="600">
<Window.Resources>
<!-- 引用共享的Navisworks 2026样式资源 -->
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/TransportPlugin;component/src/UI/WPF/Resources/NavisworksStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!-- 日志查看器特有的样式 -->
<Style x:Key="LogTextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="Consolas, Courier New"/>
<Setter Property="FontSize" Value="11"/>
<Setter Property="Background" Value="#FFFEFEFE"/>
<Setter Property="Foreground" Value="#FF333333"/>
<Setter Property="BorderBrush" Value="#FFD4E7FF"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="IsReadOnly" Value="True"/>
<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="TextWrapping" Value="NoWrap"/>
<Setter Property="AcceptsReturn" Value="True"/>
<Setter Property="AcceptsTab" Value="True"/>
<Setter Property="Padding" Value="8"/>
</Style>
<Style x:Key="SearchTextBoxStyle" TargetType="TextBox">
<Setter Property="FontSize" Value="11"/>
<Setter Property="Padding" Value="5,3"/>
<Setter Property="BorderBrush" Value="#FFD4E7FF"/>
<Setter Property="BorderThickness" Value="1"/>
</Style>
</ResourceDictionary>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- 工具栏区域 -->
<Border Grid.Row="0"
BorderBrush="#FFD4E7FF"
BorderThickness="0,0,0,1"
Background="#FFF8FBFF"
Padding="15,10">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- 左侧工具按钮 -->
<StackPanel Grid.Column="0" Orientation="Horizontal">
<Button Content="刷新"
Click="RefreshButton_Click"
Style="{StaticResource ActionButtonStyle}"
Margin="0,0,10,0"/>
<Button Content="清空日志"
Click="ClearLogButton_Click"
Style="{StaticResource SecondaryButtonStyle}"
Margin="0,0,10,0"/>
<Button Content="导出日志"
Click="ExportLogButton_Click"
Style="{StaticResource SecondaryButtonStyle}"
Margin="0,0,10,0"/>
<Button Content="路径文件操作"
Click="PathFileOperationsButton_Click"
Style="{StaticResource SecondaryButtonStyle}"
Margin="0,0,15,0"/>
<!-- 分隔线 -->
<Border Width="1"
Background="#FFD4E7FF"
Margin="0,2"/>
<!-- 自动滚动选项 -->
<CheckBox Content="自动滚动到底部"
Name="AutoScrollCheckBox"
IsChecked="True"
VerticalAlignment="Center"
Margin="15,0,0,0"/>
</StackPanel>
<!-- 右侧搜索区域 -->
<StackPanel Grid.Column="1" Orientation="Horizontal">
<Label Content="搜索:"
VerticalAlignment="Center"
Style="{StaticResource ParameterLabelStyle}"/>
<TextBox Name="SearchTextBox"
Width="200"
Style="{StaticResource SearchTextBoxStyle}"
TextChanged="SearchTextBox_TextChanged"
Margin="5,0,10,0"/>
<Button Content="清除"
Click="ClearSearchButton_Click"
Style="{StaticResource SecondaryButtonStyle}"/>
</StackPanel>
</Grid>
</Border>
<!-- 日志内容显示区域 -->
<Border Grid.Row="1"
BorderBrush="#FFD4E7FF"
BorderThickness="1,0,1,0"
Background="White"
Margin="15,0">
<TextBox Name="LogContentTextBox"
Style="{StaticResource LogTextBoxStyle}"/>
</Border>
<!-- 底部状态栏和按钮 -->
<Border Grid.Row="2"
BorderBrush="#FFD4E7FF"
BorderThickness="0,1,0,0"
Background="#FFF8FBFF"
Padding="15,10">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- 状态信息 -->
<StackPanel Grid.Column="0" Orientation="Horizontal">
<Label Name="StatusLabel"
Content="日志已加载"
Style="{StaticResource ParameterLabelStyle}"
Foreground="#FF2B8A2B"/>
<Label Name="LogSizeLabel"
Content="大小: 0 KB"
Style="{StaticResource ParameterLabelStyle}"
Margin="20,0,0,0"/>
<Label Name="LineCountLabel"
Content="行数: 0"
Style="{StaticResource ParameterLabelStyle}"
Margin="20,0,0,0"/>
</StackPanel>
<!-- 右侧按钮 -->
<StackPanel Grid.Column="1" Orientation="Horizontal">
<Button Content="关闭"
Click="CloseButton_Click"
Style="{StaticResource ActionButtonStyle}"/>
</StackPanel>
</Grid>
</Border>
</Grid>
</Window>