Signed-off-by: Jiyun Yang <ji.yang@samsung.com>
/// Create a notification with a content View.
/// </summary>
/// <param name="contentView">The content view instance to display in the notification window.</param>
/// Create a notification with a content View.
/// </summary>
/// <param name="contentView">The content view instance to display in the notification window.</param>
+ /// <exception cref="NotSupportedException">Thrown when the device does not support a notification feature.</exception>
/// <exception cref="ArgumentNullException">Thrown when a given contentView is null.</exception>
/// <exception cref="ArgumentNullException">Thrown when a given contentView is null.</exception>
+ /// <remark>Since the notification creates a new window, the system should support a multi-window feature. Otherwise it will throw a NotSupportedException.</remark>
/// <since_tizen> 8 </since_tizen>
public Notification(View contentView) : base()
{
/// <since_tizen> 8 </since_tizen>
public Notification(View contentView) : base()
{
+ if (!Window.IsSupportedMultiWindow())
+ {
+ throw new NotSupportedException("This device does not support multi-window. Notification can not be created. ");
+ }
ContentView = contentView ?? throw new ArgumentNullException(nameof(contentView));
}
ContentView = contentView ?? throw new ArgumentNullException(nameof(contentView));
}
/// <param name="text">The string content.</param>
/// <param name="gravity">The location at which the toast should appear. It's one of the notification constants: ToastTop, ToastCenter and ToastBottom.</param>
/// <returns>The created Notification instance.</returns>
/// <param name="text">The string content.</param>
/// <param name="gravity">The location at which the toast should appear. It's one of the notification constants: ToastTop, ToastCenter and ToastBottom.</param>
/// <returns>The created Notification instance.</returns>
+ /// <exception cref="NotSupportedException">Thrown when the device does not support a notification feature.</exception>
/// <exception cref="ArgumentNullException">Thrown when the given text or gravity is null.</exception>
/// <remark>Application need to set http://tizen.org/privilege/window.priority.set to post a notification.</remark>
/// <exception cref="ArgumentNullException">Thrown when the given text or gravity is null.</exception>
/// <remark>Application need to set http://tizen.org/privilege/window.priority.set to post a notification.</remark>
+ /// <remark>Since the notification creates a new window, the system should support a multi-window feature. Otherwise it will throw a NotSupportedException.</remark>
/// <example>
/// The following example demonstrates how to make a toast at the bottom and show it for a short period time.
/// <code>
/// <example>
/// The following example demonstrates how to make a toast at the bottom and show it for a short period time.
/// <code>
/// <since_tizen> 9 </since_tizen>
public static Notification MakeToast(string text, Position gravity)
{
/// <since_tizen> 9 </since_tizen>
public static Notification MakeToast(string text, Position gravity)
{
+ if (!Window.IsSupportedMultiWindow())
+ {
+ throw new NotSupportedException("This device does not support multi-window. Notification can not be created. ");
+ }
+
var textLabel = new TextLabel(text ?? throw new ArgumentNullException(nameof(text)))
{
Opacity = 0.0f
var textLabel = new TextLabel(text ?? throw new ArgumentNullException(nameof(text)))
{
Opacity = 0.0f
if (!ApplyLevel(level))
{
if (!ApplyLevel(level))
{
- throw new UnauthorizedAccessException("Cannot post a Notification: Permission Denied");
+ throw new UnauthorizedAccessException("Cannot post a Notification: Permission Denied. The privilege http://tizen.org/privilege/window.priority.set is needed.");
}
ApplyPositionSize(positionSize);
}
ApplyPositionSize(positionSize);
private List<Layer> childLayers = new List<Layer>();
private LayoutController localController;
private List<Layer> childLayers = new List<Layer>();
private LayoutController localController;
- private bool IsSupportedMultiWindow()
+ static internal bool IsSupportedMultiWindow()
{
bool isSupported = false;
Information.TryGetValue("http://tizen.org/feature/opengles.surfaceless_context", out isSupported);
{
bool isSupported = false;
Information.TryGetValue("http://tizen.org/feature/opengles.surfaceless_context", out isSupported);