Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Pd233 committed Jan 13, 2024
1 parent 96fedc3 commit 92e2321
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src/LipUI/Pages/Settings/PersonalizationSettingsView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -667,17 +667,25 @@ private void BackgroundSecondaryColor_ColorPickerButton_Loading(FrameworkElement

private async void CheckBox_Checked(object sender, RoutedEventArgs e)
{
ImageBackgroundEnabledPanel.Visibility = Visibility.Visible;
Main.Config.PersonalizationSettings.EnableImageBackground = true;
await Main.SaveConfigAsync();
try
{
ImageBackgroundEnabledPanel.Visibility = Visibility.Visible;
Main.Config.PersonalizationSettings.EnableImageBackground = true;
await Main.SaveConfigAsync();

var image = Services.CreateImageFromBytes(await File.ReadAllBytesAsync(Main.Config.PersonalizationSettings.BackgroundImagePath ?? ""));
image.DecodePixelType = DecodePixelType.Logical;
image.DecodePixelWidth = 256;
PreviewImage.Source = image;
var path = Main.Config.PersonalizationSettings.BackgroundImagePath;
if (path is not null)
{
var image = Services.CreateImageFromBytes(await File.ReadAllBytesAsync(path));
image.DecodePixelType = DecodePixelType.Logical;
image.DecodePixelWidth = 256;
PreviewImage.Source = image;

image = Services.CreateImageFromBytes(await File.ReadAllBytesAsync(Main.Config.PersonalizationSettings.BackgroundImagePath ?? ""));
MyRes.ApplicationBackgroundImage = new ImageBrush() { ImageSource = image, Stretch = Stretch.UniformToFill };
image = Services.CreateImageFromBytes(await File.ReadAllBytesAsync(path));
MyRes.ApplicationBackgroundImage = new ImageBrush() { ImageSource = image, Stretch = Stretch.UniformToFill };
}
}
catch (Exception ex) { await Services.ShowInfoBarAsync(ex); }
}

private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
Expand Down

0 comments on commit 92e2321

Please sign in to comment.