private void ReCapExample_Download(string url, string location)
        {
            DownloadFileWnd wnd = new DownloadFileWnd(url, location);

            wnd._callback = new DownloadFileCompletedDelegate(this.DownloadExampleCompleted);
            wnd.Owner     = this;
            wnd.Show();
        }
        private async void Thumbnails_DownloadPhotos(object sender, RoutedEventArgs e)
        {
            if (!await PhotosceneProperties(_photosceneid))
            {
                return;
            }

            Thumbnails.ItemsSource = new ObservableCollection <ReCapPhotoItem> ();
            dynamic response = _recap.response();
            dynamic files    = response.Photoscenes.Photoscene.Files;
            string  dlFolder = System.IO.Path.GetFullPath(AppDomain.CurrentDomain.BaseDirectory) + response.Photoscenes.Photoscene.photosceneid;

            if (!Directory.Exists(dlFolder))
            {
                Directory.CreateDirectory(dlFolder);
            }
            foreach (KeyValuePair <string, object> pair in files.Dictionary)
            {
                dynamic            fnode = pair.Value;
                AdskReCap.FileType type  = (AdskReCap.FileType)Enum.Parse(typeof(AdskReCap.FileType), fnode.type, true);
                if (fnode.fileid == "" || type != AdskReCap.FileType.Image)
                {
                    continue;
                }
                string location = dlFolder + @"\" + fnode.filename;
                if (File.Exists(location))
                {
                    ObservableCollection <ReCapPhotoItem> items = new ObservableCollection <ReCapPhotoItem> ((IEnumerable <ReCapPhotoItem>)Thumbnails.ItemsSource);
                    items.Add(new ReCapPhotoItem()
                    {
                        Name  = System.IO.Path.GetFileNameWithoutExtension(fnode.filename),
                        Type  = System.IO.Path.GetExtension(fnode.filename),
                        Image = location
                    });
                    Thumbnails.ItemsSource = items;
                    continue;
                }

                if (!await _recap.GetFile(fnode.fileid, type))
                {
                    continue;
                }
                dynamic fileResponse = _recap.response();
                dynamic file         = fileResponse.Files.file;
                string  link         = file.filelink;

                DownloadFileWnd wnd = new DownloadFileWnd(link, location);
                wnd._callback = new DownloadFileCompletedDelegate(this.DownloadFileCompleted);
                wnd.Owner     = this;
                wnd.Show();
            }
        }
        private void DownloadReCapResult(string photosceneid, string link, bool forPreview = false)
        {
            DownloadFileWnd wnd = new DownloadFileWnd(
                link,
                System.IO.Path.GetFullPath(AppDomain.CurrentDomain.BaseDirectory)
                + photosceneid + System.IO.Path.GetExtension(link)
                );

            if (forPreview)               // Preview
            {
                wnd._callback = new DownloadFileCompletedDelegate(this.DownloadResultForPreviewCompleted);
            }
            else
            {
                wnd._callback = new DownloadFileCompletedDelegate(this.DownloadResultCompleted);
            }
            wnd.Owner = this;
            wnd.Show();
        }