几个小时以来,我一直在努力,阅读(一遍又一遍)我可以在 MSDN 和 Windows Dev Center 上找到的教程;没有任何效果。
我似乎无法从纯文本文件中读取数据!
是的,我已经添加了文件关联,是的,我已经在我的项目中添加了声明。
来自msdn的代码:
(function () {
"use strict";
WinJS.UI.Pages.define("/pages/home/home.html", {
// This function is called whenever a user navigates to this page. It
// populates the page elements with the app's data.
ready: function (element, options) {
// TODO: Initialize the page here.
Windows.Storage.FileIO.readTextAsync("AvailableBalance.sv").then(function (contents) {
// Add code to process the text read from the file
document.getElementById("AvailableBalanceText").innerText = contents;
});
}
});
});
和:
<h1 id="AvailableBalanceText"></h1>
不工作。该应用程序加载正常 - 但只是不从文件中读取(或不显示数据)。
有人可以告诉我我在这里做错了什么吗?