Add check box for notification (#5342)
[platform/core/csapi/tizenfx.git] / src / Tizen.Applications.NotificationEventListener / Tizen.Applications.NotificationEventListener / NotificationListenerManager.cs
index d0c8382..e6c1382 100755 (executable)
@@ -21,6 +21,8 @@ namespace Tizen.Applications.NotificationEventListener
     using System.ComponentModel;
     using System.Runtime.InteropServices;
 
+    using Tizen.Internals;
+
     /// <summary>
     /// This class provides a way to register callback function for some notification events.
     /// </summary>
@@ -40,6 +42,7 @@ namespace Tizen.Applications.NotificationEventListener
 
         private static Interop.NotificationEventListener.ChangedCallback callback;
 
+        [NativeStruct("notification_op", Include="notification_type.h", PkgConfig="notification")]
         [StructLayout(LayoutKind.Sequential)]
         private struct NotificationOperation
         {
@@ -404,6 +407,30 @@ namespace Tizen.Applications.NotificationEventListener
             }
         }
 
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static void SetChecked(NotificationEventArgs eventargs, bool checkedValue)
+        {
+            Interop.NotificationEventListener.ErrorCode err;
+
+            err = Interop.NotificationEventListener.SetCheckedValue(eventargs.Handle, checkedValue);
+            if (err != Interop.NotificationEventListener.ErrorCode.None)
+            {
+                throw NotificationEventListenerErrorFactory.GetException(err, "failed to set checked");
+            }
+        }
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static void SendEventWithNotification(NotificationEventArgs eventargs, UserEventType type)
+        {
+            Interop.NotificationEventListener.ErrorCode err;
+
+            err = Interop.NotificationEventListener.SendEventWithNotification(eventargs.Handle, (int)type);
+            if (err != Interop.NotificationEventListener.ErrorCode.None)
+            {
+                throw NotificationEventListenerErrorFactory.GetException(err, "failed to send event");
+            }
+        }
+
         /// <summary>
         /// Returns NotificationEventArgs by UniqueNumber.
         /// </summary>
@@ -440,5 +467,35 @@ namespace Tizen.Applications.NotificationEventListener
 
             return eventArgs;
         }
+
+        /// <summary>
+        /// Gets the number of all notifications
+        /// </summary>
+        /// <returns>The number of all notifications</returns>
+        /// <exception cref="UnauthorizedAccessException"> Thrown in case of a permission is denied.</exception>
+        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
+        /// <privilege>http://tizen.org/privilege/notification</privilege>
+        /// <since_tizen> 4 </since_tizen>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public static int GetAllCount()
+        {
+            int count;
+            Interop.NotificationEventListener.ErrorCode error;
+
+            error = Interop.NotificationEventListener.GetAllCount(NotificationType.None, out count);
+            if (error != Interop.NotificationEventListener.ErrorCode.None)
+            {
+                if (error == Interop.NotificationEventListener.ErrorCode.PermissionDenied)
+                {
+                    throw NotificationEventListenerErrorFactory.GetException(Interop.NotificationEventListener.ErrorCode.PermissionDenied, "failed to get all count");
+                }
+                else
+                {
+                    throw NotificationEventListenerErrorFactory.GetException(Interop.NotificationEventListener.ErrorCode.InvalidOperation, "failed to get all count");
+                }
+            }
+
+            return count;
+        }
     }
 }