[DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_package_id")]
internal static extern string GetWidgetPackageId(string widgetId);
+ [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_widget_max_count")]
+ internal static extern int GetWidgetMaxCount(string widgetId);
+
+ [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_instance_count")]
+ internal static extern int GetWidgetInstanceCount(string widgetId, string cluster, string category);
+
[DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_app_id_of_setup_app")]
internal static extern string GetSetupAppId(string widgetId);
}
using System.Collections.Generic;
using Tizen.Applications;
using System.Runtime.InteropServices;
+using System.ComponentModel;
namespace Tizen.Applications
{
return str;
}
}
+
+ /// <summary>
+ /// Gets widget max count
+ /// </summary>
+ /// <since_tizen> 8 </since_tizen>
+ /// <privilege>http://tizen.org/privilege/widget.viewer</privilege>
+ /// <feature>http://tizen.org/feature/shell.appwidget</feature>
+ /// <exception cref="NotSupportedException">Thrown when the required features are not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the required privileges to access this method.</exception>
+ /// <exception cref="InvalidOperationException">Thrown in case of failed conditions.</exception>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int MaxCount
+ {
+ get
+ {
+ int ret = Interop.WidgetService.GetWidgetMaxCount(Id);
+
+ switch ((Interop.WidgetService.ErrorCode)ret)
+ {
+ case Interop.WidgetService.ErrorCode.NotSupported:
+ throw new NotSupportedException();
+
+ case Interop.WidgetService.ErrorCode.PermissionDenied:
+ throw new UnauthorizedAccessException();
+
+ case Interop.WidgetService.ErrorCode.InvalidParameter:
+ throw new InvalidOperationException("Invalid parameter");
+
+ case Interop.WidgetService.ErrorCode.IoError:
+ throw new InvalidOperationException("Failed to access DB");
+
+ case Interop.WidgetService.ErrorCode.Fault:
+ throw new InvalidOperationException("Failed to get information from DB");
+
+ case Interop.WidgetService.ErrorCode.NotExist:
+ throw new InvalidOperationException("The data does not exist");
+ }
+
+ return ret;
+ }
+ }
/// <summary>
/// The event handler for a created widget instance.
}
/// <summary>
+ /// Gets widget instance count
+ /// </summary>
+ /// <since_tizen> 8 </since_tizen>
+ /// <returns>The widget instance count.</returns>
+ /// <privilege>http://tizen.org/privilege/widget.viewer</privilege>
+ /// <feature>http://tizen.org/feature/shell.appwidget</feature>
+ /// <exception cref="NotSupportedException">Thrown when the required features are not supported.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the required privileges to access this method.</exception>
+ /// <exception cref="InvalidOperationException">Thrown in case of failed conditions.</exception>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int GetInstanceCount()
+ {
+ int ret = Interop.WidgetService.GetWidgetInstanceCount(Id, null, null);
+
+ switch ((Interop.WidgetService.ErrorCode)ret)
+ {
+ case Interop.WidgetService.ErrorCode.NotSupported:
+ throw new NotSupportedException();
+
+ case Interop.WidgetService.ErrorCode.InvalidParameter:
+ throw new InvalidOperationException("Invalid parameter");
+
+ case Interop.WidgetService.ErrorCode.PermissionDenied:
+ throw new UnauthorizedAccessException();
+ }
+
+ return ret;
+ }
+
+ /// <summary>
/// Releases all the resources used by the WidgetControl class.
/// </summary>
/// <since_tizen> 3 </since_tizen>