Skip to content
Permalink
Browse files
WP8: Avoid config value of a wrong element.
If you have an element that shares the `name`, like <feature
name="SplashScreen">, then the `value` attribute was read of that
instead (since it can appear *before* the preference element). Thus, the
config of `SplashScreen` preference was not settable at all.
  • Loading branch information
Roel van Uden committed Jun 22, 2015
1 parent 57ad360 commit ac23964ac6e5f7a77a62ed9923344857109e71fb
Showing 1 changed file with 3 additions and 0 deletions.
@@ -105,6 +105,7 @@ private void LoadConfigPrefs()
XDocument configFile = XDocument.Parse(sr.ReadToEnd());

string configAutoHide = configFile.Descendants()
.Where(x => x.Name.LocalName == "preference")
.Where(x => (string)x.Attribute("name") == "AutoHideSplashScreen")
.Select(x => (string)x.Attribute("value"))
.FirstOrDefault();
@@ -113,13 +114,15 @@ private void LoadConfigPrefs()
prefAutoHide = bool.TryParse(configAutoHide, out bVal) ? bVal : prefAutoHide;

string configDelay = configFile.Descendants()
.Where(x => x.Name.LocalName == "preference")
.Where(x => (string)x.Attribute("name") == "SplashScreenDelay")
.Select(x => (string)x.Attribute("value"))
.FirstOrDefault();
int nVal;
prefDelay = int.TryParse(configDelay, out nVal) ? nVal : prefDelay;

string configImage = configFile.Descendants()
.Where(x => x.Name.LocalName == "preference")
.Where(x => (string)x.Attribute("name") == "SplashScreen")
.Select(x => (string)x.Attribute("value"))
.FirstOrDefault();

0 comments on commit ac23964

Please sign in to comment.