示例#1
0
        private static FileBitmapImage LoadFromIsolatedStorageBitmap(string fileName)
        {
            FileBitmapImage Result = null;

            try
            {
                IsolatedStorageFile       storage = GetStorageRoot();
                IsolatedStorageFileStream fs      = storage.OpenFile(fileName, FileMode.Open);
                Result = new FileBitmapImage(storage, fs);
            }
            catch (Exception e)
            {
                PrintException(e, "Load Bitmap", fileName);
            }

            return(Result);
        }
示例#2
0
        public static FileBitmapImage LoadBitmap(string fileName)
        {
            string Source = ToISFileName(fileName);

            if (!IsolatedStorageFileExists(Source))
            {
                return(null);
            }

            if (BitmapCache.ContainsKey(Source))
            {
                return(BitmapCache[Source]);
            }
            else
            {
                FileBitmapImage Result = LoadFromIsolatedStorageBitmap(Source);
                if (Result != null)
                {
                    BitmapCache.Add(Source, Result);
                }

                return(Result);
            }
        }