コード例 #1
0
 /// <returns> the single instance of the images cache object </returns>
 public static ImagesCache GetInstance()
 {
     if (_instance == null)
     {
         // synchronize on the class object
         lock (typeof(ImagesCache))
         {
             if (_instance == null)
             {
                 _instance = new ImagesCache();
             }
         }
     }
     return(_instance);
 }
コード例 #2
0
ファイル: ImageLoader.cs プロジェクト: rinavin/RCJS
        /// <summary>
        ///
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="loadAsIcon"></param>
        /// <returns></returns>
        internal static Image GetImage(String fileName)
        {
            Image image = ImagesCache.GetInstance().Get(fileName);

            if (image == null)
            {
                image = ImageUtils.LoadImage(fileName);

                if (image != null)
                {
                    bool putInCache = true;
#if !PocketPC
                    putInCache = !ImageAnimator.CanAnimate(image);
#endif
                    if (putInCache)
                    {
                        ImagesCache.GetInstance().Put(fileName, image);
                    }
                }
            }

            return(image);
        }