BililiveRecorder/BililiveRecorder.WPF/Pages/RoomListPage.xaml
2021-01-01 14:46:27 +08:00

107 lines
5.9 KiB
XML

<ui:Page
x:Class="BililiveRecorder.WPF.Pages.RoomListPage"
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:ui="http://schemas.modernwpf.com/2019"
xmlns:local="clr-namespace:BililiveRecorder.WPF.Pages"
xmlns:mock="clr-namespace:BililiveRecorder.WPF.MockData"
xmlns:c="clr-namespace:BililiveRecorder.WPF.Controls"
xmlns:converters="clr-namespace:BililiveRecorder.WPF.Converters"
mc:Ignorable="d"
d:DesignHeight="1000" d:DesignWidth="960"
d:DataContext="{d:DesignInstance mock:MockRecorder,IsDesignTimeCreatable=True}"
DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=local:RootPage},Path=DataContext.Recorder,Mode=OneWay}"
Title="房间列表">
<ui:Page.Resources>
<DataTemplate x:Key="NormalRoomCardTemplate">
<ui:ThemeShadowChrome IsShadowEnabled="True" Depth="10">
<c:RoomCard DeleteRequested="RoomCard_DeleteRequested" ShowSettingsRequested="RoomCard_ShowSettingsRequested" />
</ui:ThemeShadowChrome>
</DataTemplate>
<DataTemplate x:Key="AddRoomCardTemplate">
<ui:ThemeShadowChrome IsShadowEnabled="True" Depth="10">
<c:AddRoomCard AddRoomRequested="AddRoomCard_AddRoomRequested"/>
</ui:ThemeShadowChrome>
</DataTemplate>
<converters:NullValueTemplateSelector
x:Key="SelectorTemplate"
Normal="{StaticResource NormalRoomCardTemplate}"
Null="{StaticResource AddRoomCardTemplate}"/>
<ui:UniformGridLayout
x:Key="UniformGridLayout"
MinItemWidth="220"
MinItemHeight="100"
ItemsStretch="None"
MinRowSpacing="7"
MinColumnSpacing="5" />
</ui:Page.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition x:Name="RoomListRowDefinition" Height="*"/>
<RowDefinition Height="3"/>
<RowDefinition x:Name="LogRowDefinition" Height="0"/>
</Grid.RowDefinitions>
<Menu>
<Separator/>
<MenuItem Header="文件">
<MenuItem Header="打开工作目录" Click="MenuItem_OpenWorkDirectory_Click"/>
</MenuItem>
<MenuItem Header="监控">
<MenuItem Header="自动录制全部房间" Click="MenuItem_EnableAutoRecAll_Click"/>
<MenuItem Header="取消自动录制全部房间" Click="MenuItem_DisableAutoRecAll_Click"/>
</MenuItem>
<MenuItem Header="排序">
<MenuItem Header="不排序" Tag="{x:Static local:SortedBy.None}" Click="MenuItem_SortBy_Click"/>
<MenuItem Header="房间号" Tag="{x:Static local:SortedBy.RoomId}" Click="MenuItem_SortBy_Click"/>
<MenuItem Header="录制状态" Tag="{x:Static local:SortedBy.Status}" Click="MenuItem_SortBy_Click"/>
</MenuItem>
<MenuItem Header="日志">
<MenuItem Header="在本页显示日志" Click="MenuItem_ShowLog_Click"/>
<MenuItem Header="不在本页显示日志" Click="MenuItem_HideLog_Click"/>
</MenuItem>
</Menu>
<ui:ItemsRepeaterScrollHost Grid.Row="1">
<ScrollViewer>
<ui:ItemsRepeater
HorizontalAlignment="Stretch" Margin="8"
Layout="{StaticResource UniformGridLayout}"
ItemsSource="{Binding SortedRoomList, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ui:Page}}"
ItemTemplate="{StaticResource SelectorTemplate}" />
</ScrollViewer>
</ui:ItemsRepeaterScrollHost>
<GridSplitter Grid.Row="2" x:Name="Splitter" ResizeDirection="Rows" Visibility="Collapsed"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ShowsPreview="True"/>
<ui:ThemeShadowChrome Grid.Row="3" x:Name="LogElement" IsShadowEnabled="True" Depth="10" Margin="5" Visibility="Collapsed"
DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=local:RootPage},Path=DataContext.Logs,Mode=OneWay}">
<Border Background="{DynamicResource SystemControlBackgroundAltHighBrush}"
BorderBrush="{DynamicResource SystemControlBackgroundAccentBrush}"
BorderThickness="1" CornerRadius="5">
<ItemsControl ItemsSource="{Binding Mode=OneWay}" Margin="5" ToolTip="右键点击可以复制单行日志">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border BorderThickness="0,0,0,1" BorderBrush="#FFCCCCCC">
<TextBlock Text="{Binding Mode=OneWay}" TextWrapping="Wrap" MouseRightButtonUp="TextBlock_Copy_MouseRightButtonUp"/>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.Template>
<ControlTemplate>
<ScrollViewer Loaded="Log_ScrollViewer_Loaded" CanContentScroll="True">
<ItemsPresenter/>
</ScrollViewer>
</ControlTemplate>
</ItemsControl.Template>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel IsItemsHost="True"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</Border>
</ui:ThemeShadowChrome>
</Grid>
</ui:Page>