【问题标题】:Windows 8 File Access and the ms-appx:/// protocolWindows 8 文件访问和 ms-appx:/// 协议
【发布时间】:2013-01-21 02:59:20
【问题描述】:

是否可以在不使用“ms-appx:///”协议的情况下在 Windows 8 C# 中访问文件(例如图像、音频和视频)?

【问题讨论】:

    标签: c# xaml windows-8


    【解决方案1】:

    如果您正在访问最终用户的图像/等,您可以在没有 ms-appx 的情况下执行此操作(其中文件的类型为 StorageFile):

    var fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
    BitmapImage img = new BitmapImage();
    img.SetSource(fileStream);
    

    如果您包含图像/等。在您的应用程序中,您可以使用 ms-appx 协议。它本质上意味着“从应用程序包中获取它”。但您也可以使用相对路径。见this article on how to load file resources

    【讨论】:

      猜你喜欢
      • 2013-09-23
      • 1970-01-01
      • 2020-11-16
      • 1970-01-01
      • 2015-08-27
      • 2013-09-08
      • 2014-02-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多