Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Lively selector crash due to invalid XAML resource #501

Merged
merged 2 commits into from
Dec 3, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public sealed partial class LivelyWallpaperSelectorViewModel : ObservableRecipie
private readonly ILivelyWallpaperService _wallpaperService;
private readonly IFilesService _filesService;
private readonly ISettingsService _settingsService;
private readonly DispatcherQueue _dispatcherQueue;

public LivelyWallpaperSelectorViewModel(ILivelyWallpaperService wallpaperService, IFilesService filesService, ISettingsService settingsService,
string defaultTitle, string defaultPreviewPath) : this(wallpaperService, filesService, settingsService)
Expand All @@ -55,6 +56,7 @@ public LivelyWallpaperSelectorViewModel(ILivelyWallpaperService wallpaperService
_wallpaperService = wallpaperService;
_filesService = filesService;
_settingsService = settingsService;
_dispatcherQueue = DispatcherQueue.GetForCurrentThread();
}

public async Task InitializeVisualizers()
Expand All @@ -77,7 +79,7 @@ public async Task LoadVisualizers()

public void Receive(PropertyChangedMessage<LivelyWallpaperModel?> message)
{
SelectedVisualizer = message.NewValue;
_dispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, () => SelectedVisualizer = message.NewValue);
}

partial void OnSelectedVisualizerChanged(LivelyWallpaperModel? value)
Expand Down
3 changes: 1 addition & 2 deletions Screenbox/Controls/LivelyWallpaperSelector.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
<Grid
Width="112"
Height="96"
CornerRadius="{StaticResource GridViewItemCornerRadius}"
FlowDirection="LeftToRight"
ToolTipService.ToolTip="{x:Bind Model.Title, FallbackValue={x:Null}}">
<Grid.Background>
Expand All @@ -83,7 +82,7 @@
Background="{ThemeResource AcrylicInAppFillColorDefaultBrush}"
BorderBrush="{ThemeResource ControlStrokeColorForStrongFillWhenOnImageBrush}"
BorderThickness="1"
CornerRadius="{StaticResource GridViewItemCornerRadius}"
CornerRadius="4"
ToolTipService.ToolTip="{strings:Resources Key=PoweredByLivelyWallpaper}"
Visibility="{x:Bind Path, Converter={StaticResource StringVisibilityConverter}}">
<Image
Expand Down
2 changes: 2 additions & 0 deletions Screenbox/InvaidXamlResources.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# DO NOT USE THE FOLLOWING RESOURCES IN XAML FILES. THEY ARE NOT GENERALLY AVAILABLE.
GridViewItemCornerRadius
1 change: 1 addition & 0 deletions Screenbox/Screenbox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@
<None Include="Controls\Animations\AnimatedPlayingVisualSource.json" />
<None Include="Package.StoreAssociation.xml" />
<None Include="packages.lock.json" />
<None Include="InvaidXamlResources.txt" />
<Content Include="Properties\Default.rd.xml" />
<None Include="Secrets.cs.template" />
</ItemGroup>
Expand Down