コード例 #1
0
        void wTIM_SearchForCallback(ImageRecievedCallbackItem imageItem)
        {
            if (!imageItem.Success)
            {
                //Handle the error
                errors.Add(imageItem);
            }

            this.Invoke(new UpdateAfterImagesWereFoundCallback(updateAfterImagesWereFound), new object[] { imageItem });
        }
コード例 #2
0
        void wTIM_GetForSelectedCardsCallback(ImageRecievedCallbackItem imageItem)
        {
            if (imageItem.Success)
            {
                //Save the image
                LanguageData dataLayer = new LanguageData();
                dataLayer.InsertUpdatePicture(imageItem.Images[0], imageItem.SearchItem.ID, imageItem.SearchItem.SearchText);
            }
            else
            {
                //Handle the error
                errors.Add(imageItem);
            }

            //update the screen
            this.Invoke(new UpdateAfterImageDownloadedAndSavedCallback(updateAfterImageDownloadedAndSaved), new object[] { imageItem });
        }
コード例 #3
0
        void updateAfterImagesWereFound(ImageRecievedCallbackItem imageItem)
        {
            updateStatusAndProgressBar(imageItem);

            if (imageItem.Success)
            {
                foreach (Image image in imageItem.Images)
                {
                    addImageToResults(image, imageItem.SearchItem.SearchText);
                }
            }
        }
コード例 #4
0
        void updateStatusAndProgressBar(ImageRecievedCallbackItem imageItem)
        {
            if (LoadingPanelIsVisible)
                LoadingPanelIsVisible = false;

            if (imageItem.Success)
            {
                progressBar.Value = imageItem.ProcessedCount;
                lblStatus.Text = string.Format("Downloaded: {0} of {1}", imageItem.ProcessedCount, imageItem.Total);
            }
            else
            {
                progressBar.Value = imageItem.ProcessedCount;
                lblStatus.Text = imageItem.ErrorMsg;
            }

            if (imageItem.ProcessedCount == imageItem.Total)
            {
                //update the screen
                if(lblStatus.Text != WebImage.InternetConnectionErrorMessage)
                    lblStatus.Text = string.Format("Finished with {0} errors.", errors.Count);

                progressBar.Value = 0;
                loadingSmallPictureBox.Visible = false;
            }
        }
コード例 #5
0
        void updateAfterImageDownloadedAndSaved(ImageRecievedCallbackItem imageItem)
        {
            updateStatusAndProgressBar(imageItem);

            Image downloadedImage = null;
            if (imageItem.Success)
                downloadedImage = imageItem.Images[0];

            AddImagePreview(downloadedImage, imageItem.SearchItem.SearchText, true, true);
        }