BililiveRecorder/BililiveRecorder.WPF/Controls/TaskbarIconControl.xaml

90 lines
6.2 KiB
Plaintext
Raw Permalink Normal View History

2020-11-28 13:02:57 +08:00
<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"
2021-01-04 14:01:11 +08:00
xmlns:l="https://github.com/XAMLMarkupExtensions/WPFLocalizationExtension"
l:LocalizeDictionary.DesignCulture=""
l:ResxLocalizationProvider.DefaultAssembly="BililiveRecorder.WPF"
l:ResxLocalizationProvider.DefaultDictionary="Strings"
2020-11-28 13:02:57 +08:00
xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:local="clr-namespace:BililiveRecorder.WPF.Controls"
xmlns:core="clr-namespace:BililiveRecorder.Core;assembly=BililiveRecorder.Core"
2020-11-28 13:02:57 +08:00
mc:Ignorable="d">
2020-12-10 17:02:56 +08:00
<tb:TaskbarIcon
2021-01-03 13:21:36 +08:00
x:Name="TaskbarIcon" TrayLeftMouseUp="TaskbarIcon_TrayLeftMouseUp"
2020-12-10 17:02:56 +08:00
Visibility="{Binding Recorder, Converter={StaticResource IsNullToVisibilityCollapsedConverter}}"
2021-01-04 14:01:11 +08:00
ToolTipText="{l:Loc TaskbarIconControl_Title}" MenuActivation="RightClick"
2020-12-10 17:02:56 +08:00
>
<tb:TaskbarIcon.ContextMenu>
2021-01-04 14:01:11 +08:00
<ContextMenu l:ResxLocalizationProvider.DefaultDictionary="Strings">
<MenuItem Header="{l:Loc TaskbarIconControl_MenuItem_OpenMainWindow}" Click="MenuItem_OpenMainWindow_Click"/>
2020-12-10 17:02:56 +08:00
<Separator/>
2021-01-04 14:01:11 +08:00
<MenuItem Header="{l:Loc Global_Quit}" Click="MenuItem_Quit_Click"/>
2020-12-10 17:02:56 +08:00
</ContextMenu>
</tb:TaskbarIcon.ContextMenu>
2020-11-28 13:02:57 +08:00
<tb:TaskbarIcon.TrayToolTip>
<Border
Background="{DynamicResource SystemControlBackgroundAltHighBrush}"
BorderBrush="{DynamicResource SystemControlBackgroundAccentBrush}"
MinWidth="260"
2020-12-01 08:35:10 +08:00
BorderThickness="2"
2020-11-28 13:02:57 +08:00
CornerRadius="5">
2020-12-10 17:02:56 +08:00
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Margin="10">
2021-01-04 14:01:11 +08:00
<TextBlock Style="{DynamicResource SubtitleTextBlockStyle}" Text="{l:Loc TaskbarIconControl_Title}" FontFamily="Microsoft Yahei"/>
2021-01-01 14:46:27 +08:00
<TextBlock Text="{Binding Recorder.Config.Global.WorkDirectory,Mode=OneWay}" TextWrapping="NoWrap" FontFamily="Microsoft Yahei"/>
2020-12-10 17:02:56 +08:00
</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}">
2020-12-10 17:02:56 +08:00
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type core:IRoom}">
2020-12-10 17:02:56 +08:00
<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}}"
2021-01-04 14:01:11 +08:00
Style="{StaticResource PathIconDataRecordRec}" Foreground="Red" Width="15" Margin="3,0"/>
<TextBlock Text="{Binding Name, Mode=OneWay}" TextWrapping="NoWrap"
2020-12-10 17:02:56 +08:00
FontFamily="Microsoft Yahei" TextTrimming="CharacterEllipsis"/>
<Border VerticalAlignment="Center" MinWidth="90"
Visibility="{Binding Recording,Converter={StaticResource BooleanToVisibilityHiddenConverter}}"
2021-08-04 21:58:35 +08:00
Background="{Binding Stats.DurationRatio, Converter={StaticResource RatioToColorBrushConverter},Mode=OneWay}"
2020-12-10 17:02:56 +08:00
BorderThickness="1" BorderBrush="{DynamicResource SystemControlBackgroundChromeBlackMediumBrush}" Margin="2,0" CornerRadius="5">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
2021-08-04 21:58:35 +08:00
<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>
2020-12-10 17:02:56 +08:00
</Border>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel IsItemsHost="True"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</Grid>
2020-11-28 13:02:57 +08:00
</Border>
</tb:TaskbarIcon.TrayToolTip>
</tb:TaskbarIcon>
</UserControl>