Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在Windows Phone 8.1 Silverlight应用程序中处理文件激活_C#_Windows Phone 8.1 - Fatal编程技术网

C# 如何在Windows Phone 8.1 Silverlight应用程序中处理文件激活

C# 如何在Windows Phone 8.1 Silverlight应用程序中处理文件激活,c#,windows-phone-8.1,C#,Windows Phone 8.1,有没有办法处理Windows Phone 8.1 Silverlight应用程序中的文件激活?我希望用户在选择特定类型的文件时选择我的应用程序。我至少可以使用清单xml代码将文件类型关联添加到清单文件中,因为清单设计器中没有该关联 <Extension Category="windows.fileTypeAssociation"> <FileTypeAssociation Name="alsdk"> <DisplayName>SDK Samp

有没有办法处理Windows Phone 8.1 Silverlight应用程序中的文件激活?我希望用户在选择特定类型的文件时选择我的应用程序。我至少可以使用清单xml代码将文件类型关联添加到清单文件中,因为清单设计器中没有该关联

<Extension Category="windows.fileTypeAssociation">
   <FileTypeAssociation Name="alsdk">
      <DisplayName>SDK Sample File Type</DisplayName>
      <Logo>images\logo.png</Logo>
      <InfoTip>SDK Sample tip </InfoTip>
      <EditFlags OpenIsSafe="true"/>
      <SupportedFileTypes>
         <FileType ContentType="image/jpeg">.alsdk</FileType>
      </SupportedFileTypes>
   </FileTypeAssociation>
</Extension>

根据这种机制,Windows应用商店应用程序和Windows Phone应用商店应用程序都可以工作。我想知道是否可以在Windows Phone 8.1 Silverlight应用程序中使用它。

对于Windows Phone Silverlight应用程序,您将在WMAppManifest.xml中注册文件关联。基本注册基本相同,但启动略有不同,因为Silverlight应用程序和运行时应用程序的激活方式不同

Silverlight应用程序将以 包含FileTypeAssociation标记和filetoken的深度链接URI,可通过SharedStorageAccessManager打开


Windows Phone Silverlight开发文档中有一个示例代码:

我尝试过并成功启动了我的应用程序,但无法获取存储文件。SharedStorageAccessManager只有两种方法。第一个GetSharedFileName,它只返回选定的文件名(甚至不返回其路径)。第二个是CopySharedFileAsync,它将文件复制到所需的位置。是否仍然可以从StorageApplicationPermissions.FutureAccessList.GetFileAsync(令牌)中的令牌获取StorageFile;
protected override void OnFileActivated(FileActivatedEventArgs args)
{
   // TODO: Handle file activation

   // The number of files received is args.Files.Size
   // The first file is args.Files[0].Name
}