From 3bc97db54d1a1b225e7c6a9b82d1f9182043778f Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Fri, 28 Feb 2025 19:22:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96pc=E5=AE=9E=E9=AA=8C=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Tools/AsposeHelper.cs | 12 +++++++----- Assets/Scripts/UI/UIScore.cs | 7 ++++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/Tools/AsposeHelper.cs b/Assets/Scripts/Tools/AsposeHelper.cs index db787fc5..f0bafae1 100644 --- a/Assets/Scripts/Tools/AsposeHelper.cs +++ b/Assets/Scripts/Tools/AsposeHelper.cs @@ -5,14 +5,14 @@ using System.IO; using UnityEngine; using System.Windows.Forms; using Newtonsoft.Json.Linq; +using System; public class AsposeHelper : MonoBehaviour { - public static void Writer(string json) + public static void Writer(string json, Action callback = null) { - Debug.LogError(File.Exists(Global.reportDemoPath)); // Wordĵ Document doc = new Document(Global.reportDemoPath); @@ -25,21 +25,23 @@ public class AsposeHelper : MonoBehaviour doc.Range.Replace($"{{{key}}}", $"{value}", new FindReplaceOptions()); } // 滻ı - SaveWithDialog(doc); + SaveWithDialog(doc, callback); //Debug.Log("ĵɣĵѱ浽: " + outputFilePath); } - private static void SaveWithDialog(Document doc) + private static void SaveWithDialog(Document doc, Action callback) { SaveFileDialog dialog = new SaveFileDialog(); dialog.Filter = "Wordĵ|*.docx"; - if (dialog.ShowDialog() == DialogResult.OK) + var result = dialog.ShowDialog(); + if (result == DialogResult.OK) { doc.Save(dialog.FileName); } + callback?.Invoke(result); } } diff --git a/Assets/Scripts/UI/UIScore.cs b/Assets/Scripts/UI/UIScore.cs index 68ff27c3..1b8d5ea4 100644 --- a/Assets/Scripts/UI/UIScore.cs +++ b/Assets/Scripts/UI/UIScore.cs @@ -36,7 +36,12 @@ namespace QFramework.Example }); loader.LoadAsync(); #elif UNITY_STANDALONE_WIN - AsposeHelper.Writer(GetScoreDataJson()); + DownLoad.interactable = false; + AsposeHelper.Writer(GetScoreDataJson(), result => + { + Debug.LogError("111"); + DownLoad.interactable = true; + }); #endif