Edit summary and add code 54/148154/5 preview1-00171
authorMyungki Lee <mk5004.lee@samsung.com>
Thu, 7 Sep 2017 03:05:15 +0000 (12:05 +0900)
committerMyungKi Lee <mk5004.lee@samsung.com>
Fri, 8 Sep 2017 01:49:54 +0000 (01:49 +0000)
- Edit feature text
  Add GetLastResult()
  Modifying the exception text
  Add OutOfMemoryException

Change-Id: I7a0b4350881b6c1129b627e6d0c397c17cc82abc
Signed-off-by: Myungki Lee <mk5004.lee@samsung.com>
src/Tizen.Applications.Shortcut/Tizen.Applications.Shortcut/ShortcutErrorFactory.cs
src/Tizen.Applications.Shortcut/Tizen.Applications.Shortcut/ShortcutManager.cs
src/Tizen.Applications.Shortcut/Tizen.Applications.ShortcutEvent/ShortcutEventEnumerations.cs
src/Tizen.Applications.Shortcut/Tizen.Applications.ShortcutEvent/ShortcutEventManager.cs

index 4ed4850..26c0656 100755 (executable)
@@ -32,6 +32,8 @@ namespace Tizen.Applications.Shortcut
                     return new UnauthorizedAccessException(err + " Permission denied (http://tizen.org/privilege/shortcut)");
                 case Interop.Shortcut.ErrorCode.NotSupported:
                     return new NotSupportedException(err + " Not Supported (http://tizen.org/feature/shortcut)");
+                case Interop.Shortcut.ErrorCode.OutOfMemory:
+                    return new OutOfMemoryException(err + " error occurred.");
                 default:
                     Log.Error(LogTag, msg);
                     return new InvalidOperationException(err + " error occurred.");
