locked
Download background Transfer not Working in a Project

    Question

  • I'm trying to download a file on button click. It's working in a fresh project but in my main project app it's not working at all...I have spent hours  to debug it but haven't got a clue. All the permissions are set. There's no exception.The control never enters the ProgressCallback function(Checked this using debug.writeline). It just doesn't download but the same code runs smoothly when I create a new Project and copy the same code. Why?????

    private async void DownloadButton_Click(object sender, RoutedEventArgs e)
            {



                Uri Source;

                Uri.TryCreate("http://old.sgpc.net/hukumnama/jpeg%20hukamnama/hukamnama.pdf", UriKind.Absolute, out Source);
                

                StorageFile file = await KnownFolders.VideosLibrary.CreateFileAsync("abc.pdf", CreationCollisionOption.ReplaceExisting);

                BackgroundDownloader downloader = new BackgroundDownloader();
                DownloadOperation download = downloader.CreateDownload(Source, file);
                Debug.WriteLine(download.GetResponseInformation());
                progress.IsActive = true;

    Progress<DownloadOperation> progresscallback = new Progress<DownloadOperation>(DownloadProgress);

             
                   await download.StartAsync().AsTask(cts.Token, progresscallback);


            }

    Saturday, April 26, 2014 3:21 PM

All replies

  • It will be  very difficult to help you if this is just reproduced in your real App and not in a new project. Do you have all Exceptions enabled in Debug menu while you debug. Else you will need to post complete code where you have this issue to get help.

    -- Vishal Kaushik --

    Please 'Mark as Answer' if my post answers your question and 'Vote as Helpful' if it helps you. Happy Coding!!!


    Saturday, April 26, 2014 5:20 PM