LogsPage.xaml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <Page x:Class="ClashDotNetFramework.Pages.LogsPage"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:ClashDotNetFramework.Pages"
  7. xmlns:items="clr-namespace:ClashDotNetFramework.Models.Items"
  8. xmlns:converters="clr-namespace:ClashDotNetFramework.Models.Converters"
  9. xmlns:emoji="clr-namespace:Emoji.Wpf;assembly=Emoji.Wpf"
  10. mc:Ignorable="d" FontSize="14" Loaded="LogsPage_Load" Unloaded="LogsPage_Unloaded"
  11. d:DesignHeight="750" d:DesignWidth="780"
  12. Title="LogsPage">
  13. <Page.Resources>
  14. <converters:LevelToColorConverter x:Key="LevelToColorConverter"/>
  15. <Style x:Key="ButtonStyle" TargetType="Button">
  16. <Setter Property="Cursor" Value="Hand"/>
  17. <Setter Property="Width" Value="100"/>
  18. <Setter Property="Height" Value="40"/>
  19. <Setter Property="Foreground" Value="White"/>
  20. <Setter Property="Template">
  21. <Setter.Value>
  22. <ControlTemplate TargetType="Button">
  23. <Border CornerRadius="2" Background="{TemplateBinding Background}">
  24. <ContentPresenter x:Name="ContentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  25. </Border>
  26. </ControlTemplate>
  27. </Setter.Value>
  28. </Setter>
  29. </Style>
  30. <DataTemplate x:Key="LogItemTemplate" DataType="items:LogItem">
  31. <Grid>
  32. <Grid.RowDefinitions>
  33. <!-- Time & Level Label -->
  34. <RowDefinition/>
  35. <!-- PayLoad Label -->
  36. <RowDefinition/>
  37. </Grid.RowDefinitions>
  38. <!-- Time & Level Label -->
  39. <StackPanel
  40. Orientation="Horizontal">
  41. <!-- Time Label -->
  42. <Border
  43. CornerRadius="2"
  44. Background="{DynamicResource BorderBackground}"
  45. Padding="8,4">
  46. <TextBlock
  47. Text="{Binding Time}"
  48. Foreground="White"/>
  49. </Border>
  50. <!-- Level Label -->
  51. <Border
  52. CornerRadius="2"
  53. Background="{Binding Level, Converter={StaticResource LevelToColorConverter}}"
  54. Padding="8,4"
  55. Margin="5,0,0,0">
  56. <TextBlock
  57. Text="{Binding Level}"
  58. Foreground="White"/>
  59. </Border>
  60. </StackPanel>
  61. <!-- PayLoad Label -->
  62. <emoji:TextBlock
  63. Grid.Row="1"
  64. Foreground="{DynamicResource NormalTextForeground}"
  65. Text="{Binding PayLoad}"
  66. TextTrimming="CharacterEllipsis"
  67. Margin="0,5,0,10"/>
  68. </Grid>
  69. </DataTemplate>
  70. </Page.Resources>
  71. <Grid>
  72. <Grid.RowDefinitions>
  73. <!-- Page Title -->
  74. <RowDefinition Height="100"/>
  75. <!-- Logs ListView -->
  76. <RowDefinition/>
  77. </Grid.RowDefinitions>
  78. <!-- Page Title & Action Buttons -->
  79. <Grid>
  80. <Grid.ColumnDefinitions>
  81. <!-- Page Title -->
  82. <ColumnDefinition/>
  83. <!-- Action Buttons -->
  84. <ColumnDefinition Width="Auto"/>
  85. </Grid.ColumnDefinitions>
  86. <!-- Page Title -->
  87. <StackPanel
  88. VerticalAlignment="Center"
  89. Margin="20,0,0,0">
  90. <TextBlock
  91. Text="{DynamicResource Logs}"
  92. FontSize="24"
  93. Foreground="{DynamicResource NormalTextForeground}"/>
  94. <TextBlock
  95. Text="Mode: Rule"
  96. Foreground="{DynamicResource NormalTextForeground}"
  97. x:Name="CurrentMode"
  98. Margin="0,10,0,0"/>
  99. </StackPanel>
  100. <!-- Action Buttons -->
  101. <Grid
  102. Grid.Column="1"
  103. Height="40"
  104. Margin="0,0,20,0">
  105. <Grid.ColumnDefinitions>
  106. <!-- Clear Button -->
  107. <ColumnDefinition/>
  108. <!-- Stop Button -->
  109. <ColumnDefinition/>
  110. </Grid.ColumnDefinitions>
  111. <!-- Clear Button -->
  112. <Button
  113. Style="{StaticResource ButtonStyle}"
  114. Background="#2CA51D"
  115. Content="{DynamicResource Clear}"
  116. Click="ClearButton_Click"/>
  117. <!-- Status Toggle Button -->
  118. <Button
  119. Grid.Column="1"
  120. Style="{StaticResource ButtonStyle}"
  121. Background="#F56363"
  122. Content="{DynamicResource Stop}"
  123. Click="StatusButton_Click"
  124. Margin="10,0,0,0"
  125. x:Name="StatusButton"/>
  126. </Grid>
  127. </Grid>
  128. <Separator
  129. VerticalAlignment="Bottom"
  130. Background="{DynamicResource SeparatorBackground}"/>
  131. <!-- Profile ListView -->
  132. <Grid
  133. Grid.Row="1"
  134. Margin="14,5,14,20">
  135. <ListView
  136. Background="Transparent"
  137. BorderBrush="Transparent"
  138. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  139. ScrollViewer.VerticalScrollBarVisibility="Hidden"
  140. ItemTemplate="{StaticResource LogItemTemplate}"
  141. x:Name="LogItemListView"/>
  142. </Grid>
  143. </Grid>
  144. </Page>