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);
        }
        private INRelevantShortcut createRelevantShortcut(INIntent intent)
        {
            var shortcut         = new INShortcut(intent);
            var relevantShortcut = new INRelevantShortcut(shortcut);

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

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

            // Return this class instance as the Intents handler
            return(this);
        }
Exemple #5
0
 public override NSObject GetHandler(INIntent intent)
 {
     if (intent is OrderSoupIntent)
     {
         return(new OrderSoupIntentHandler());
     }
     throw new Exception("Unhandled intent type: ${intent}");
 }
Exemple #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);
        }
        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}");
            }
        }
        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));
        }
Exemple #9
0
        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}");
        }
Exemple #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);
            }
        }