Skip to content

Commit d841171

Browse files
committed
Fix issues with setting lock screen image
1 parent e48bc6d commit d841171

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

src/ThemeDialog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ private void ApplySelectedTheme()
123123
}
124124
else if (IsLockScreenSelected)
125125
{
126-
bool shouldContinue = ThemeDialogUtils.UpdateConfigForLockScreen();
126+
bool shouldContinue = ThemeDialogUtils.UpdateConfigForLockScreen(activeTheme);
127127
if (!shouldContinue)
128128
{
129129
return;

src/ThemeDialogUtils.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ internal static void UpdateConfigForDisplay(List<string> activeThemes)
183183
}
184184
}
185185

186-
internal static bool UpdateConfigForLockScreen()
186+
internal static bool UpdateConfigForLockScreen(string activeTheme)
187187
{
188188
if (JsonConfig.settings.lockScreenDisplayIndex != -1)
189189
{
@@ -195,6 +195,12 @@ internal static bool UpdateConfigForLockScreen()
195195
return false;
196196
}
197197
}
198+
else if (JsonConfig.settings.lockScreenTheme == null && activeTheme != null)
199+
{
200+
MessageDialog.ShowInfo(_("WinDynamicDesktop cannot change the lock screen image when Windows " +
201+
"Spotlight is enabled. If the lock screen image does not update, navigate to \"Personalization " +
202+
"-> Lock screen\" in Windows settings and check that the lock screen is set to Picture mode."));
203+
}
198204

199205
JsonConfig.settings.lockScreenDisplayIndex = -1;
200206
LockScreenChanger.UpdateMenuItems();

src/UwpHelper.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,18 @@ public override async void SetLockScreen(string imagePath)
9292

9393
private static Task<Windows.Storage.StorageFile> LoadImageFile(string imagePath)
9494
{
95-
string[] pathSegments = imagePath.Split(Path.DirectorySeparatorChar);
96-
var uri = new Uri("ms-appdata:///local/themes/" +
97-
Uri.EscapeDataString(pathSegments[pathSegments.Length - 2]) + "/" +
98-
Uri.EscapeDataString(pathSegments[pathSegments.Length - 1]));
99-
return Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(uri).AsTask();
95+
if (imagePath.StartsWith(Environment.CurrentDirectory))
96+
{
97+
string[] pathSegments = imagePath.Split(Path.DirectorySeparatorChar);
98+
var uri = new Uri("ms-appdata:///local/themes/" +
99+
Uri.EscapeDataString(pathSegments[pathSegments.Length - 2]) + "/" +
100+
Uri.EscapeDataString(pathSegments[pathSegments.Length - 1]));
101+
return Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(uri).AsTask();
102+
}
103+
else
104+
{
105+
return Windows.Storage.StorageFile.GetFileFromPathAsync(imagePath).AsTask();
106+
}
100107
}
101108
}
102109
}

0 commit comments

Comments
 (0)