Wpis z mikrobloga

@krecikBMC: Już tłumaczę. Mam kod:

public testPage()
{
this.InitializeComponent();
Helpers.readNotesDataAsync();

this.navigationHelper = new NavigationHelper(this);
this.navigationHelper.LoadState += this.NavigationHelper_LoadState;
this.navigationHelper.SaveState += this.NavigationHelper_SaveState;

}

i

public async static Task readNotesDataAsync()
{
Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
StorageFile sampleFile = await localFolder.GetFileAsync("storage.txt");
String timestamp = await FileIO.ReadTextAsync(sampleFile);
return timestamp;
}

Jak mogę w testPage przeczytać to co zwraca readNotesDataAsync()? jest to metoda generowana przez VS i nie mogę jej zrobić jako async.. A problem taki że
  • Odpowiedz
Jak mogę w testPage przeczytać to co zwraca readNotesDataAsync()?


@Sierran: Szybka wersj? podepnij to do eventu Loaded, wygeneruje Ci metodę do override a tam już będziesz mógł zrobić z niej async Task/void i w środku dasz textBox.text = await Helpers.readNotesDataAsync();
  • Odpowiedz