简体   繁体   English

在Windows Phone Silverlight 8.1中获取名称空间

[英]get namespace in windows phone silverlight 8.1

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. 在创建Windows Phone应用程序时,我添加了一项功能,即使用Windows Phone 8应用程序使用本文从SDCard添加文件。 After this I re targeted to windows phone 8.1 which became Windows phone silverlight 8.1 app . 之后,我将目标对准Windows Phone 8.1,这成为Windows phone silverlight 8.1 app Now I'm trying to add Filepicker support which is Add file from Phone or SDCard. 现在,我尝试添加Filepicker支持,即从Phone或SDCard添加文件。 I tried this sample which is Windows phone 8.1 . 我尝试了Windows phone 8.1这个示例

For this I have to add ContinutionManager Class which having namespaces suggested from this documentation 为此,我必须添加ContinutionManager类,该类具有本文档中建议的名称空间

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

在此处输入图片说明

So. 所以。 What are the options available for me to add namespace which windows phone 8 app is targeted to windows phone 8.1 我可以使用哪些选项来添加将Windows Phone 8应用定位到Windows Phone 8.1的命名空间

Edit: 编辑:

In other Words: 换一种说法:

在此处输入图片说明

If you use Blank App(Windows Phone) I can able to use namespace. 如果您使用空白应用程序(Windows Phone),则可以使用名称空间。 & using Blank App(Windows phone Silverlight) I can't get the namespace &使用空白应用程序(Windows Phone Silverlight)我无法获取名称空间

The FilePicker API is supported in both Windows Phone 8.1 Silverlight apps and Windows Phone Runtime apps. Windows Phone 8.1 Silverlight应用程序和Windows Phone Runtime应用程序均支持FilePicker API。 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]" 如果查看Pick ... AndContinue方法文档 ,则会看到它们支持“ Windows Phone 8.1 [Windows Phone Silverlight 8.1和Windows Runtime应用程序]”。

The ContinuationManager class is from the File Picker sample for Runtime apps. ContinuationManager类来自用于运行时应用程序的File Picker示例。 It is a convenience class for Windows Runtime apps and doesn't do anything you can't implement on its own. 它是Windows运行时应用程序的便捷类,它不会执行您无法单独实现的任何操作。 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. 因为它来自Windows运行时示例,所以不能在Silverlight应用程序中使用,但是它包装的基本概念仍然有效。 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. 调用文件选择器主题后,有一个Continue Windows Phone Silverlight 8.1应用程序,这是该问题中链接的AndContinue方法调用后如何继续Windows Phone Store应用程序的Silverlight版本。

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. AndContinue方法的基本概念是,当应用程序选择文件时,该应用程序可以关闭以切换到文件选择器。 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. 这将通过app.xaml.cs中的标准合同激活过程完成,然后导航回该页面。

  1. When you want to call the picker save any necessary state information in the picker's ContinuationData and call the ...AndContinue method 当您想调用选择器时,将所有必要的状态信息保存在选择器的ContinuationData中,然后调用... AndContinue方法

  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. Application_ContractActivated事件(在app.xaml.cs中-当前模板默认情况下进行连接。如果没有,则可以连接PhoneApplicationService.Current.ContractActivated事件)将运行并接收一个... PickerContinationEventArgs对象,该对象包含应用程序在调用前保存的ContinuationData以及从用户处选择的文件信息。

  5. In Application_ContractActivated save the event args so they can be used later 在Application_ContractActivated中保存事件args,以便以后使用

  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. 在OnNavigatedTo中,检索保存的事件args并根据需要处理它们。

Continue your Windows Phone Silverlight 8.1 app after calling a file picker has code snippets walking through these steps 调用文件选择器并执行以下步骤的代码段后,继续运行Windows Phone Silverlight 8.1应用程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM