BililiveRecorder/BililiveRecorder.WPF/Controls/TaskbarIconControl.xaml

90 lines
6.2 KiB
XML

<UserControl
x:Class="BililiveRecorder.WPF.Controls.TaskbarIconControl"
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:l="https://github.com/XAMLMarkupExtensions/WPFLocalizationExtension"
l:LocalizeDictionary.DesignCulture=""
l:ResxLocalizationProvider.DefaultAssembly="BililiveRecorder.WPF"
l:ResxLocalizationProvider.DefaultDictionary="Strings"
xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:local="clr-namespace:BililiveRecorder.WPF.Controls"
xmlns:core="clr-namespace:BililiveRecorder.Core;assembly=BililiveRecorder.Core"
mc:Ignorable="d">
<tb:TaskbarIcon
x:Name="TaskbarIcon" TrayLeftMouseUp="TaskbarIcon_TrayLeftMouseUp"
Visibility="{Binding Recorder, Converter={StaticResource IsNullToVisibilityCollapsedConverter}}"
ToolTipText="{l:Loc TaskbarIconControl_Title}" MenuActivation="RightClick"
>
<tb:TaskbarIcon.ContextMenu>
<ContextMenu l:ResxLocalizationProvider.DefaultDictionary="Strings">
<MenuItem Header="{l:Loc TaskbarIconControl_MenuItem_OpenMainWindow}" Click="MenuItem_OpenMainWindow_Click"/>
<Separator/>
<MenuItem Header="{l:Loc Global_Quit}" Click="MenuItem_Quit_Click"/>
</ContextMenu>
</tb:TaskbarIcon.ContextMenu>
<tb:TaskbarIcon.TrayToolTip>
<Border
Background="{DynamicResource SystemControlBackgroundAltHighBrush}"
BorderBrush="{DynamicResource SystemControlBackgroundAccentBrush}"
MinWidth="260"
BorderThickness="2"
CornerRadius="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Margin="10">
<TextBlock Style="{DynamicResource SubtitleTextBlockStyle}" Text="{l:Loc TaskbarIconControl_Title}" FontFamily="Microsoft Yahei"/>
<TextBlock Text="{Binding Recorder.Config.Global.WorkDirectory,Mode=OneWay}" TextWrapping="NoWrap" FontFamily="Microsoft Yahei"/>
</StackPanel>
<Separator Grid.Row="1" Grid.ColumnSpan="2" />
<ItemsControl Grid.Row="2" Grid.ColumnSpan="2" Margin="10,0,10,10" ItemsSource="{Binding Recorder.Rooms, Mode=OneWay}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type core:IRoom}">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,5,0,0">
<ui:PathIcon Width="15" Style="{StaticResource PathIconDataAccessPoint}"
Foreground="{Binding Streaming,Converter={StaticResource BooleanToLiveStatusColorBrushConverter}}"/>
<ui:PathIcon
Visibility="{Binding RoomConfig.AutoRecord,Converter={StaticResource BooleanToVisibilityHiddenConverter}}"
Style="{StaticResource PathIconDataCctv}" Foreground="DarkOrange" Width="15" Margin="3,0,0,0"/>
<ui:PathIcon
Visibility="{Binding Recording,Converter={StaticResource BooleanToVisibilityHiddenConverter}}"
Style="{StaticResource PathIconDataRecordRec}" Foreground="Red" Width="15" Margin="3,0"/>
<TextBlock Text="{Binding Name, Mode=OneWay}" TextWrapping="NoWrap"
FontFamily="Microsoft Yahei" TextTrimming="CharacterEllipsis"/>
<Border VerticalAlignment="Center" MinWidth="90"
Visibility="{Binding Recording,Converter={StaticResource BooleanToVisibilityHiddenConverter}}"
Background="{Binding Stats.DurationRatio, Converter={StaticResource RatioToColorBrushConverter},Mode=OneWay}"
BorderThickness="1" BorderBrush="{DynamicResource SystemControlBackgroundChromeBlackMediumBrush}" Margin="2,0" CornerRadius="5">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<ui:PathIcon MaxWidth="11" Foreground="Black" Style="{Binding Stats.DurationRatio, Converter={StaticResource RatioToArrowIconConverter}}"/>
<TextBlock HorizontalAlignment="Center" Foreground="Black" FontFamily="Microsoft Yahei">
<TextBlock.Text>
<MultiBinding Converter="{l:StringFormatConverter}">
<l:BLoc Key="RoomCard_Status_SpeedIndicator_SpeedInMbps"/>
<Binding Path="Stats.NetworkMbps" Mode="OneWay"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</StackPanel>
</Border>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel IsItemsHost="True"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</Grid>
</Border>
</tb:TaskbarIcon.TrayToolTip>
</tb:TaskbarIcon>
</UserControl>