145 lines
5.9 KiB
XML
145 lines
5.9 KiB
XML
<UserControl x:Class="DesktopBot.Views.LiveLogView"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:models="clr-namespace:DesktopBot.Models"
|
|
mc:Ignorable="d">
|
|
|
|
<Grid Background="{StaticResource BackgroundDarkBrush}">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="*"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- HEADER -->
|
|
<Grid Grid.Row="0" Margin="24,20,24,0">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
|
|
<TextBlock Text="Live Log" Style="{StaticResource SectionTitle}" Margin="0"/>
|
|
<!-- Indicatore "In ascolto" -->
|
|
<Border Background="#1A00E676" BorderBrush="{StaticResource AccentGreenBrush}"
|
|
BorderThickness="1" CornerRadius="4" Padding="8,3" Margin="12,0,0,0"
|
|
VerticalAlignment="Center">
|
|
<StackPanel Orientation="Horizontal">
|
|
<Ellipse Width="7" Height="7" Fill="{StaticResource AccentGreenBrush}"
|
|
Margin="0,0,6,0" VerticalAlignment="Center"/>
|
|
<TextBlock Text="IN ASCOLTO" Foreground="{StaticResource AccentGreenBrush}"
|
|
FontFamily="Segoe UI" FontSize="10" FontWeight="Bold" VerticalAlignment="Center"/>
|
|
</StackPanel>
|
|
</Border>
|
|
</StackPanel>
|
|
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
|
|
<Button Content="📋 Copia"
|
|
Command="{Binding CopyLogsCommand}"
|
|
Style="{StaticResource OutlineButton}"
|
|
Padding="14,7"
|
|
Margin="0,0,8,0"
|
|
VerticalAlignment="Center"
|
|
ToolTip="Copia tutti i log negli appunti"/>
|
|
<Button Content="🗑 Pulisci Log"
|
|
Command="{Binding ClearLogsCommand}"
|
|
Style="{StaticResource OutlineButton}"
|
|
Padding="14,7"
|
|
VerticalAlignment="Center"/>
|
|
</StackPanel>
|
|
</Grid>
|
|
|
|
<!-- Sottotitolo -->
|
|
<TextBlock Grid.Row="1" Margin="24,8,24,0"
|
|
Text="{Binding Logs.Count, StringFormat='Voci nel log: {0}'}"
|
|
Style="{StaticResource LabelSecondary}"/>
|
|
|
|
<!-- LOG LIST -->
|
|
<Border Grid.Row="2" Margin="24,14,24,20"
|
|
Background="{StaticResource BackgroundPanelBrush}"
|
|
BorderBrush="{StaticResource BorderBrush}"
|
|
BorderThickness="1" CornerRadius="8" Padding="0">
|
|
<ListView x:Name="LogListView"
|
|
Style="{StaticResource LogListView}"
|
|
ItemsSource="{Binding Logs}"
|
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
|
BorderThickness="0"
|
|
Background="Transparent">
|
|
<ListView.ItemContainerStyle>
|
|
<Style TargetType="ListViewItem">
|
|
<Setter Property="Background" Value="Transparent"/>
|
|
<Setter Property="BorderThickness" Value="0"/>
|
|
<Setter Property="Padding" Value="16,6"/>
|
|
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
|
<Style.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="Background" Value="{StaticResource NavActiveBrush}"/>
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</ListView.ItemContainerStyle>
|
|
<ListView.ItemTemplate>
|
|
<DataTemplate DataType="{x:Type models:BotLogEntry}">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="130"/>
|
|
<ColumnDefinition Width="80"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
<TextBlock Grid.Column="0"
|
|
Text="{Binding Timestamp, StringFormat='HH:mm:ss dd/MM'}"
|
|
Foreground="{StaticResource TextSecondaryBrush}"
|
|
FontFamily="Consolas" FontSize="11" VerticalAlignment="Center"/>
|
|
<Border Grid.Column="1" CornerRadius="3" Padding="6,2"
|
|
Margin="0,0,12,0" HorizontalAlignment="Left" VerticalAlignment="Center">
|
|
<Border.Style>
|
|
<Style TargetType="Border">
|
|
<Setter Property="Background" Value="#FF3A3A4A"/>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding Level}" Value="Success">
|
|
<Setter Property="Background" Value="#1A00E676"/>
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding Level}" Value="Error">
|
|
<Setter Property="Background" Value="#1AFF1744"/>
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding Level}" Value="Warning">
|
|
<Setter Property="Background" Value="#1AFFC107"/>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</Border.Style>
|
|
<TextBlock Text="{Binding Level}"
|
|
FontFamily="Consolas" FontSize="10" FontWeight="Bold"
|
|
VerticalAlignment="Center">
|
|
<TextBlock.Style>
|
|
<Style TargetType="TextBlock">
|
|
<Setter Property="Foreground" Value="{StaticResource TextSecondaryBrush}"/>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding Level}" Value="Success">
|
|
<Setter Property="Foreground" Value="{StaticResource AccentGreenBrush}"/>
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding Level}" Value="Error">
|
|
<Setter Property="Foreground" Value="{StaticResource AccentRedBrush}"/>
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding Level}" Value="Warning">
|
|
<Setter Property="Foreground" Value="#FFFFC107"/>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</TextBlock.Style>
|
|
</TextBlock>
|
|
</Border>
|
|
<TextBlock Grid.Column="2"
|
|
Text="{Binding Message}"
|
|
Foreground="{StaticResource TextPrimaryBrush}"
|
|
FontFamily="Consolas" FontSize="12"
|
|
TextTrimming="CharacterEllipsis"
|
|
VerticalAlignment="Center"/>
|
|
</Grid>
|
|
</DataTemplate>
|
|
</ListView.ItemTemplate>
|
|
</ListView>
|
|
</Border>
|
|
</Grid>
|
|
</UserControl>
|