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);
        }
Esempio n. 2
0
        public void DonateShowReport()
        {
            if (!UIDevice.CurrentDevice.CheckSystemVersion(12, 0))
            {
                return;
            }

            var intent      = new ShowReportIntent();
            var interaction = new INInteraction(intent, null);

            interaction.DonateInteraction(onCompletion);
        }
        public void DonateShowReport()
        {
            if (!UIDevice.CurrentDevice.CheckSystemVersion(12, 0))
            {
                return;
            }

            var intent = new ShowReportIntent();

            intent.SuggestedInvocationPhrase = Resources.ShowReportsInvocationPhrase;
            var interaction = new INInteraction(intent, null);

            interaction.DonateInteraction(trackError);
        }
        public INIntent CreateIntent(SiriShortcutType shortcutType)
        {
            switch (shortcutType)
            {
            case SiriShortcutType.Start:
                var startTimerIntent = new StartTimerIntent();
                startTimerIntent.SuggestedInvocationPhrase = Resources.StartTimerInvocationPhrase;
                return(startTimerIntent);

            case SiriShortcutType.StartFromClipboard:
                var startTimerWithClipboardIntent = new StartTimerFromClipboardIntent();
                return(startTimerWithClipboardIntent);

            case SiriShortcutType.Continue:
                var continueTimerIntent = new ContinueTimerIntent();
                continueTimerIntent.SuggestedInvocationPhrase = Resources.ContinueTimerInvocationPhrase;
                return(continueTimerIntent);

            case SiriShortcutType.Stop:
                var stopTimerIntent = new StopTimerIntent();
                stopTimerIntent.SuggestedInvocationPhrase = Resources.StopTimerInvocationPhrase;
                return(stopTimerIntent);

            case SiriShortcutType.ShowReport:
                var showReportIntent = new ShowReportIntent();
                showReportIntent.SuggestedInvocationPhrase = Resources.ShowReportsInvocationPhrase;
                return(showReportIntent);

            /*
             * case SiriShortcutType.CustomStart:
             *  break;
             * case SiriShortcutType.CustomReport:
             *  break;
             */
            default:
                throw new ArgumentOutOfRangeException(nameof(shortcutType), shortcutType, null);
            }
        }