private static Size GetImageScaledSize(Size imageSize, Size maxImageSize) { float scale = Math.Max(UserPhotoUtilities.GetVerticalScaleFactor(imageSize, maxImageSize), UserPhotoUtilities.GetHorizontalScaleFactor(imageSize, maxImageSize)); return(UserPhotoUtilities.GetScaledSize(imageSize, scale)); }