Last active
December 15, 2015 05:29
-
-
Save mrlacey/5209344 to your computer and use it in GitHub Desktop.
On low spec WP8 devices we had an issue where the UI option to create a secondary tile wasn't always being enabled properly. After identifying the most likely cause as the `CanPin()` method I had to refactor it to make it debuggable and in doing so made the binding/timing issue go away (solved it).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal bool CanPin() | |
{ | |
if (this.IsPinned()) | |
{ | |
Debug.WriteLine("Cannot pin as already pinned"); | |
return false; | |
} | |
if (this.UnderlyingModel == null) | |
{ | |
Debug.WriteLine("Cannot pin as don't have the underlying model (needed when generating the image and deep link path)"); | |
return false; | |
} | |
if (this.IsRunningInKidsCorner()) | |
{ | |
Debug.WriteLine("Cannot pin as running in kids corner"); | |
return false; | |
} | |
if (this.UnderlyingModel.IsSpecial) | |
{ | |
Debug.WriteLine("CAN pin as is special (will use special artwork)"); | |
return true; | |
} | |
if (string.IsNullOrWhiteSpace(this.UnderlyingModel.ArtUrl)) | |
{ | |
Debug.WriteLine("CAN pin as has no artwork (default/fallback will be used)"); | |
return true; | |
} | |
if (this.imageCacher.IsCached(this.UnderlyingModel.ArtUrl)) | |
{ | |
Debug.WriteLine("CAN pin as artwork has been cached"); | |
return true; | |
} | |
Debug.WriteLine("Cannot pin as all tests failed"); | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment