2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Collections.Generic;
19 using System.Threading.Tasks;
21 namespace Tizen.Messaging.Messages
24 /// This class is used for the message management. It allows applications to use the message service.
26 /// <privilege>http://tizen.org/privilege/message.read</privilege>
27 /// <since_tizen> 3 </since_tizen>
28 public static class MessagesManager
33 /// <privilege>http://tizen.org/privilege/message.write</privilege>
34 /// <param name="message">The message to be sent.</param>
35 /// <param name="saveToSentbox">The boolean variable used to indicate whether the sent message should be saved in the sentbox or not.</param>
36 /// <returns>A task containing the result of message sending.</returns>
37 /// <exception cref="InvalidOperationException">Thrown when the method failed due to an invalid operation.</exception>
38 /// <exception cref="NotSupportedException">Thrown when the message service is not supported.</exception>
39 /// <exception cref="ArgumentException">Thrown when input coordinates are invalid.</exception>
40 /// <exception cref="UnauthorizedAccessException">Thrown when an application does not have proper privileges.</exception>
41 /// <since_tizen> 3 </since_tizen>
42 public static Task<SentResult> SendMessageAsync(Message message, bool saveToSentbox)
44 return MessagesManagerImpl.Instance.SendMessageAsync(message, saveToSentbox);
48 /// Searches for messages.
50 /// <privilege>http://tizen.org/privilege/message.read</privilege>
51 /// <param name="filter">The search filter for searching messages.</param>
52 /// <returns>A task containing the messages, which match the search filter.</returns>
53 /// <exception cref="InvalidOperationException">Thrown when the method failed due to an invalid operation.</exception>
54 /// <exception cref="NotSupportedException">Thrown when the message service is not supported.</exception>
55 /// <exception cref="ArgumentException">Thrown when input coordinates are invalid.</exception>
56 /// <exception cref="OutOfMemoryException">Thrown when failed due to out of memory.</exception>
57 /// <exception cref="UnauthorizedAccessException">Thrown when an application does not have proper privileges.</exception>
58 /// <since_tizen> 3 </since_tizen>
59 public static Task<IEnumerable<Message>> SearchMessageAsync(MessagesSearchFilter filter)
61 return MessagesManagerImpl.Instance.SearchMessageAsync(filter);
65 /// The MessageReceived event that is raised when receiving a message.
67 /// <privilege>http://tizen.org/privilege/message.read</privilege>
68 /// <since_tizen> 3 </since_tizen>
69 static public event EventHandler<MessageReceivedEventArgs> MessageReceived
73 MessagesManagerImpl.Instance._MessageReceived += value;
77 MessagesManagerImpl.Instance._MessageReceived -= value;