Пример #1
0
        /// <summary>
        /// Handles the create task list.
        /// </summary>
        /// <remarks>
        /// "Make a grocery list with apples, bananas, and pears in TasksNotes"
        /// </remarks>
        public void HandleCreateTaskList(INCreateTaskListIntent intent, Action <INCreateTaskListIntentResponse> completion)
        {
            Console.WriteLine("Create a task list");
            var userActivity = new NSUserActivity("INCreateTaskListIntent");
            var list         = TaskList.FromIntent(intent);
            // TODO: have to create the list and tasks... in your app data store
            var response = new INCreateTaskListIntentResponse(INCreateTaskListIntentResponseCode.Success, userActivity)
            {
                CreatedTaskList = list
            };

            completion(response);
        }
Пример #2
0
        public void HandleCreateTaskList(INCreateTaskListIntent intent, Action <INCreateTaskListIntentResponse> completion)
        {
            Console.WriteLine("Create a task list");
            var userActivity = new NSUserActivity("INCreateTaskListIntent");

            var tasks = new List <INTask>();

            if (intent.TaskTitles != null)
            {
                foreach (var t in intent.TaskTitles)
                {
                    var ta = new INTask(t, INTaskStatus.NotCompleted, INTaskType.Completable, null, null, null, null, "mytask");
                    tasks.Add(ta);
                }
            }

            var response = new INCreateTaskListIntentResponse(INCreateTaskListIntentResponseCode.Success, userActivity)
            {
                CreatedTaskList = new INTaskList(intent.Title, tasks.ToArray(), intent.GroupName, null, null, "mylist")
            };

            completion(response);
        }