Skip to content

Commit a30d984

Browse files
committed
Simplify BitmapIcon Create
1 parent 1dab2ad commit a30d984

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

CollapseLauncher/Classes/EventsManagement/BackgroundActivityManager.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
using CollapseLauncher.Plugins;
88
using Hi3Helper;
99
using Hi3Helper.Data;
10+
using Hi3Helper.Shared.Region;
1011
using Microsoft.UI.Xaml;
1112
using Microsoft.UI.Xaml.Controls;
1213
using Microsoft.UI.Xaml.Media;
1314
using System;
1415
using System.Collections.Generic;
16+
using System.IO;
1517
using System.Numerics;
1618

1719
// ReSharper disable StringLiteralTypo
@@ -67,23 +69,24 @@ private static IconElement GetGamePresetIcon(PresetConfig presetConfig)
6769

6870
if (presetConfig is not PluginPresetConfigWrapper pluginPresetConfig)
6971
{
70-
return new BitmapIcon
71-
{
72-
UriSource = new Uri(uri)
73-
};
72+
return Create(uri);
7473
}
7574

7675
PluginInfo pluginInfo = pluginPresetConfig.PluginInfo;
7776
GamePluginIconConverter converter = StaticConverter<GamePluginIconConverter>.Shared;
7877
if (converter.Convert(pluginInfo, null!, null!, "") is not IconElement iconElement)
7978
{
80-
return new BitmapIcon
81-
{
82-
UriSource = new Uri(uri)
83-
};
79+
return Create(uri);
8480
}
8581

8682
return iconElement;
83+
84+
static BitmapIcon Create(string uri)
85+
=> new()
86+
{
87+
UriSource = new Uri(uri),
88+
ShowAsMonochrome = false
89+
};
8790
}
8891

8992
private static void AttachEventToNotification(PresetConfig presetConfig, IBackgroundActivity activity, string activityTitle, string activitySubtitle)

0 commit comments

Comments
 (0)