所以我決定在這里寫下我自己的答案,因為我不確定其他人是否會解決這個問題。我懷疑的一件事是我最近將 C# 語言更新到了 v7.3,因為 VS 2017 在編寫一些代碼時是這樣說的。也許問題與此有關(guān),但到目前為止我的解決方案在最小化狀態(tài)下工作。我還想在此聲明,我BackgroundTask首先實施以ApplicationTrigger在需要時觸發(fā)該過程來克服這個問題,但老實說這是一種黑客攻擊??匆幌麓a:public static async Task<string> GetBackgroundTaskReturnValue(string apiRequestUrl){ StaticItemsHelper.IsBackgroundPlaylistTaskRunning = true; if (StaticItemsHelper.IsBackgroundPlaylistTaskRunning) { for (int seconds = 0; seconds < 20;) { if (!StaticItemsHelper.IsBackgroundPlaylistTaskRunning) { break; } else { Task.Delay(1000).Wait(); } } } var request = BackgroundTaskHelper.BackgroundPlaylistTrigger.RequestAsync().GetResults(); if (request == Windows.ApplicationModel.Background.ApplicationTriggerResult.Allowed) { SettingsHelper.localSettings.Values[SettingsHelper.BackgroundPlaylistPlaybackURLKey] = apiRequestUrl; SettingsHelper.localSettings.Values[SettingsHelper.BackgroundPlaylistPlaybackTokenKey] = StaticItemsHelper.CurrentUserAccessToken; if (SettingsHelper.tempFolder.TryGetItemAsync(SettingsHelper.BackgroundPlaylistPlaybackReturnKey).GetResults() is StorageFile file) { await file.DeleteAsync(); } for (int seconds = 0; seconds < 30;) { if (SettingsHelper.tempFolder.TryGetItemAsync(SettingsHelper.BackgroundPlaylistPlaybackReturnKey).GetResults() is StorageFile _rfile) {
POST Guid to WebAPI 接收為 NULL
牛魔王的故事
2021-11-21 10:07:39