コード例 #1
0
        public override NSObject GetHandler(INIntent intent)
        {
            // This is the default implementation.  If you want different objects to handle different intents,
            // you can override this and return the handler you want for that particular intent.

            return(this);
        }
コード例 #2
0
        private INRelevantShortcut createRelevantShortcut(INIntent intent)
        {
            var shortcut         = new INShortcut(intent);
            var relevantShortcut = new INRelevantShortcut(shortcut);

            relevantShortcut.RelevanceProviders = new List <INRelevanceProvider>().ToArray();
            return(relevantShortcut);
        }
コード例 #3
0
		public override NSObject GetHandler (INIntent intent)
		{
			// Load the address book
			AddressBook.LoadAddressBook ();

			// Return this class instance as the Intents handler
			return this;
		}
コード例 #4
0
        public override NSObject GetHandler(INIntent intent)
        {
            // Load the address book
            AddressBook.LoadAddressBook();

            // Return this class instance as the Intents handler
            return(this);
        }
コード例 #5
0
 public override NSObject GetHandler(INIntent intent)
 {
     if (intent is OrderSoupIntent)
     {
         return(new OrderSoupIntentHandler());
     }
     throw new Exception("Unhandled intent type: ${intent}");
 }
コード例 #6
0
        public override NSObject GetHandler(INIntent intent)
        {
            // This is the default implementation.  If you want different objects to handle different intents,
            // you can override this and return the handler you want for that particular intent.
            Console.WriteLine("get the intent handler");

            // otherwise, we always return "this" one
            return(this);
        }
コード例 #7
0
        public override NSObject GetHandler(INIntent intent)
        {
            switch (intent)
            {
            case StopTimerIntent _:
                return(new StopTimerIntentHandler(APIHelper.GetTogglAPI()));

            case StartTimerIntent _:
                return(new StartTimerIntentHandler(APIHelper.GetTogglAPI()));

            default:
                throw new Exception("Unhandled intent type: ${intent}");
            }
        }
コード例 #8
0
        public static SiriShortcutType ShortcutType(this INIntent intent)
        {
            if (intent is StartTimerIntent startTimerIntent)
            {
                if (startTimerIntent.EntryDescription != null ||
                    startTimerIntent.Billable != null ||
                    startTimerIntent.Tags != null ||
                    startTimerIntent.ProjectId != null)
                {
                    return(SiriShortcutType.CustomStart);
                }

                return(SiriShortcutType.Start);
            }

            if (intent is StartTimerFromClipboardIntent startFromClipboardTimerIntent)
            {
                if (startFromClipboardTimerIntent.Billable != null ||
                    startFromClipboardTimerIntent.Tags != null ||
                    startFromClipboardTimerIntent.ProjectId != null)
                {
                    return(SiriShortcutType.CustomStart);
                }

                return(SiriShortcutType.StartFromClipboard);
            }

            if (intent is StopTimerIntent)
            {
                return(SiriShortcutType.Stop);
            }

            if (intent is ContinueTimerIntent)
            {
                return(SiriShortcutType.Continue);
            }

            if (intent is ShowReportIntent)
            {
                return(SiriShortcutType.ShowReport);
            }

            if (intent is ShowReportPeriodIntent)
            {
                return(SiriShortcutType.CustomReport);
            }

            throw new ArgumentOutOfRangeException(nameof(intent));
        }
コード例 #9
0
ファイル: IntentHandler.cs プロジェクト: l1pton17/Diabetto
        public override NSObject GetHandler(INIntent intent)
        {
            Console.WriteLine("Get the intent handler");

            switch (intent)
            {
            case AddMeasureIntent _:
                return(new AddMeasureIntentHandler());

            case AddShortInsulinIntent _:
                return(new AddShortInsulinIntentHandler());
            }

            throw new InvalidOperationException($"Unhandled intent type: ${intent}");
        }
コード例 #10
0
        public SiriShortcut(INVoiceShortcut voiceShortcut)
        {
            VoiceShortcut = voiceShortcut;
            Identifier    = voiceShortcut.Identifier.AsString();
            Intent        = voiceShortcut.Shortcut.Intent;
            Type          = Intent.ShortcutType();

            if (Intent is ShowReportPeriodIntent showReportPeriodIntent)
            {
                Parameters.WorkspaceId   = stringToLong(showReportPeriodIntent.Workspace?.Identifier);
                Parameters.WorkspaceName = showReportPeriodIntent.Workspace?.DisplayString;
                Parameters.ReportPeriod  = showReportPeriodIntent.Period.ToReportPeriod();
            }

            if (Intent is StartTimerIntent startTimerIntent)
            {
                Parameters.Description   = startTimerIntent.EntryDescription;
                Parameters.WorkspaceId   = stringToLong(startTimerIntent.Workspace?.Identifier);
                Parameters.WorkspaceName = startTimerIntent.Workspace?.DisplayString;
                Parameters.Billable      = startTimerIntent.Billable?.Identifier == "True";
                Parameters.Tags          = startTimerIntent.Tags == null
                    ? null
                    : stringToLongCollection(startTimerIntent.Tags.Select(tag => tag.Identifier));
                Parameters.ProjectId = stringToLong(startTimerIntent.ProjectId?.Identifier);
            }

            if (Intent is StartTimerFromClipboardIntent startTimerFromClipboardIntent)
            {
                Parameters.WorkspaceId   = stringToLong(startTimerFromClipboardIntent.Workspace?.Identifier);
                Parameters.WorkspaceName = startTimerFromClipboardIntent.Workspace?.DisplayString;
                Parameters.Billable      = startTimerFromClipboardIntent.Billable?.Identifier == "True";
                Parameters.Tags          = startTimerFromClipboardIntent.Tags == null
                    ? null
                    : stringToLongCollection(startTimerFromClipboardIntent.Tags.Select(tag => tag.Identifier));
                Parameters.ProjectId = stringToLong(startTimerFromClipboardIntent.ProjectId?.Identifier);
            }
        }