1
votes

As I'm creating a windows phone application I added a feature of adding a file from SDCard using this article which was a windows phone 8 application. After this I re targeted to windows phone 8.1 which became Windows phone silverlight 8.1 app. Now I'm trying to add Filepicker support which is Add file from Phone or SDCard. I tried this sample which is Windows phone 8.1.

For this I have to add ContinutionManager Class which having namespaces suggested from this documentation

using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls; 

enter image description here

So. What are the options available for me to add namespace which windows phone 8 app is targeted to windows phone 8.1

Edit:

In other Words:

enter image description here

If you use Blank App(Windows Phone) I can able to use namespace. & using Blank App(Windows phone Silverlight) I can't get the namespace

1

1 Answers

1
votes

The FilePicker API is supported in both Windows Phone 8.1 Silverlight apps and Windows Phone Runtime apps. If you look at the Pick...AndContinue method documentation you'll see that they support "Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]"

The ContinuationManager class is from the File Picker sample for Runtime apps. It is a convenience class for Windows Runtime apps and doesn't do anything you can't implement on its own. Because it's from a Windows Runtime sample it cannot be used in a Silverlight app, but the basic concepts that it wraps are still valid. There is a Continue your Windows Phone Silverlight 8.1 app after calling a file picker topic which is the Silverlight version of the How to continue your Windows Phone Store app after calling an AndContinue method linked in the question.

The basic concept of the AndContinue methods is that when the app picks a file the app can close to switch to the file picker. This allows things to run smoothly on low memory systems. After the user has picked a file the app will be reactivated with the continuation information. This goes through the standard contract activation process in app.xaml.cs and then navigates back to the page.

  1. When you want to call the picker save any necessary state information in the picker's ContinuationData and call the ...AndContinue method

  2. The phone switches away from the app to the picker

  3. When the user picks a file the app is reactivated

  4. The Application_ContractActivated event (in app.xaml.cs - the current templates wire this up by default. If you don't have it you can wire up the PhoneApplicationService.Current.ContractActivated event) will run and receive a ...PickerContinationEventArgs object which contains the ContinuationData the app saved before calling and the picked file information from the user.

  5. In Application_ContractActivated save the event args so they can be used later

  6. The navigation service will navigate the app back to the original page.

  7. In OnNavigatedTo retrieve the saved event args and handle them as needed.

Continue your Windows Phone Silverlight 8.1 app after calling a file picker has code snippets walking through these steps