BililiveRecorder/BililiveRecorder.WPF/Pages/RoomListPage.xaml

121 lines
7.2 KiB
Plaintext
Raw Normal View History

2020-11-27 18:51:02 +08:00
<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"
2021-01-03 13:21:36 +08:00
xmlns:l="https://github.com/XAMLMarkupExtensions/WPFLocalizationExtension"
2021-01-03 18:37:47 +08:00
l:LocalizeDictionary.DesignCulture=""
l:ResxLocalizationProvider.DefaultAssembly="BililiveRecorder.WPF"
l:ResxLocalizationProvider.DefaultDictionary="Strings"
2020-11-27 18:51:02 +08:00
xmlns:local="clr-namespace:BililiveRecorder.WPF.Pages"
xmlns:mock="clr-namespace:BililiveRecorder.WPF.MockData"
xmlns:controls="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">
2020-11-28 05:39:56 +08:00
<controls:RoomCard DeleteRequested="RoomCard_DeleteRequested" />
2020-11-27 18:51:02 +08:00
</ui:ThemeShadowChrome>
</DataTemplate>
<DataTemplate x:Key="AddRoomCardTemplate">
<ui:ThemeShadowChrome IsShadowEnabled="True" Depth="10">
2020-11-28 05:39:56 +08:00
<controls:AddRoomCard AddRoomRequested="AddRoomCard_AddRoomRequested"/>
2020-11-27 18:51:02 +08:00
</ui:ThemeShadowChrome>
</DataTemplate>
<converters:NullValueTemplateSelector
x:Key="SelectorTemplate"
Normal="{StaticResource NormalRoomCardTemplate}"
Null="{StaticResource AddRoomCardTemplate}"/>
<ui:UniformGridLayout
x:Key="UniformGridLayout"
2020-12-10 17:02:56 +08:00
MinItemWidth="220"
MinItemHeight="100"
ItemsStretch="None"
2020-11-27 18:51:02 +08:00
MinRowSpacing="7"
MinColumnSpacing="5" />
</ui:Page.Resources>
2020-12-05 18:30:04 +08:00
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition x:Name="RoomListRowDefinition" Height="*"/>
<RowDefinition Height="3"/>
<RowDefinition x:Name="LogRowDefinition" Height="0"/>
</Grid.RowDefinitions>
<Menu>
2021-01-03 13:21:36 +08:00
<Separator/>
<MenuItem>
<MenuItem.Header>
<ui:PathIcon Width="20" Height="20" Style="{StaticResource PathIconDataTranslate}"/>
</MenuItem.Header>
<MenuItem Header="简体中文" CommandParameter="" Command="{Binding Source={x:Static l:LocalizeDictionary.Instance}, Path=SetCultureCommand}" />
<MenuItem Header="繁體中文" CommandParameter="zh-Hant" Command="{Binding Source={x:Static l:LocalizeDictionary.Instance}, Path=SetCultureCommand}" />
<MenuItem Header="日本語" CommandParameter="ja" Command="{Binding Source={x:Static l:LocalizeDictionary.Instance}, Path=SetCultureCommand}" />
<MenuItem Header="English" CommandParameter="en" Command="{Binding Source={x:Static l:LocalizeDictionary.Instance}, Path=SetCultureCommand}" />
</MenuItem>
2020-12-05 18:30:04 +08:00
<Separator/>
2021-01-03 18:37:47 +08:00
<MenuItem Header="{l:Loc RoomListPage_Menu_File}">
<MenuItem Header="{l:Loc RoomListPage_Menu_File_OpenWorkDirectory}" Click="MenuItem_OpenWorkDirectory_Click"/>
2020-12-10 17:02:56 +08:00
</MenuItem>
2021-01-03 18:37:47 +08:00
<MenuItem Header="{l:Loc RoomListPage_Menu_AutoRecord}">
<MenuItem Header="{l:Loc RoomListPage_Menu_AutoRecord_EnableAll}" Click="MenuItem_EnableAutoRecAll_Click"/>
<MenuItem Header="{l:Loc RoomListPage_Menu_AutoRecord_DisableAll}" Click="MenuItem_DisableAutoRecAll_Click"/>
2020-12-05 18:30:04 +08:00
</MenuItem>
2021-01-03 18:37:47 +08:00
<MenuItem Header="{l:Loc RoomListPage_Menu_Sort}">
<MenuItem Header="{l:Loc RoomListPage_Menu_Sort_Default}" Tag="{x:Static local:SortedBy.None}" Click="MenuItem_SortBy_Click"/>
<MenuItem Header="{l:Loc RoomListPage_Menu_Sort_RoomId}" Tag="{x:Static local:SortedBy.RoomId}" Click="MenuItem_SortBy_Click"/>
<MenuItem Header="{l:Loc RoomListPage_Menu_Sort_Status}" Tag="{x:Static local:SortedBy.Status}" Click="MenuItem_SortBy_Click"/>
2020-12-05 18:30:04 +08:00
</MenuItem>
2021-01-03 18:37:47 +08:00
<MenuItem Header="{l:Loc RoomListPage_Menu_Log}">
<MenuItem Header="{l:Loc RoomListPage_Menu_Log_Show}" Click="MenuItem_ShowLog_Click"/>
<MenuItem Header="{l:Loc RoomListPage_Menu_Log_Hide}" Click="MenuItem_HideLog_Click"/>
2020-12-05 18:30:04 +08:00
</MenuItem>
</Menu>
<ui:ItemsRepeaterScrollHost Grid.Row="1">
<ScrollViewer>
<ui:ItemsRepeater
2020-11-27 18:51:02 +08:00
HorizontalAlignment="Stretch" Margin="8"
Layout="{StaticResource UniformGridLayout}"
2020-12-05 18:30:04 +08:00
ItemsSource="{Binding SortedRoomList, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ui:Page}}"
2020-11-27 18:51:02 +08:00
ItemTemplate="{StaticResource SelectorTemplate}" />
2020-12-05 18:30:04 +08:00
</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">
2021-01-03 18:37:47 +08:00
<ItemsControl ItemsSource="{Binding Mode=OneWay}" Margin="5" ToolTip="{l:Loc LogPage_RightClickCopyToolTip}">
2020-12-05 18:30:04 +08:00
<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>
2020-11-27 18:51:02 +08:00
</ui:Page>