BililiveRecorder/BililiveRecorder.WPF/Controls/RoomCard.xaml

135 lines
9.4 KiB
Plaintext
Raw Normal View History

2020-11-27 18:51:02 +08:00
<UserControl
x:Class="BililiveRecorder.WPF.Controls.RoomCard"
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.Controls"
xmlns:mock="clr-namespace:BililiveRecorder.WPF.MockData"
xmlns:m="clr-namespace:BililiveRecorder.WPF.Models"
2020-11-27 18:51:02 +08:00
xmlns:pages="clr-namespace:BililiveRecorder.WPF.Pages"
2020-12-10 17:02:56 +08:00
d:DesignWidth="220" d:DesignHeight="110"
2020-11-27 18:51:02 +08:00
d:DataContext="{d:DesignInstance Type=mock:MockRecordedRoom,IsDesignTimeCreatable=True}"
mc:Ignorable="d">
<UserControl.Resources>
<ContextMenu x:Key="CopyTextContextMenu" DataContext="{Binding RelativeSource={RelativeSource Mode=Self},Path=PlacementTarget}">
<MenuItem Header="复制" Command="{x:Static m:Commands.Copy}" CommandParameter="{Binding Text}"/>
</ContextMenu>
</UserControl.Resources>
2020-11-28 05:39:56 +08:00
<Border Background="{DynamicResource SystemControlBackgroundAltHighBrush}"
BorderBrush="{DynamicResource SystemControlBackgroundAccentBrush}"
BorderThickness="1"
CornerRadius="5">
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="2*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.8*"/>
<ColumnDefinition Width="1.1*"/>
<ColumnDefinition Width="0.65*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.ColumnSpan="3" VerticalAlignment="Center" Margin="5,0,0,0"
2020-11-27 18:51:02 +08:00
Style="{DynamicResource SubtitleTextBlockStyle}"
TextWrapping="NoWrap" TextTrimming="CharacterEllipsis"
FontFamily="Microsoft Yahei" ContextMenu="{StaticResource CopyTextContextMenu}"
Text="{Binding StreamerName,Mode=OneWay}" ToolTip="{Binding StreamerName,Mode=OneWay}"/>
2020-12-10 17:02:56 +08:00
<Menu Grid.Row="1" Grid.Column="3" VerticalAlignment="Center" HorizontalAlignment="Right">
2020-11-28 05:39:56 +08:00
<MenuItem ToolTip="操作">
<MenuItem.Header>
2020-12-10 17:02:56 +08:00
<ui:PathIcon Height="20" Width="20" Style="{StaticResource PathIconDataDotsVertical}"/>
2020-11-28 05:39:56 +08:00
</MenuItem.Header>
<MenuItem Header="开始录制" Click="MenuItem_StartRecording_Click">
<MenuItem.Icon>
2020-12-10 17:02:56 +08:00
<ui:PathIcon Style="{StaticResource PathIconDataPlayCircleOutline}"/>
2020-11-28 05:39:56 +08:00
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="停止录制" Click="MenuItem_StopRecording_Click">
<MenuItem.Icon>
2020-12-10 17:02:56 +08:00
<ui:PathIcon Style="{StaticResource PathIconDataStopCircleOutline}"/>
2020-11-28 05:39:56 +08:00
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="刷新直播间信息" Click="MenuItem_RefreshInfo_Click">
<MenuItem.Icon>
2020-12-10 17:02:56 +08:00
<ui:PathIcon Style="{StaticResource PathIconDataRefresh}"/>
2020-11-28 05:39:56 +08:00
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="打开直播间页面" Click="MenuItem_OpenInBrowser_Click">
<MenuItem.Icon>
<ui:PathIcon Style="{StaticResource PathIconDataOpenInNew}"/>
</MenuItem.Icon>
</MenuItem>
2020-11-28 05:39:56 +08:00
<Separator/>
<ui:RadioMenuItem Header="自动录制" GroupName="自动录制" IsChecked="{Binding IsMonitoring,Mode=OneWay}" Click="MenuItem_StartMonitor_Click">
<ui:RadioMenuItem.Icon>
2020-12-10 17:02:56 +08:00
<ui:PathIcon Foreground="Orange" Style="{StaticResource PathIconDataCctv}"/>
2020-11-28 05:39:56 +08:00
</ui:RadioMenuItem.Icon>
</ui:RadioMenuItem>
2020-12-10 17:02:56 +08:00
<ui:RadioMenuItem Header="不自动录制" GroupName="自动录制" IsChecked="{Binding IsMonitoring,Mode=OneWay,Converter={StaticResource BooleanInverterConverter}}" Click="MenuItem_StopMonitor_Click"/>
2020-11-28 05:39:56 +08:00
<Separator/>
<MenuItem Header="删除房间" Click="MenuItem_DeleteRoom_Click">
<MenuItem.Icon>
2020-12-10 17:02:56 +08:00
<ui:PathIcon Foreground="DarkRed" Style="{StaticResource PathIconDataDelete}"/>
2020-11-28 05:39:56 +08:00
</MenuItem.Icon>
</MenuItem>
2020-11-27 18:51:02 +08:00
</MenuItem>
2020-11-28 05:39:56 +08:00
</Menu>
<StackPanel VerticalAlignment="Center" Orientation="Horizontal" Grid.Row="1" Grid.ColumnSpan="2" Margin="5,0,0,0">
<ui:PathIcon Height="10" Margin="0,0,5,0" Style="{StaticResource PathIconDataAccessPoint}"
Foreground="{Binding IsStreaming,Converter={StaticResource BooleanToLiveStatusColorBrushConverter}}"
ToolTip="{Binding IsStreaming,Converter={StaticResource BooleanToLiveStatusTooltipConverter}}"/>
2020-12-10 17:02:56 +08:00
<ui:PathIcon Height="10" Style="{StaticResource PathIconDataUpperCaseIdentifier}" />
<TextBlock Text="{Binding RoomId, StringFormat=\{0\},Mode=OneWay}" ContextMenu="{StaticResource CopyTextContextMenu}" Margin="4,0"/>
2020-12-10 17:02:56 +08:00
<ui:PathIcon Height="10" Style="{StaticResource PathIconDataLowerCaseIdentifier}" Margin="3,0"
Visibility="{Binding ShortRoomId,Converter={StaticResource ShortRoomIdToVisibilityConverter}}"/>
<TextBlock Text="{Binding ShortRoomId, StringFormat=\{0\},Mode=OneWay}" ContextMenu="{StaticResource CopyTextContextMenu}"
2020-12-10 17:02:56 +08:00
Visibility="{Binding ShortRoomId,Converter={StaticResource ShortRoomIdToVisibilityConverter}}"/>
2020-11-28 05:39:56 +08:00
</StackPanel>
<Border Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" Visibility="{Binding Visibility, ElementName=RecordingIcon}"
2020-11-27 18:51:02 +08:00
Background="{Binding DownloadSpeedPersentage, Converter={StaticResource PercentageToColorBrushConverter},Mode=OneWay}"
2020-11-28 05:39:56 +08:00
BorderThickness="1" BorderBrush="{DynamicResource SystemControlBackgroundChromeBlackMediumBrush}" Margin="2,0" CornerRadius="5">
<Border.ToolTip>
<StackPanel>
2020-12-10 17:02:56 +08:00
<TextBlock Margin="0,0,0,5" Text="{Binding DownloadSpeedPersentage,StringFormat=当前速度比: 0.## %,Mode=OneWay}"/>
2020-11-28 05:39:56 +08:00
<TextBlock Text="录制的速度与质量"/>
<TextBlock Text="绿色为良好,红色为差"/>
</StackPanel>
</Border.ToolTip>
<TextBlock HorizontalAlignment="Center" Foreground="Black" Text="{Binding DownloadSpeedMegaBitps, StringFormat=0.## Mbps,Mode=OneWay}"/>
</Border>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal" Grid.Row="2" Grid.Column="0">
<StackPanel.Visibility>
2020-12-10 17:02:56 +08:00
<MultiBinding Converter="{StaticResource MultiBoolToVisibilityCollapsedConverter}" Mode="OneWay">
<Binding Path="IsRecording" Converter="{StaticResource BooleanInverterConverter}" Mode="OneWay"/>
2020-11-28 05:39:56 +08:00
<Binding Path="IsMonitoring" Mode="OneWay"/>
</MultiBinding>
</StackPanel.Visibility>
2020-12-10 17:02:56 +08:00
<ui:PathIcon Style="{StaticResource PathIconDataCctv}" Foreground="DarkOrange" Width="15"/>
2020-11-28 05:39:56 +08:00
<TextBlock Foreground="DarkOrange" Margin="3,0,0,0" Text="监控中"/>
</StackPanel>
2020-12-10 17:02:56 +08:00
<StackPanel x:Name="RecordingIcon" Visibility="{Binding IsRecording, Converter={StaticResource BooleanToVisibilityCollapsedConverter},Mode=OneWay}"
2020-11-27 18:51:02 +08:00
VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal" Grid.Row="2" Grid.Column="0">
2020-12-10 17:02:56 +08:00
<ui:PathIcon Style="{StaticResource PathIconDataRecordRec}" Foreground="Red" Width="15"/>
2020-11-28 05:39:56 +08:00
<TextBlock Foreground="Red" Margin="3,0,0,0" Text="录制中"/>
</StackPanel>
<Button Grid.Column="2" Grid.Row="2" Padding="3,1" HorizontalAlignment="Right" Margin="5,0" ToolTip="回放剪辑(正在处理中的数量)" Click="Button_Clip_Click">
<Button.Visibility>
2020-12-10 17:02:56 +08:00
<MultiBinding Converter="{StaticResource MultiBoolToVisibilityCollapsedConverter}" Mode="OneWay">
2020-11-28 05:39:56 +08:00
<Binding Path="IsRecording" Mode="OneWay"/>
<Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType=pages:RootPage}"
2020-11-27 18:51:02 +08:00
Path="DataContext.Recorder.Config.EnabledFeature" Mode="OneWay"
Converter="{StaticResource ClipEnabledToBooleanConverter}"/>
2020-11-28 05:39:56 +08:00
</MultiBinding>
</Button.Visibility>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
2020-12-10 17:02:56 +08:00
<ui:PathIcon Width="10" Style="{StaticResource PathIconDataContentCut}"/>
2020-11-28 05:39:56 +08:00
<TextBlock VerticalAlignment="Center" Margin="2,0,0,2" Text="{Binding Processor.Clips.Count,FallbackValue=(-),StringFormat=({0}),Mode=OneWay}"/>
</StackPanel>
</Button>
</Grid>
</Border>
2020-11-27 18:51:02 +08:00
</UserControl>