C# 使用C的Windows Phone应用程序中的文件大小限制#

C# 使用C的Windows Phone应用程序中的文件大小限制#,c#,windows-phone-8,C#,Windows Phone 8,我是Windows Phone应用程序的新手。在我的应用程序中,上载文件时需要添加不超过50kb的文件大小限制 代码: public sealed class OpenFileDialog { public string Filter { get; set; } internal static object ShowDialog() { throw new NotImplementedException(); } public stati

我是Windows Phone应用程序的新手。在我的应用程序中,上载文件时需要添加不超过50kb的文件大小限制

代码:

public sealed class OpenFileDialog
{
    public string Filter { get; set; }

    internal static object ShowDialog()
    {
        throw new NotImplementedException();
    }
    public static object DialogResult { get; set; }
    public static string FileName { get; set; }
}

if (OpenFileDialog.ShowDialog() == System.Windows.Controls.DialogResult.OK)
{
    FileStream fs = File.OpenRead(OpenFileDialog.FileName);
    if (fs.Length > 51200)
    {
        MessageBox.Show("Image size must not exceed 50kb.");
        return;
    }
    System.Windows.Controls.Image myImage = new System.Windows.Controls.Image();
    myImage.Source = bmp;
}
namespace dialogresult doesn't exist in the namespace system.windows.controls(missing a assembly reference) 但它显示出错误

错误:

public sealed class OpenFileDialog
{
    public string Filter { get; set; }

    internal static object ShowDialog()
    {
        throw new NotImplementedException();
    }
    public static object DialogResult { get; set; }
    public static string FileName { get; set; }
}

if (OpenFileDialog.ShowDialog() == System.Windows.Controls.DialogResult.OK)
{
    FileStream fs = File.OpenRead(OpenFileDialog.FileName);
    if (fs.Length > 51200)
    {
        MessageBox.Show("Image size must not exceed 50kb.");
        return;
    }
    System.Windows.Controls.Image myImage = new System.Windows.Controls.Image();
    myImage.Source = bmp;
}
namespace dialogresult doesn't exist in the namespace system.windows.controls(missing a assembly reference) 命名空间system.windows.controls中不存在命名空间dialogresult(缺少程序集引用)
有人帮我解决此错误吗?

您试图使用System.Windows.Forms命名空间中的枚举,而Windows Phone 8库中不存在此类打开文件对话框。在不了解更多有关文件访问场景的信息的情况下,我将指出您的选项包括:

  • 应用程序隔离存储
  • 已知文件夹(WP 8.1仅包括音乐、视频、照片和SD卡存储)

我将向您指出这一点,这可能会带您到达您需要的特定位置,但我应该指出,由于电话设备上最常用的可访问文件的大小很少为50kb或更小,因此我们可能需要有关您的用例的更多信息。

windows phone 8中是否有文件对话框选项??