private void OnUnlockCommand(object parameter)
{
   StorageFile file = await Windows.Storage.ApplicationData.
   Current.TemporaryFolder.CreateFileAsync("filename", CreationCollisionOption.ReplaceExisting);
}

The code above will fail with the error message:

Error    2    The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'.

To solve this you must add async to the method declaration like below:
private async void OnUnlockCommand(object parameter) 
{
StorageFile file = await Windows.Storage.ApplicationData.
Current.TemporaryFolder.CreateFileAsync("filename", CreationCollisionOption.ReplaceExisting);
}

相关文章:

  • 2022-01-11
  • 2021-11-07
  • 2021-12-28
  • 2022-12-23
  • 2021-06-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-02
  • 2021-07-01
  • 2022-12-23
  • 2022-12-23
  • 2021-07-23
  • 2021-09-07
  • 2021-07-25
相关资源
相似解决方案