index 22b3692..f27507d 100755 (executable)
@@ -17,7 +17,6 @@
 namespace Tizen.Applications.Shortcut
 {
     using System;
-    using System.Threading.Tasks;
 
     /// <summary>
     /// This class provides the some functions to add, delete shortcut.
@@ -37,12 +36,13 @@ namespace Tizen.Applications.Shortcut
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <param name="shortcut">Object that contain shortcut info.</param>
-        /// <feature>http://tizen.org/feature/shortcut </feature>
+        /// <feature>http://tizen.org/feature/shortcut</feature>
         /// <privilege>http://tizen.org/privilege/shortcut</privilege>
         /// <exception cref="ArgumentException">Thrown when argument is invalid.</exception>
         /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
-        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
         /// <exception cref="NotSupportedException">Thrown when Shortcut is not supported.</exception>
+        /// <exception cref="OutOfMemoryException">Thrown in case of out of memory.</exception>
+        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
         public static void Add(HomeShortcutInfo shortcut)
         {
             Interop.Shortcut.ErrorCode err = Interop.Shortcut.ErrorCode.None;
@@ -82,12 +82,13 @@ namespace Tizen.Applications.Shortcut
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <param name="shortcut">Object that contain shortcut info.</param>
-        /// <feature>http://tizen.org/feature/shortcut </feature>
+        /// <feature>http://tizen.org/feature/shortcut</feature>
         /// <privilege>http://tizen.org/privilege/shortcut</privilege>
         /// <exception cref="ArgumentException">Thrown when argument is invalid.</exception>
         /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
-        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
         /// <exception cref="NotSupportedException">Thrown when Shortcut is not supported.</exception>
+        /// <exception cref="OutOfMemoryException">Thrown in case of out of memory.</exception>
+        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
         public static void Add(WidgetShortcutInfo shortcut)
         {
             Interop.Shortcut.ErrorCode err = Interop.Shortcut.ErrorCode.None;
@@ -121,12 +122,13 @@ namespace Tizen.Applications.Shortcut
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <param name="shortcutName">Shortcut name string.</param>
-        /// <feature>http://tizen.org/feature/shortcut </feature>
+        /// <feature>http://tizen.org/feature/shortcut</feature>
         /// <privilege>http://tizen.org/privilege/shortcut</privilege>
         /// <exception cref="ArgumentException">Thrown when argument is invalid.</exception>
         /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
-        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
         /// <exception cref="NotSupportedException">Thrown when Shortcut is not supported.</exception>
+        /// <exception cref="OutOfMemoryException">Thrown in case of out of memory.</exception>
+        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
         public static void Delete(string shortcutName)
         {
             Interop.Shortcut.ErrorCode err = Interop.Shortcut.ErrorCode.None;
@@ -160,12 +162,13 @@ namespace Tizen.Applications.Shortcut
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <param name="shortcut">Object that contain shortcut info.</param>
-        /// <feature>http://tizen.org/feature/shortcut </feature>
+        /// <feature>http://tizen.org/feature/shortcut</feature>
         /// <privilege>http://tizen.org/privilege/shortcut</privilege>
         /// <exception cref="ArgumentException">Thrown when argument is invalid.</exception>
         /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
-        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
         /// <exception cref="NotSupportedException">Thrown when Shortcut is not supported.</exception>
+        /// <exception cref="OutOfMemoryException">Thrown in case of out of memory.</exception>
+        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
         public static void Delete(ShortcutInfo shortcut)
         {
             if (shortcut == null)
index 4a66f55..9dc4e40 100755 (executable)
@@ -37,26 +37,11 @@ namespace Tizen.Applications.Shortcut
         OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
 
         /// <summary>
-        /// Permission denied.
-        /// </summary>
-        PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied,
-
-        /// <summary>
         /// I/O Error.
         /// </summary>
         IoError = Tizen.Internals.Errors.ErrorCode.IoError,
 
         /// <summary>
-        /// Not supported.
-        /// </summary>
-        NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported,
-
-        /// <summary>
-        /// Device or resource busy.
-        /// </summary>
-        ResourceBusy = Tizen.Internals.Errors.ErrorCode.ResourceBusy,
-
-        /// <summary>
         /// There is no space to add a new shortcut.
         /// </summary>
         NoSpace = -0x01160000 | 0x01,
@@ -67,18 +52,8 @@ namespace Tizen.Applications.Shortcut
         Exist = -0x01160000 | 0x02,
 
         /// <summary>
-        /// Unrecoverable error.
-        /// </summary>
-        Fault = -0x01160000 | 0x04,
-
-        /// <summary>
         /// Not exist shortcut.
         /// </summary>
         NotExist = -0x01160000 | 0x08,
-
-        /// <summary>
-        /// Connection not established or communication problem.
-        /// </summary>
-        COMM = -0x01160000 | 0x40
     }
-}
\ No newline at end of file
+}
index 08b818a..a4467d4 100755 (executable)
@@ -18,6 +18,7 @@ namespace Tizen.Applications.Shortcut
 {
     using System;
     using System.Collections.Generic;
+    using Tizen.Internals.Errors;
 
     /// <summary>
     /// The callback function that is invoked when add request occurred
@@ -53,15 +54,16 @@ namespace Tizen.Applications.Shortcut
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <param name="addedEvent">The callback function pointer that is invoked when Add() is requested</param>
-        /// <feature>http://tizen.org/feature/shortcut </feature>
+        /// <feature>http://tizen.org/feature/shortcut</feature>
         /// <privilege>http://tizen.org/privilege/shortcut</privilege>
         /// <remarks>
         /// Previous registered delegate function should be unregister.
         /// </remarks>
         /// <exception cref="ArgumentException">Thrown when argument is invalid.</exception>
         /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
-        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
         /// <exception cref="NotSupportedException">Thrown when Shortcut is not supported.</exception>
+        /// <exception cref="OutOfMemoryException">Thrown in case of out of memory.</exception>
+        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
         public static void RegisterEventHandler(ShortcutAdded addedEvent)
         {
             shortcutAdded = addedEvent;
@@ -83,15 +85,16 @@ namespace Tizen.Applications.Shortcut
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <param name="deletedEvent">The callback function pointer that is invoked when Delete() is requested</param>
-        /// <feature>http://tizen.org/feature/shortcut </feature>
+        /// <feature>http://tizen.org/feature/shortcut</feature>
         /// <privilege>http://tizen.org/privilege/shortcut</privilege>
         /// <remarks>
         /// Previous registered delegate function should be unregister.
         /// </remarks>
         /// <exception cref="ArgumentException">Thrown when argument is invalid.</exception>
         /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
-        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
         /// <exception cref="NotSupportedException">Thrown when Shortcut is not supported.</exception>
+        /// <exception cref="OutOfMemoryException">Thrown in case of out of memory.</exception>
+        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
         public static void RegisterEventHandler(ShortcutDeleted deletedEvent)
         {
             shortcutDeleted = deletedEvent;
@@ -113,11 +116,10 @@ namespace Tizen.Applications.Shortcut
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <param name="addedEvent">The callback function pointer that used for RegisterCallback</param>
-        /// <feature>http://tizen.org/feature/shortcut </feature>
+        /// <feature>http://tizen.org/feature/shortcut</feature>
         /// <privilege>http://tizen.org/privilege/shortcut</privilege>
         /// <exception cref="ArgumentException">Thrown when argument is invalid.</exception>
         /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
-        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
         /// <exception cref="NotSupportedException">Thrown when Shortcut is not supported.</exception>
         public static void UnregisterEventHandler(ShortcutAdded addedEvent)
         {
@@ -129,6 +131,12 @@ namespace Tizen.Applications.Shortcut
                 {
                     Interop.Shortcut.UnsetShortcutAddCallback();
                     shortcutAddCallback = null;
+
+                    int err = ErrorFacts.GetLastResult();
+                    if (err != (int)Interop.Shortcut.ErrorCode.None)
+                    {
+                        throw ShortcutErrorFactory.GetException((Interop.Shortcut.ErrorCode)err, "unable to unregister callback");
+                    }
                 }
             }
             else
@@ -142,11 +150,10 @@ namespace Tizen.Applications.Shortcut
         /// </summary>
         /// <since_tizen> 3 </since_tizen>
         /// <param name="deletedEvent">The callback function pointer that used for RegisterCallback</param>
-        /// <feature>http://tizen.org/feature/shortcut </feature>
+        /// <feature>http://tizen.org/feature/shortcut</feature>
         /// <privilege>http://tizen.org/privilege/shortcut</privilege>
         /// <exception cref="ArgumentException">Thrown when argument is invalid.</exception>
         /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
-        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
         /// <exception cref="NotSupportedException">Thrown when Shortcut is not supported.</exception>
         public static void UnregisterEventHandler(ShortcutDeleted deletedEvent)
         {
@@ -156,8 +163,15 @@ namespace Tizen.Applications.Shortcut
 
                 if (shortcutDeleteCallback != null)
                 {
+
                     Interop.Shortcut.UnsetShortcutDeleteCallback();
                     shortcutDeleteCallback = null;
+
+                    int err = ErrorFacts.GetLastResult();
+                    if (err != (int)Interop.Shortcut.ErrorCode.None)
+                    {
+                        throw ShortcutErrorFactory.GetException((Interop.Shortcut.ErrorCode) err, "unable to unregister callback");
+                    }
                 }
             }
             else
@@ -172,12 +186,13 @@ namespace Tizen.Applications.Shortcut
         /// <since_tizen> 3 </since_tizen>
         /// <param name="appId">Application ID.</param>
         /// <returns>The List of ShortcutTemplate.</returns>
-        /// <feature>http://tizen.org/feature/shortcut </feature>
+        /// <feature>http://tizen.org/feature/shortcut</feature>
         /// <privilege>http://tizen.org/privilege/shortcut</privilege>
         /// <exception cref="ArgumentException">Thrown when argument is invalid.</exception>
         /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
-        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
         /// <exception cref="NotSupportedException">Thrown when Shortcut is not supported.</exception>
+        /// <exception cref="OutOfMemoryException">Thrown in case of out of memory.</exception>
+        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
         public static IEnumerable<ShortcutTemplate> GetTemplateList(string appId)
         {
             shortcutTemplates.Clear();