Example #1
0
 public static ImageSource GetBackgroundImageSource(this AppearanceSettingsGroup settingsGroup)
 {
     try
     {
         Uri uri = settingsGroup.GetBackgroundImageUri();
         if (uri == null || uri.ToString().StartsWith("file") && !File.Exists(settingsGroup.BackgroundImage))
         {
             return(null);
         }
         return(new BitmapImage(uri));
     }
     catch (Exception e)
     {
         return(null);
     }
 }
Example #2
0
 public static Stretch GetBackgroundImageStretch(this AppearanceSettingsGroup settingsGroup)
 {
     return(Enum.TryParse(settingsGroup.BackgroundImageStretch, out Stretch stretch) ? stretch : Stretch.UniformToFill);
 }
Example #3
0
 public static Uri GetBackgroundImageUri(this AppearanceSettingsGroup settingsGroup)
 {
     return(string.IsNullOrWhiteSpace(settingsGroup.BackgroundImage)
         ? null
         : new Uri(settingsGroup.BackgroundImage));
 }