Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion FluentFlyoutWPF/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Margin="12" Orientation="Horizontal">
<Border Name="SongImageBorder" CornerRadius="6" BorderThickness="1" BorderBrush="#26FFFFFF" Margin="0" ClipToBounds="True" Width="78" Height="78">
<Border Name="SongImageBorder" CornerRadius="6" BorderThickness="1" BorderBrush="#26FFFFFF" Margin="0" ClipToBounds="True" Width="78" Height="78"
ToolTipService.InitialShowDelay="800"
ToolTipService.Placement="RelativePoint"
ToolTipService.VerticalOffset="-16">
<ui:SymbolIcon Name="SongImagePlaceholder" Symbol="MusicNote220" FontSize="40" Filled="True" Foreground="{DynamicResource MicaWPF.Brushes.SystemAccentColorLight2}" Visibility="Collapsed" />
<Border.Background>
<ImageBrush x:Name="SongImage" Stretch="UniformToFill"/>
Expand Down
26 changes: 21 additions & 5 deletions FluentFlyoutWPF/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
using MicaWPF.Core.Extensions;
using Microsoft.Win32;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Windows.Interop;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
Expand Down Expand Up @@ -764,6 +765,7 @@ private void UpdateUI(MediaSession mediaSession)
ControlBack.IsEnabled = ControlForward.IsEnabled = false;
ControlBack.Opacity = ControlForward.Opacity = 0.35;
SongInfoStackPanel.ToolTip = string.Empty;
SongImageBorder.ToolTip = null;
return;
}

Expand Down Expand Up @@ -892,8 +894,22 @@ private void UpdateUI(MediaSession mediaSession)
}
}

if (SongImage.ImageSource == null) SongImagePlaceholder.Visibility = Visibility.Visible;
else SongImagePlaceholder.Visibility = Visibility.Collapsed;
if (SongImage.ImageSource == null)
{
SongImagePlaceholder.Visibility = Visibility.Visible;
SongImageBorder.ToolTip = null;
}
else
{
SongImagePlaceholder.Visibility = Visibility.Collapsed;
SongImageBorder.ToolTip = new System.Windows.Controls.Image
{
Source = image,
MaxWidth = 300,
MaxHeight = 300,
Stretch = Stretch.Uniform
};
}

if (_seekBarEnabled)
{
Expand Down Expand Up @@ -1213,7 +1229,7 @@ internal static class Helper
{
private const int MaxThumbnailSize = 512;

internal static BitmapImage? GetThumbnail(IRandomAccessStreamReference Thumbnail, bool convertToPng = true)
internal static BitmapImage? GetThumbnail(IRandomAccessStreamReference Thumbnail, bool convertToPng = true, int maxThumbnailSize = MaxThumbnailSize)
{
if (Thumbnail == null)
return null;
Expand All @@ -1224,7 +1240,7 @@ internal static class Helper
// initialize the BitmapImage
image.BeginInit();
image.CacheOption = BitmapCacheOption.OnLoad;
image.DecodePixelWidth = MaxThumbnailSize;
image.DecodePixelWidth = maxThumbnailSize;
image.StreamSource = imageStream;
image.EndInit();
}
Expand Down
9 changes: 6 additions & 3 deletions FluentFlyoutWPF/Windows/TaskbarWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,14 @@
<ScaleTransform ScaleX="0.9" ScaleY="0.9" />
</Grid.RenderTransform>
<StackPanel Name="MainStackPanel" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center" Width="Auto" Margin="4,0,-100,0">
<Border Name="SongImageBorder" CornerRadius="5" Margin="0,0,0,-3" ClipToBounds="True" Width="36" Height="36" Panel.ZIndex="2">
<Border Name="SongImageBorder" CornerRadius="5" Margin="0,0,0,-3" ClipToBounds="True" Width="36" Height="36" Panel.ZIndex="2"
ToolTipService.InitialShowDelay="800"
ToolTipService.Placement="RelativePoint"
ToolTipService.VerticalOffset="-16">
<ui:SymbolIcon Name="SongImagePlaceholder" Symbol="MusicNote220" FontSize="24" Filled="True" Foreground="{ui:ThemeResource AccentTextFillColorPrimaryBrush}" />
<Border.Background>
<ImageBrush x:Name="SongImage" Stretch="UniformToFill" />
</Border.Background>
<ImageBrush x:Name="SongImage" Stretch="UniformToFill" />
</Border.Background>
</Border>
<StackPanel Name="SongInfoStackPanel" Orientation="Vertical" VerticalAlignment="Center" Width="Auto" Margin="8,0,0,0"
ToolTipService.InitialShowDelay="800"
Expand Down
10 changes: 10 additions & 0 deletions FluentFlyoutWPF/Windows/TaskbarWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ public void UpdateUi(string title, string artist, BitmapImage? icon, GlobalSyste
SongArtist.Text = string.Empty;
SongInfoStackPanel.Visibility = Visibility.Collapsed;
SongInfoStackPanel.ToolTip = string.Empty;
SongImageBorder.ToolTip = null;
SongImagePlaceholder.Symbol = SymbolRegular.MusicNote220;
SongImagePlaceholder.Visibility = Visibility.Visible;
SongImage.ImageSource = null;
Expand Down Expand Up @@ -753,6 +754,14 @@ public void UpdateUi(string title, string artist, BitmapImage? icon, GlobalSyste
BackgroundImage.Source = icon;
SongImageBorder.Margin = new Thickness(0, 0, 0, -2); // align image better when cover is present

SongImageBorder.ToolTip = new System.Windows.Controls.Image
{
Source = icon,
MaxWidth = 300,
MaxHeight = 300,
Stretch = Stretch.Uniform
};

// start cross-fade if previous task is completed
//if (_crossFadeTask.IsCompleted)
//{
Expand All @@ -765,6 +774,7 @@ public void UpdateUi(string title, string artist, BitmapImage? icon, GlobalSyste
SongImagePlaceholder.Visibility = Visibility.Visible;
SongImage.ImageSource = null;
BackgroundImage.Source = null;
SongImageBorder.ToolTip = null;
}

SongTitle.Visibility = Visibility.Visible;
Expand Down