locked
App Bar is not opening after calling "FolderPicker.PickSingleFolderAsync()" API and immediately click "Cancel" button from the UI. RRS feed

  • Question

  • Hi,

    I have created a sample Windows 8.1 Store app and here I have used "FolderPicker.PickSingleFolderAsync()" API to select a folder while saving the file. But if we click "Cancel" button immediately from the UI after calling "FolderPicker.PickSingleFolderAsync()" API, the app bar is not opening. After 30 sec, the app bar is opening. Could you please provide the solution for this issue?

    Thanks in advance,

    Hari.


    • Edited by GHBHAT Tuesday, December 10, 2013 7:03 AM
    Tuesday, December 10, 2013 7:02 AM

Answers

  • I am not able to reproduce this. No matter how quickly I hit cancel after pushing the select focus button the app bar always opened.

    Without a repro, my best guess is that there is a race condition with Window activation. If you monitor the Window.Current.Activated event you will see that the window deactivates when the folder picker displays and reactivates when the picker dismisses. Check to see if the window has activated before the app tries to open the app bar in the bad case.

                Window.Current.Activated += (s, e) =>
                {
                    System.Diagnostics.Debug.WriteLine("Activated: {0}", e.WindowActivationState);
                };

    As a workaround you could try putting a small delay in before bringing up the app bar.

    --Rob

    Saturday, December 14, 2013 1:55 AM
    Moderator

All replies

  • Can you explain in more detail what your code is doing? Sharing a minimal repro project on your SkyDrive along with exact repro steps would be ideal.
    Tuesday, December 10, 2013 8:13 AM
    Moderator
  • Hi,

    Thank you for your reply.

    I have prepared the sample code and uploaded to SkyDrive. Please find the link.

    <<https://skydrive.live.com/redir?resid=ABA3A61BE5950139%21958>>

    Please follow below steps to reproduce the issue in the sample app.

    1. Launch the app.

    2. Select "Select Folder" button.

    3. The Folder Picker UI will be displayed and immediately click "Cancel" button.

    Note:

    For low speed machine we can easily reproduce the issue.

    But higher configuration machine, we need to immediately click "Cancel" button while opening the Folder Picker UI. In between "Select Folder" click and "Cancel" button click of of the Folder Picker UI only some fraction of second gap should be there.

    Thank in advance.

    Regards,

    Hari.

    Tuesday, December 10, 2013 10:39 AM
  • Hi Hari,

    Can you please provide the sample in a zip file rather than as a rar file?

    --Rob

    Tuesday, December 10, 2013 8:54 PM
    Moderator
  • Hi,

    Thank you for your support.

    Please find the zip file from the below location.

    https://skydrive.live.com/redir?resid=ABA3A61BE5950139%21959

    Thank in advance.

    Regards,

    Hari.

    Wednesday, December 11, 2013 4:40 AM
  • I am not able to reproduce this. No matter how quickly I hit cancel after pushing the select focus button the app bar always opened.

    Without a repro, my best guess is that there is a race condition with Window activation. If you monitor the Window.Current.Activated event you will see that the window deactivates when the folder picker displays and reactivates when the picker dismisses. Check to see if the window has activated before the app tries to open the app bar in the bad case.

                Window.Current.Activated += (s, e) =>
                {
                    System.Diagnostics.Debug.WriteLine("Activated: {0}", e.WindowActivationState);
                };

    As a workaround you could try putting a small delay in before bringing up the app bar.

    --Rob

    Saturday, December 14, 2013 1:55 AM
    Moderator