0

i create silverlight windows phone 8.1 project and i need to choose all kind of file from windows phone

i used FileOpenPicker for choose the file it redirect correctly and i can choose the file this is my code

       FileOpenPicker openPicker = new FileOpenPicker();
        openPicker.ViewMode = PickerViewMode.List;
        openPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;

        openPicker.FileTypeFilter.Add("*");
        openPicker.PickMultipleFilesAndContinue();

And i follow this msdn for receiving select

In my case if i selecting file and come back to the app its every thing working if i without select any file and come back using mobile hardware back button my app come to home screen. but it need to stay file picker page

my first pageFirst page

second page

Third page

when i press mobile hardware back button in above screen the page redirect to my first page it need to stay in my second page

thanks

Manikandan
  • 844
  • 15
  • 31
  • not quite sure what you want, but have you tried to tap into `protected override void OnBackKeyPress(CancelEventArgs e)` ? Then you can decide what happens on the hardware backbutton. – JTIM May 23 '16 at 09:48
  • JTIM when i press the back button in photo, phone page it should back in my second page (attach button page ) but now it redirect to first page. here back key press wont hit – Manikandan May 23 '16 at 09:56
  • You could then catch the navigation uri out of the page and save a variable, that you then compare upon the app is reactivated. In reactivation you then specify which page you should navigate to. It however seems odd that you do not navigate to sevond screen, thar would be normal behaviour. Have you set the application to tombstone when it is pushed to background? – JTIM May 23 '16 at 10:17
  • JTIM, i done some little hack . in OnNavigatingFrom method please let me know i i did any wrong. please find my answer below – Manikandan May 23 '16 at 10:26

1 Answers1

0

Finally i got the answer and avoid redirection

 bool reset;
        protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
        {

            if(reset && e.uri.tostring().Equals("MainPage.xaml"))
             {
                e.Cancel = true;
                reset = false
             }


        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {

            reset = e.NavigationMode == NavigationMode.Reset;
        }
Manikandan
  • 844
  • 15
  • 31
  • Seems fine, just be aware, that when the user now is inside the app and press backkey, he would probably exit the app. Since there are no navigations in the Navigation-stack. Just for your info :) I can't say if everything works, you would have to test that for your self :) – JTIM May 23 '16 at 11:52