Esempio n. 1
0
        internal override Bitmap RetrieveFullSizeImage(object fullSizeCallbackParameter)
        {
            object fullSizeImage = null;

            try
            {
                fullSizeImage = mScript.RetrieveFullSizeImage(fullSizeCallbackParameter);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.Fail(String.Format("Script {0} threw an exception while retreiving full sized image: {1}", mScript.Name, e.Message));
            }
            return(BitmapHelpers.GetBitmap(fullSizeImage));
        }
Esempio n. 2
0
            public void Add(object thumbnail, string name, string infoUri, int fullSizeImageWidth, int fullSizeImageHeight, object fullSizeImageCallback, CoverType coverType)
            {
                if (!mSource.QueryContinueSearchInternal())
                {
                    //Break out of this search
                    mSource.AbortSearch();
                    return;
                }

                if (mSource.FullSizeOnly || fullSizeImageCallback == null)
                {
                    Bitmap fullSize = null;
                    if (fullSizeImageCallback != null)                     //If fullSizeImageCallback == null, then no full size image supplied, so the thumbnail is the full size image
                    {
                        //Try to get the full size image without getting the thumbnail
                        fullSize = mSource.RetrieveFullSizeImage(fullSizeImageCallback);
                    }
                    if (fullSize == null)
                    {
                        //Fall back on using the thumbnail as the full size
                        fullSize = BitmapHelpers.GetBitmap(thumbnail);
                    }
                    if (fullSize != null)
                    {
                        mDispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate
                        {
                            mSource.Results.Add(new AlbumArt(mSource,
                                                             name,
                                                             infoUri,
                                                             fullSize,
                                                             coverType));
                        }));
                    }
                }
                else
                {
                    Bitmap thumbnailBitmap = BitmapHelpers.GetBitmap(thumbnail);

                    if (thumbnailBitmap != null)
                    {
                        mDispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate
                        {
                            mSource.Results.Add(new AlbumArt(mSource,
                                                             thumbnailBitmap,
                                                             name,
                                                             infoUri,
                                                             fullSizeImageWidth,
                                                             fullSizeImageHeight,
                                                             fullSizeImageCallback,
                                                             coverType));
                        }));
                    }
                }

                if (!mSource.QueryContinueSearchInternal())
                {
                    //Break out of this search
                    mSource.AbortSearch();
                    return;
                }
            }