public void AskQuestion(string question, bool sendNotification) { // Anything to process? if (question == "") { return; } // Add question to history ChatHistory.Text += string.Format("\nHuman: {0}", question); // Clear input ChatInput.Text = ""; // Get response var response = Eliza.ProcessInput(question); // Add Eliza's response to history ChatHistory.Text += string.Format("\nEliza: {0}\n", response); // Scroll output to bottom var bottom = new NSRange(ChatHistory.Text.Length - 1, 1); ChatHistory.ScrollRangeToVisible(bottom); // Sending a user notification as well if (sendNotification) { var content = new UNMutableNotificationContent(); content.Title = "ElizaChat Question"; content.Subtitle = question; content.Body = response; var trigger = UNTimeIntervalNotificationTrigger.CreateTrigger(5, false); var requestID = "ElizaQuestion"; var request = UNNotificationRequest.FromIdentifier(requestID, content, trigger); UNUserNotificationCenter.Current.AddNotificationRequest(request, (err) => { if (err != null) { Console.WriteLine("Error: {0}", err); } }); } }