From 35d81ae69ab312e21ee26841dc2e551a626a1dba Mon Sep 17 00:00:00 2001 From: Seungha Son Date: Wed, 24 May 2017 11:16:51 +0900 Subject: [PATCH] Add TypeLoadException in Notification and NotificationEventListener This patch adds TypeLoadException to support in API version 3.0 in Notification and NotificationEventListener Signed-off-by: Seungha Son Change-Id: Ifb17b3ff2fc5b002fb5ff8e26fe32c7f6d166811 --- .../NotificationStyleBinder.cs | 21 +++++++++++++++++++-- .../NotificationStyleArgsBinder.cs | 12 +++++++++++- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs index b7eee0d..b5a1fe1 100755 --- a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs @@ -83,7 +83,15 @@ namespace Tizen.Applications.Notifications style.GetRemoveTime(out hidetime, out deletetime); Interop.Notification.SetHideTime(notification.Handle, hidetime); - Interop.Notification.SetDeleteTime(notification.Handle, deletetime); + try + { + Interop.Notification.SetDeleteTime(notification.Handle, deletetime); + } + catch (TypeLoadException) + { + // To support in API version 3.0 + style.SetRemoveTime(hidetime, 60); + } } ret = Interop.Notification.SetImage(notification.Handle, NotificationImage.Background, style?.BackgroundImage); @@ -151,7 +159,16 @@ namespace Tizen.Applications.Notifications { int hidetime, deletetime; Interop.Notification.GetHideTime(notification.Handle, out hidetime); - Interop.Notification.GetDeleteTime(notification.Handle, out deletetime); + try + { + Interop.Notification.GetDeleteTime(notification.Handle, out deletetime); + } + catch (TypeLoadException) + { + // To support in API version 3.0 + deletetime = 60; + } + active.SetRemoveTime(hidetime, deletetime); } diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationStyleArgsBinder.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationStyleArgsBinder.cs index 930c946..6ccb63d 100755 --- a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationStyleArgsBinder.cs +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationStyleArgsBinder.cs @@ -16,6 +16,8 @@ namespace Tizen.Applications.NotificationEventListener { + using System; + internal static class NotificationStyleArgBinder { internal static void BindObject(NotificationEventArgs eventargs) @@ -46,7 +48,15 @@ namespace Tizen.Applications.NotificationEventListener Interop.NotificationEventListener.GetHideTimeout(eventargs.Handle, out timeout); activeStyle.HideTimeout = timeout; - Interop.NotificationEventListener.GetDeleteTimeout(eventargs.Handle, out timeout); + try + { + Interop.NotificationEventListener.GetDeleteTimeout(eventargs.Handle, out timeout); + } + catch (TypeLoadException) + { + //To support in API version 3.0 + timeout = 60; + } activeStyle.DeleteTimeout = timeout; NotificationReplyActionArgBinder.BindObject(eventargs); -- 2.7.4