/* * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an AS IS BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using System.Collections.Generic; using System.Threading.Tasks; namespace Tizen.Messaging.Messages { /// /// This class is used for the message management. It allows applications to use the message service. /// /// http://tizen.org/privilege/message.read /// 3 public static class MessagesManager { /// /// Sends a message. /// /// http://tizen.org/privilege/message.write /// The message to be sent. /// The boolean variable used to indicate whether the sent message should be saved in the sentbox or not. /// A task containing the result of message sending. /// Thrown when the method failed due to an invalid operation. /// Thrown when the message service is not supported. /// Thrown when input coordinates are invalid. /// Thrown when an application does not have proper privileges. /// 3 public static Task SendMessageAsync(Message message, bool saveToSentbox) { return MessagesManagerImpl.Instance.SendMessageAsync(message, saveToSentbox); } /// /// Searches for messages. /// /// http://tizen.org/privilege/message.read /// The search filter for searching messages. /// A task containing the messages, which match the search filter. /// Thrown when the method failed due to an invalid operation. /// Thrown when the message service is not supported. /// Thrown when input coordinates are invalid. /// Thrown when failed due to out of memory. /// Thrown when an application does not have proper privileges. /// 3 public static Task> SearchMessageAsync(MessagesSearchFilter filter) { return MessagesManagerImpl.Instance.SearchMessageAsync(filter); } /// /// The MessageReceived event that is raised when receiving a message. /// /// http://tizen.org/privilege/message.read /// 3 static public event EventHandler MessageReceived { add { MessagesManagerImpl.Instance._MessageReceived += value; } remove { MessagesManagerImpl.Instance._MessageReceived -= value; } } } }