Example #1
0
 private void DownloadeFinish(BitmapSource LoadedImage, Msgbox msg)
 {
     if (LoadedImage.Equals(images.Current().image))
     {
         ApplyCurretnImage();
         images.Current().image.DownloadProgress -= msg.UpdateProgressBar;
     }
 }
Example #2
0
        //Drop the image
        private void Window_Drop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.FileDrop, false))
            {
                String[] paths = (String[])e.Data.GetData(DataFormats.FileDrop, true);

                if (paths.Length > 0)
                {
                    if (paths.Length == 1 && Directory.Exists(paths[0]))
                    {
                        images.Insert(Directory.GetFiles(paths[0]));
                        ApplyCurretnImage();
                    }
                    else
                    {
                        images.Insert(paths);
                        ApplyCurretnImage();
                    }
                }
            }
            else if (e.Data.GetDataPresent(DataFormats.Html, false))
            {
                String Html = (String)e.Data.GetData(DataFormats.Html, false),
                       url  = GetImageUrl(Html);

                if (url.Length > 5)
                {
                    Msgbox msg = new Msgbox("Downloading...", true);

                    images.Insert(url);
                    images.Current().image.DownloadCompleted += (s, ee) => DownloadeFinish(images.Current().image, msg);
                    images.Current().image.DownloadProgress += (s, ee) => msg.UpdateProgressBar(s, ee);
                }
            }

            UpdateIndexBox();
            Adjust_Click(sender, e);
            GloVar.AutoHiding = true;
        }