alielie
2026-09-10 9ec80cafc23f5ee3278cacce3c9f86f4087b435a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<UserControl x:Class="OpenTapEditor.LogControl"
             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:OpenTapEditor.UI"
             mc:Ignorable="d" 
             xmlns:pu="https://opensource.panuon.com/wpf-ui"
             d:DesignHeight="450" d:DesignWidth="800" Cursor="">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <pu:StyleDictionary Includes="TextBox" />
            </ResourceDictionary.MergedDictionaries>
            <CollectionViewSource x:Key="LogFilter" Source="{Binding Datasouruce}" Filter="CollectionViewSource_Filter">
 
            </CollectionViewSource>
        </ResourceDictionary>
    </UserControl.Resources>
 
    <Border Grid.Row="5" Background="White" BorderBrush="{StaticResource BorderDarkBrush}" BorderThickness="1">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="26"/>
                <RowDefinition Height="28"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
 
            <Border Grid.Row="0" Background="#E8E8E8"
                 BorderBrush="{StaticResource BorderBrush}" BorderThickness="0,0,0,1">
                <TextBlock Text="{DynamicResource 日志}" FontWeight="Bold" FontSize="11"
                        VerticalAlignment="Center" Margin="4,0"/>
            </Border>
 
            <Border Grid.Row="1" Background="{StaticResource BgBrush}"
                 BorderBrush="{StaticResource BorderBrush}" BorderThickness="0,0,0,1">
                <StackPanel Orientation="Horizontal" Margin="4,0">
                    <ToggleButton Content="{DynamicResource 错误}" Height="22" Padding="8,0" Cursor="Hand"
                         IsChecked="{Binding ShowError,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                         Background="#FFEBEE" Foreground="{StaticResource ErrorBrush}"
                         BorderBrush="{StaticResource ErrorBrush}" BorderThickness="1" FontSize="10"/>
                    <ToggleButton Content="{DynamicResource 警告}" Height="22" Padding="8,0" Margin="2,0,0,0" Cursor="Hand"
                         IsChecked="{Binding ShowWarn,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                         Background="#FFF8E1" Foreground="{StaticResource WarningBrush}"
                         BorderBrush="{StaticResource WarningBrush}" BorderThickness="1" FontSize="10"/>
                    <ToggleButton Content="{DynamicResource 信息}" Height="22" Padding="8,0" Margin="2,0,0,0" Cursor="Hand"
                         IsChecked="{Binding ShowInfo,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                         Background="#E8F5E9" Foreground="{StaticResource SuccessBrush}"
                         BorderBrush="{StaticResource SuccessBrush}" BorderThickness="1" FontSize="10"/>
                    <ToggleButton Content="{DynamicResource 调试}" Height="22" Padding="8,0" Margin="2,0,0,0" Cursor="Hand"
                         IsChecked="{Binding ShowDebug,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                         Background="White" BorderBrush="{StaticResource BorderBrush}"
                         BorderThickness="1" FontSize="10"/>
                    <ToggleButton Content="{DynamicResource 全部}" Height="22" Padding="8,0" Margin="2,0,0,0" Cursor="Hand"
                         IsChecked="{Binding ShowAll,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                         Background="White" BorderBrush="{StaticResource BorderBrush}"
                         BorderThickness="1" FontSize="10"/>
 
                    <Rectangle Width="1" Height="20" Fill="{StaticResource BorderBrush}" Margin="6,0"/>
 
                    <TextBlock Text="{DynamicResource 搜索}" VerticalAlignment="Center" Margin="8,0,4,0" FontSize="11"/>
                    <TextBox Width="150" Height="22" 
                             pu:TextBoxHelper.ClearButtonVisibility="VisibleOnHoverAndNonnull"
                             Text="{Binding SearchText,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center"/>
 
                    <Button Style="{StaticResource ActionButtonStyle}" Content="{DynamicResource 清空}" Click="Button_Click" 
                            Margin="8,0,0,0" Padding="8,0"/>
                </StackPanel>
            </Border>
 
            <ListView x:Name="log" Grid.Row="2" ScrollViewer.HorizontalScrollBarVisibility="Disabled" BorderThickness="0"
          VirtualizingPanel.ScrollUnit="Pixel" 
          ItemsSource="{Binding ViewSource.View}">
                <ListView.Resources>
                    <Style TargetType="TextBlock">
                        <Setter Property="TextWrapping" Value="Wrap"/>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Type}" Value="10">
                                <Setter Property="Foreground" Value="Red"/>
                            </DataTrigger>
                            <DataTrigger Binding="{Binding Type}" Value="20">
                                <Setter Property="Foreground" Value="OrangeRed"/>
                            </DataTrigger>
                            <DataTrigger Binding="{Binding Type}" Value="40">
                                <Setter Property="Foreground" Value="Gray"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </ListView.Resources>
            </ListView>
 
            <Border x:Name="resultShow" Margin="0,50,0,50" Grid.Row="2" Visibility="Collapsed">
                <Label VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
                       FontSize="50" x:Name="resultLabel"/>
            </Border>
        </Grid>
    </Border>
 
    <!--<Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
            <CheckBox VerticalAlignment="Center" VerticalContentAlignment="Center" IsChecked="{Binding ShowError,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Content="错误"/>
            <CheckBox VerticalAlignment="Center" VerticalContentAlignment="Center" IsChecked="{Binding ShowWarn,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Content="警告"/>
            <CheckBox VerticalAlignment="Center" VerticalContentAlignment="Center" IsChecked="{Binding ShowInfo,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Content="信息"/>
            <CheckBox VerticalAlignment="Center" VerticalContentAlignment="Center" IsChecked="{Binding ShowDebug,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Content="调试"/>
            <Button VerticalAlignment="Center" VerticalContentAlignment="Center" Click="Button_Click">清空</Button>
        </StackPanel>
        <ListView x:Name="log" Grid.Row="1" ScrollViewer.HorizontalScrollBarVisibility="Disabled" 
                  VirtualizingPanel.ScrollUnit="Pixel" 
                  ItemsSource="{Binding ViewSource.View}">
            <ListView.Resources>
                <Style TargetType="TextBlock">
                    <Setter Property="TextWrapping" Value="Wrap"/>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Type}" Value="10">
                            <Setter Property="Foreground" Value="Red"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Type}" Value="20">
                            <Setter Property="Foreground" Value="OrangeRed"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Type}" Value="40">
                            <Setter Property="Foreground" Value="Gray"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </ListView.Resources>
            -->
    <!--<ListView.ItemContainerStyle>
                <Style TargetType="ListViewItem">
                    <Setter Property="Foreground" Value="Red"/>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <Texy BorderThickness="0" IsReadOnly="True"
                                         TextWrapping="Wrap" Text="{Binding Mode=OneWay}"/>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Type,RelativeSource={RelativeSource Self}}" Value="10">
                            <Setter Property="Foreground" Value="Red"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Type,RelativeSource={RelativeSource Self}}" Value="20">
                            <Setter Property="Foreground" Value="OrangeRed"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Type,RelativeSource={RelativeSource Self}}" Value="40">
                            <Setter Property="Foreground" Value="Gray"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </ListView.ItemContainerStyle>-->
    <!--
        </ListView>
    </Grid>-->
</UserControl>