×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Aug 2012
    Posts
    4

    error when using BackgroundTransferService in windows phone download file

    I received The request has already been submitted exception when trying to download audio file using BackgroundTransferService

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    475

    Re: error when using BackgroundTransferService in windows phone download file

    Can you give examples of the code you have used?

  3. #3
    Registered User
    Join Date
    Jul 2013
    Posts
    7

    Re: error when using BackgroundTransferService in windows phone download file

    clear cache memory of that application and re try.

  4. #4
    Registered User
    Join Date
    Aug 2012
    Posts
    4

    Re: error when using BackgroundTransferService in windows phone download file

    public void AddTransferRequest()
    {
    try
    {

    fileName = (lstDownloadLst.SelectedItem as SuraDownload_Details).fileName;
    // uploadedFiles /
    SAVE_LOCATION = ((App)App.Current).SAVE_LOCATION + fileName;
    saveLocationUri = new Uri(SAVE_LOCATION, UriKind.RelativeOrAbsolute);
    videoDownloadUri = new Uri(((App)App.Current).DownloadURL + fileName);
    _currentRequest = new BackgroundTransferRequest(videoDownloadUri, saveLocationUri);
    _currentRequest.TransferPreferences = TransferPreferences.AllowCellularAndBattery;
    var reqList = BackgroundTransferService.Requests.ToList();
    if (reqList.Count==0)
    {
    foreach (var Request in BackgroundTransferService.Requests)
    {
    Request.Dispose();
    }

    }
    foreach (var req in reqList)
    {


    SAVE_LOCATION = @"\shared\transfers\" + fileName;
    saveLocationUri = new Uri(SAVE_LOCATION, UriKind.RelativeOrAbsolute);
    if (req.DownloadLocation.Equals(saveLocationUri))
    BackgroundTransferService.Remove(BackgroundTransferService.Find(req.RequestId));


    }
    if (reqList.Count >= 5)
    {

    foreach (var req in BackgroundTransferService.Requests.ToList())
    {
    BackgroundTransferService.Remove(req);
    }
    }
    BackgroundTransferService.Add(_currentRequest);

    var listBoxItem = lstDownloadLst.ItemContainerGenerator.ContainerFromIndex(lstDownloadLst.SelectedIndex) as ListBoxItem;
    var imgDownload = FindVisualChildByType<Image>(listBoxItem, "imgDownload");
    imgDownload.IsHitTestVisible = false;



    }
    catch (OverflowException)
    {
    var listBoxItem = lstDownloadLst.ItemContainerGenerator.ContainerFromIndex(lstDownloadLst.SelectedIndex) as ListBoxItem;
    var imgDownload = FindVisualChildByType<Image>(listBoxItem, "imgDownload");
    imgDownload.IsHitTestVisible = true;
    lstDownloadLst.IsHitTestVisible = true;

    DeleteVideoIfExists();
    MessageBox.Show("Too many background file operations at the moment... Try again when one finishes");


    }
    catch (Exception ex)
    {
    MessageBox.Show(ex.Message);
    var listBoxItem = lstDownloadLst.ItemContainerGenerator.ContainerFromIndex(lstDownloadLst.SelectedIndex) as ListBoxItem;
    var imgDownload = FindVisualChildByType<Image>(listBoxItem, "imgDownload");
    imgDownload.IsHitTestVisible = true;
    lstDownloadLst.IsHitTestVisible = true;

    DeleteVideoIfExists();
    if (_currentRequest != null)
    {

    foreach (var request in BackgroundTransferService.Requests)
    {

    request.Dispose();
    }
    }



    }
    }

  5. #5
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    475

    Re: error when using BackgroundTransferService in windows phone download file

    Quote Originally Posted by EngDev View Post

    Code:
    var reqList = BackgroundTransferService.Requests.ToList();
    if (reqList.Count==0)
    {
        foreach (var Request in BackgroundTransferService.Requests)
        {
            Request.Dispose();
        }
    }
    Should that be if (reqList.Count != 0) instead?

Similar Threads

  1. Got error on adding php web service in windows phone 7
    By WS7Dev in forum Windows Phone General
    Replies: 4
    Last Post: 2012-11-05, 13:59
  2. Windows Phone 7 OS wireframing tool available for download!
    By marlinmobile in forum Mobile Design and User Experience
    Replies: 1
    Last Post: 2011-02-18, 19:33
  3. How to download .dm file into mobile phone?
    By Himabindu in forum Digital Rights Management & Content Downloading
    Replies: 9
    Last Post: 2010-12-27, 19:31
  4. mp3 file download as .aspx file and not open on phone player
    By yogendratrivedi in forum Mobile Web Site Development
    Replies: 6
    Last Post: 2007-12-06, 09:53
  5. File download to phone
    By docents in forum Mobile Web Site Development
    Replies: 1
    Last Post: 2005-08-26, 08:42

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •