Пример #1
0
        /// <summary>
        /// Load the thumb from tvdb
        /// </summary>
        /// <returns></returns>
        public bool LoadThumb(bool _replaceOld)
        {
            bool wasLoaded = m_thumbLoaded;//is the banner already loaded at this point

            lock (m_thumbLoadingLock)
            {//if another thread is already loading THIS banner, the lock will block this thread until the other thread
                //has finished loading
                if (!wasLoaded && !_replaceOld && m_thumbLoaded)
                {////the banner has already been loaded from a different thread and we don't want to replace it
                    return(false);
                }
                m_thumbLoading = true;
                try
                {
                    Image img = LoadImage(TvdbLinks.CreateBannerLink(m_thumbPath));

                    if (img != null)
                    {
                        m_bannerThumb  = img;
                        m_thumbLoaded  = true;
                        m_thumbLoading = false;
                        return(true);
                    }
                }
                catch (WebException ex)
                {
                    Log.Error("Couldn't load banner thumb" + m_thumbPath, ex);
                }
                m_thumbLoaded  = false;
                m_thumbLoading = false;
                return(false);
            }
        }