We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I tried to create a toast with ProgressBar. I tried using the method in Microsoft Learn but it didn't work.
Please let me know what I should do.
This is my code:
public async Task Download(MinecraftDownloadInfomation DownloadInfomation) { ToastContent DownloadToastContent = new ToastContentBuilder().AddText("正在下载 " + DownloadInfomation.Version).AddVisualChild(new AdaptiveProgressBar() { Title = "下载进度", Value = new BindableProgressBarValue("ProgressValue"), ValueStringOverride = new BindableString("ProgressValueString"), Status = new BindableString("ProgressStatus") }).GetToastContent(); ToastNotification DownloadToast = new ToastNotification(DownloadToastContent.GetXml()); string DownloadToastTag = DownloadInfomation.Version; string DownloadToastGroup = "HyperMinecraftLauncher-GameDownload"; DownloadToast.Tag = DownloadToastTag; DownloadToast.Group = DownloadToastGroup; DownloadToast.Data = new NotificationData(); DownloadToast.Data.Values["ProgressValue"] = "0"; DownloadToast.Data.Values["ProgressValueString"] = "下载中"; DownloadToast.Data.Values["ProgressStatus"] = "创建文件夹"; DownloadToast.Data.SequenceNumber = 1; DownloadToast.SuppressPopup = false; ToastNotificationManager.CreateToastNotifier().Show(DownloadToast); //this try { System.IO.Directory.CreateDirectory("./.minecraft/" + DownloadInfomation.Version); } catch (Exception e) { new ToastContentBuilder().AddText("我们无法为你创建游戏文件夹").AddText("游戏下载中断").AddText(e.Message).Show(); return; } try { HttpClient Client = new HttpClient(); Client.DefaultRequestHeaders.Accept.Clear(); Client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("text/html")); Client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/xhtml+xml")); Client.DefaultRequestHeaders.Add("User-Agent", ".NET Foundation Repository Reporter"); System.IO.Stream UnprocessedManifestStream = await Client.GetStreamAsync("https://piston-meta.mojang.com/v1/packages/c18d3537d1c262a5527126b317dcf6056f7d8e4d/23w44a.json"); using (System.IO.Stream FileStream = System.IO.File.Create("./.minecraft/" + DownloadInfomation.Version + "/" + DownloadInfomation.Version + ".json")) { await UnprocessedManifestStream.CopyToAsync(FileStream); UnprocessedManifestStream.Close(); } string UnprocessedManifest = System.IO.File.ReadAllText("./.minecraft/" + DownloadInfomation.Version + "/" + DownloadInfomation.Version + ".json"); } catch (Exception e) { new ToastContentBuilder().AddText("我们无法为你下载游戏核心文件").AddText("游戏下载中断").AddText(e.Message).Show(); return; } }
When I call this function, it doesn't pop up a toast as expected.
The text was updated successfully, but these errors were encountered:
drewbatgit
No branches or pull requests
I tried to create a toast with ProgressBar. I tried using the method in Microsoft Learn but it didn't work.
Please let me know what I should do.
This is my code:
When I call this function, it doesn't pop up a toast as expected.
The text was updated successfully, but these errors were encountered: