Пример #1
0
        /// <summary>
        /// Gets the actual Movie Poster for this Movie
        /// </summary>
        /// <param name="size"></param>
        /// <returns></returns>
        public Image GetProfileImage(ProfileSize size)
        {
            Image x = null;

            if (ProfilePath != null)
            {
                String cachePath = PrivateData.GetAppPath() + @"\Cache\Images\Person\" + ProfilePath.Replace("/", "");

                if (File.Exists(cachePath))
                {
                    x = Image.FromFile(cachePath); // Use Image from Cache
                }
                else
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(cachePath));  // Insure Directory Exists
                    Uri uri = Uri(size);
                    var wc  = new WebClient();
                    x = Image.FromStream(wc.OpenRead(uri)); //Read from the Internet

                    x.Save(cachePath);                      //Save Image in Cache
                }
            }
            return(x);
        }
Пример #2
0
 /// <summary>
 /// Uri to the profile image.
 /// </summary>
 /// <param name="size">The size for the image as required</param>
 /// <returns>The uri to the sized image</returns>
 public Uri Uri(ProfileSize size)
 {
     return(Utilities.Extensions.MakeImageUri(size.ToString(), ProfilePath));
 }
Пример #3
0
 /// <summary>
 /// Uri to the profile image.
 /// </summary>
 /// <param name="size">The size for the image as required</param>
 /// <returns>The uri to the sized image</returns>
 public Uri Uri(ProfileSize size)
 {
     return Extensions.MakeImageUri(size.ToString(), ProfilePath);
 }
Пример #4
0
 private Uri Uri(ProfileSize size)
 {
     return(MakeImageUri(size.ToString(), ProfilePath));
 }