예제 #1
0
        private void DownloadFile(string path)
        {
            try
            {
                WebClient webClient = new WebClient();
                webClient.DownloadProgressChanged += webClient_DownloadProgressChanged;
                webClient.DownloadFileCompleted   += webClient_DownloadFileCompleted;

                string file = Path.Combine(Constants.CacheLocation, Path.GetFileName(OsirtHelper.StripQueryFromPath(path)));
                webClient.DownloadFileAsync(new Uri(path), file, file);
            }
            catch
            {
                MessageBox.Show("Unable to download this file.", "Unable to download file", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        private void Handler_ViewImageExif(object sender, EventArgs e)
        {
            string    path          = ((ExifViewerEventArgs)e).ImageUrl;
            WebClient webClientexif = new WebClient();
            string    file          = Path.Combine(Constants.CacheLocation, Path.GetFileName(OsirtHelper.StripQueryFromPath(path)));

            webClientexif.DownloadFileAsync(new Uri(path), file, file);
            webClientexif.DownloadFileCompleted += (snd, evt) =>
            {
                this.InvokeIfRequired(() => new ExifViewer(evt.UserState.ToString(), path).Show());
            };
        }