BililiveRecorder/BililiveRecorder.WPF/Controls/TaskbarIconControl.xaml

84 lines
5.5 KiB
Plaintext
Raw 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"
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}"
2020-12-10 17:02:56 +08:00
MinWidth="250"
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, Mode=OneWay}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,5,0,0">
<ui:PathIcon
Visibility="{Binding IsMonitoring,Converter={StaticResource BooleanToVisibilityHiddenConverter}}"
2021-01-04 14:01:11 +08:00
Style="{StaticResource PathIconDataCctv}" Foreground="DarkOrange" Width="15"/>
2020-12-10 17:02:56 +08:00
<ui:PathIcon
Visibility="{Binding IsRecording,Converter={StaticResource BooleanToVisibilityHiddenConverter}}"
2021-01-04 14:01:11 +08:00
Style="{StaticResource PathIconDataRecordRec}" Foreground="Red" Width="15" Margin="3,0"/>
2020-12-10 17:02:56 +08:00
<TextBlock Text="{Binding StreamerName, Mode=OneWay}" TextWrapping="NoWrap"
FontFamily="Microsoft Yahei" TextTrimming="CharacterEllipsis"/>
<Border VerticalAlignment="Center" MinWidth="80"
Visibility="{Binding IsRecording,Converter={StaticResource BooleanToVisibilityHiddenConverter}}"
Background="{Binding DownloadSpeedPersentage, Converter={StaticResource PercentageToColorBrushConverter},Mode=OneWay}"
BorderThickness="1" BorderBrush="{DynamicResource SystemControlBackgroundChromeBlackMediumBrush}" Margin="2,0" CornerRadius="5">
2021-01-04 14:01:11 +08:00
<TextBlock HorizontalAlignment="Center" Foreground="Black" FontFamily="Microsoft Yahei">
<TextBlock.Text>
<MultiBinding Converter="{l:StringFormatConverter}">
<l:BLoc Key="RoomCard_Status_SpeedIndicator_SpeedInMbps"/>
<Binding Path="DownloadSpeedMegaBitps" Mode="OneWay"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
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>