From ccd5b1c8dc2d0399745779fb4f9a261d24d75a6d Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期二, 23 十一月 2021 14:43:13 +0800 Subject: [PATCH] 备份 --- HDL-ON_iOS/Other/Siri/VoiceShortcutDataManager.cs | 38 +++++++++++++++++++++++++++++++++++++- 1 files changed, 37 insertions(+), 1 deletions(-) diff --git a/HDL-ON_iOS/Other/Siri/VoiceShortcutDataManager.cs b/HDL-ON_iOS/Other/Siri/VoiceShortcutDataManager.cs index 041374d..98ba68b 100644 --- a/HDL-ON_iOS/Other/Siri/VoiceShortcutDataManager.cs +++ b/HDL-ON_iOS/Other/Siri/VoiceShortcutDataManager.cs @@ -8,6 +8,7 @@ using System; using Intents; using System.Linq; +using HDLSceneSiri; namespace Other.Siri { @@ -20,11 +21,16 @@ UpdateVoiceShortcuts(null); } + public VoiceShortcutDataManager(Action action) + { + UpdateVoiceShortcuts(action); + } + public INVoiceShortcut VoiceShortcutForOrder(SiriScene ss) { var voiceShortcut = VoiceShortcuts.FirstOrDefault((shortcut) => { - var intent = shortcut.Shortcut.Intent as HdlSiri.HDLRunSceneIntent; + var intent = shortcut.Shortcut.Intent as HDLRunSceneIntent; if (intent is null) { return false; } var orderFromIntent = SiriScene.FromOrderSoupIntent(intent); if (orderFromIntent is null) { return false; } @@ -33,6 +39,36 @@ return voiceShortcut; } + + public INVoiceShortcut VoiceShortcutForOrder2(SiriScene ss) + { + var voiceShortcut = VoiceShortcuts.FirstOrDefault((shortcut) => + { + var intent = shortcut.Shortcut.Intent as HDLRunSceneIntent; + if (intent is null) { return false; } + var orderFromIntent = SiriScene.FromOrderSoupIntent(intent); + if (orderFromIntent is null) { return false; } + return ss.IsEqual(orderFromIntent); + }); + return voiceShortcut; + } + + public INVoiceShortcut FirstTemp () + { + try + { + if(VoiceShortcuts == null) + { + UpdateVoiceShortcuts(null); + } + return VoiceShortcuts[0]; + } + catch + { + return null; + } + } + public void UpdateVoiceShortcuts(Action completion) { INVoiceShortcutCenter.SharedCenter.GetAllVoiceShortcuts((voiceShortcutsFromCenter, error) => -- Gitblit v1.8.0