Skip to content
Merged
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
1 change: 0 additions & 1 deletion src/BmsConfig/BmsConfig.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

<ItemGroup>
<Resource Include="Config.ico" />
<Resource Include="Logo.png" />
</ItemGroup>

</Project>
Binary file removed src/BmsConfig/Logo.png
Binary file not shown.
2 changes: 1 addition & 1 deletion src/BmsConfig/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<Image Grid.Column="0" Source="Logo.png" Width="68" Height="68" Margin="0,0,18,0" VerticalAlignment="Center"
<Image Grid.Column="0" x:Name="LogoImage" Width="68" Height="68" Margin="0,0,18,0" VerticalAlignment="Center"
RenderOptions.BitmapScalingMode="HighQuality" />

<StackPanel Grid.Column="1" VerticalAlignment="Center">
Expand Down
24 changes: 24 additions & 0 deletions src/BmsConfig/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Media.Imaging;
using BmsConfig.Core;
using Microsoft.Win32;
using ValueSource = BmsConfig.Core.ValueSource;
Expand Down Expand Up @@ -38,6 +39,8 @@ public MainWindow()
VersionText.Text = version;
Title = "Falcon BMS Config Editor " + version;

LogoImage.Source = LoadLargestIconFrame();

_view = CollectionViewSource.GetDefaultView(_items);
_view.Filter = FilterItem;
ParamList.ItemsSource = _view;
Expand All @@ -63,6 +66,27 @@ public MainWindow()
ShowDetail(null);
}

/// <summary>
/// The largest image in Config.ico (its 256px PNG frame), for the header logo. An Image element pointed
/// directly at the .ico would just use its first frame, which is typically a small one.
/// </summary>
static BitmapSource LoadLargestIconFrame()
{
try
{
BitmapDecoder decoder = BitmapDecoder.Create(new Uri("pack://application:,,,/Config.ico"),
BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
return decoder.Frames
.OrderByDescending(f => f.PixelWidth)
.ThenByDescending(f => f.Format.BitsPerPixel)
.First();
}
catch (Exception)
{
return null; // no logo is better than no app
}
}

// ---- startup / install selection -----------------------------------------------------

void OnLoaded(object sender, RoutedEventArgs e)
Expand Down
Loading