return;
}
- if (!ApplyLevel(level))
+ var applyLevelResult = ApplyLevel(level);
+
+ if (applyLevelResult == Window.OperationResult.PermissionDenied)
{
throw new UnauthorizedAccessException("Cannot post a Notification: Permission Denied. The privilege http://tizen.org/privilege/window.priority.set is needed.");
}
+ if (applyLevelResult != Window.OperationResult.Succeed)
+ {
+ Tizen.Log.Info("NUI", "The notification window may not have proper notification level.");
+ }
+
ApplyPositionSize(positionSize);
ApplyDismissOnTouch(dismissOnTouch);
{
this.level = level;
- if (state == NotificationState.Post && !ApplyLevel(level))
+ if (state == NotificationState.Post)
{
- throw new UnauthorizedAccessException("Cannot set notification level: Permission Denied");
+ var result = ApplyLevel(level);
+
+ if (result == Window.OperationResult.PermissionDenied)
+ {
+ throw new UnauthorizedAccessException("Cannot set notification level: Permission Denied. The privilege http://tizen.org/privilege/window.priority.set is needed.");
+ }
+
+ if (result != Window.OperationResult.Succeed)
+ {
+ Tizen.Log.Info("NUI", "Cannot set notification level: Unknown reason. The notification window may not have proper notification level.");
+ }
}
return this;
notificationWindow = null;
}
- private bool ApplyLevel(NotificationLevel level)
+ private Window.OperationResult ApplyLevel(NotificationLevel level)
{
- return NotificationWindow.SetNotificationLevel(level);
+ var ret = (Window.OperationResult)Interop.Window.SetNotificationLevel(NotificationWindow.SwigCPtr, (int)level);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
}
private void ApplyPositionSize(Rectangle positionSize)
public static extern int GetType(global::System.Runtime.InteropServices.HandleRef jarg1);
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_SetNotificationLevel")]
- public static extern bool SetNotificationLevel(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
+ public static extern int SetNotificationLevel(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GetNotificationLevel")]
public static extern int GetNotificationLevel(global::System.Runtime.InteropServices.HandleRef jarg1);
public static extern bool IsOpaqueState(global::System.Runtime.InteropServices.HandleRef jarg1);
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_SetScreenOffMode")]
- public static extern bool SetScreenOffMode(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
+ public static extern int SetScreenOffMode(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GetScreenOffMode")]
public static extern int GetScreenOffMode(global::System.Runtime.InteropServices.HandleRef jarg1);
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_SetBrightness")]
- public static extern bool SetBrightness(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
+ public static extern int SetBrightness(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GetBrightness")]
public static extern int GetBrightness(global::System.Runtime.InteropServices.HandleRef jarg1);
}
/// <summary>
+ /// Enumeration for result of window operation.
+ /// </summary>
+ internal enum OperationResult
+ {
+ /// <summary>
+ /// Failed for unknown reason
+ /// </summary>
+ UnknownError = 0,
+ /// <summary>
+ /// Succeed
+ /// </summary>
+ Succeed,
+ /// <summary>
+ /// Permission denied
+ /// </summary>
+ PermissionDenied,
+ /// <summary>
+ /// The operation is not supported.
+ /// </summary>
+ NotSupported,
+ }
+
+
+ /// <summary>
/// The stage instance property (read-only).<br />
/// Gets the current window.<br />
/// </summary>
/// <since_tizen> 3 </since_tizen>
public bool SetNotificationLevel(NotificationLevel level)
{
- bool ret = Interop.Window.SetNotificationLevel(SwigCPtr, (int)level);
+ var ret = (OperationResult)Interop.Window.SetNotificationLevel(SwigCPtr, (int)level);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ return ret == OperationResult.Succeed;
}
/// <summary>
/// <since_tizen> 4 </since_tizen>
public bool SetScreenOffMode(ScreenOffMode screenOffMode)
{
- bool ret = Interop.Window.SetScreenOffMode(SwigCPtr, (int)screenOffMode);
+ var ret = (OperationResult)Interop.Window.SetScreenOffMode(SwigCPtr, (int)screenOffMode);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ return ret == OperationResult.Succeed;
}
/// <summary>
/// <since_tizen> 3 </since_tizen>
public bool SetBrightness(int brightness)
{
- bool ret = Interop.Window.SetBrightness(SwigCPtr, brightness);
+ var ret = (OperationResult)Interop.Window.SetBrightness(SwigCPtr, brightness);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ return ret == OperationResult.Succeed;
}
/// <summary>