private INRelevantShortcut createRelevantShortcut(INIntent intent) { var shortcut = new INShortcut(intent); var relevantShortcut = new INRelevantShortcut(shortcut); relevantShortcut.RelevanceProviders = new List <INRelevanceProvider>().ToArray(); return(relevantShortcut); }
private void setupDefaultShortcuts(IWorkspace workspace) { var startTimerIntent = new StartTimerIntent(); startTimerIntent.Workspace = new INObject(workspace.Id.ToString(), workspace.Name); startTimerIntent.SuggestedInvocationPhrase = Resources.StartTimerInvocationPhrase; var startShortcut = new INShortcut(startTimerIntent); var startRelevantShorcut = new INRelevantShortcut(startShortcut); INRelevanceProvider[] startTimerProviders = { new INDailyRoutineRelevanceProvider(INDailyRoutineSituation.Work), new INDailyRoutineRelevanceProvider(INDailyRoutineSituation.Gym), new INDailyRoutineRelevanceProvider(INDailyRoutineSituation.School) }; startRelevantShorcut.RelevanceProviders = startTimerProviders; var stopTimerIntent = new StopTimerIntent(); stopTimerIntent.SuggestedInvocationPhrase = Resources.StopTimerInvocationPhrase; var stopShortcut = new INShortcut(stopTimerIntent); var stopRelevantShortcut = new INRelevantShortcut(stopShortcut); stopRelevantShortcut.RelevanceProviders = new[] { new INDailyRoutineRelevanceProvider(INDailyRoutineSituation.Home) }; var showReportIntent = new ShowReportIntent(); showReportIntent.SuggestedInvocationPhrase = Resources.ShowReportsInvocationPhrase; var reportShortcut = new INShortcut(showReportIntent); var continueTimerIntent = new ContinueTimerIntent { SuggestedInvocationPhrase = Resources.ContinueTimerInvocationPhrase }; continueTimerIntent.Workspace = new INObject(workspace.Id.ToString(), workspace.Name); var continueTimerShortcut = new INShortcut(continueTimerIntent); var continueTimerRelevantShortcut = new INRelevantShortcut(continueTimerShortcut) { RelevanceProviders = startTimerProviders }; var shortcuts = new[] { startShortcut, stopShortcut, reportShortcut, continueTimerShortcut }; INVoiceShortcutCenter.SharedCenter.SetShortcutSuggestions(shortcuts); var relevantShortcuts = new[] { startRelevantShorcut, stopRelevantShortcut, continueTimerRelevantShortcut }; INRelevantShortcutStore.DefaultStore.SetRelevantShortcuts(relevantShortcuts, trackError); }
private void setupDefaultShortcuts() { INRelevanceProvider[] startTimerRelevanceProviders = { new INDailyRoutineRelevanceProvider(INDailyRoutineSituation.Work), new INDailyRoutineRelevanceProvider(INDailyRoutineSituation.Gym), new INDailyRoutineRelevanceProvider(INDailyRoutineSituation.School) }; INRelevanceProvider[] stopTimerRelevanceProviders = { new INDailyRoutineRelevanceProvider(INDailyRoutineSituation.Home) }; var startShortcut = new INShortcut(CreateIntent(SiriShortcutType.Start)); var startRelevantShorcut = new INRelevantShortcut(startShortcut); startRelevantShorcut.RelevanceProviders = startTimerRelevanceProviders; var startTimerWithClipboardShortcut = new INShortcut(CreateIntent(SiriShortcutType.StartFromClipboard)); var startTimerWithClipboardRelevantShorcut = new INRelevantShortcut(startTimerWithClipboardShortcut); startTimerWithClipboardRelevantShorcut.RelevanceProviders = startTimerRelevanceProviders; var stopShortcut = new INShortcut(CreateIntent(SiriShortcutType.Stop)); var stopRelevantShortcut = new INRelevantShortcut(stopShortcut); stopRelevantShortcut.RelevanceProviders = stopTimerRelevanceProviders; var reportShortcut = new INShortcut(CreateIntent(SiriShortcutType.ShowReport)); var continueTimerShortcut = new INShortcut(CreateIntent(SiriShortcutType.Continue)); var continueTimerRelevantShortcut = new INRelevantShortcut(continueTimerShortcut); continueTimerRelevantShortcut.RelevanceProviders = startTimerRelevanceProviders; var shortcuts = new[] { startShortcut, stopShortcut, reportShortcut, continueTimerShortcut, startTimerWithClipboardShortcut }; INVoiceShortcutCenter.SharedCenter.SetShortcutSuggestions(shortcuts); var relevantShortcuts = new[] { startRelevantShorcut, stopRelevantShortcut, continueTimerRelevantShortcut, startTimerWithClipboardRelevantShorcut }; INRelevantShortcutStore.DefaultStore.SetRelevantShortcuts(relevantShortcuts, trackError); }