namespace Tizen.Applications.Shortcut
{
using System;
- using System.Threading.Tasks;
/// <summary>
/// This class provides the some functions to add, delete 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;
/// </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;
/// </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;
/// </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)
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,
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
+}
{
using System;
using System.Collections.Generic;
+ using Tizen.Internals.Errors;
/// <summary>
/// The callback function that is invoked when add request occurred
/// </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;
/// </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;
/// </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)
{
{
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
/// </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)
{
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
/// <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();