From: jinwang.an Date: Thu, 11 May 2017 10:58:18 +0000 (+0900) Subject: Added TimeChanged get value API and modified exception. X-Git-Tag: submit/trunk/20170823.075128~80^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=82c9507f4bd23ea590b1202cf8307271d05ed55b;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git Added TimeChanged get value API and modified exception. Change-Id: Icc6b60ad130fddc0d4499d892a770ec36c973045 Signed-off-by: jinwang.an --- diff --git a/packaging/csapi-system-settings.spec b/packaging/csapi-system-settings.spec index 7dfe837..b870a4b 100644 --- a/packaging/csapi-system-settings.spec +++ b/packaging/csapi-system-settings.spec @@ -1,6 +1,6 @@ Name: csapi-system-settings Summary: Tizen System Settings API for C# -Version: 1.0.3 +Version: 1.0.4 Release: 1 Group: Development/Libraries License: Apache-2.0 diff --git a/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettings.cs b/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettings.cs index d400954..b0ec8e8 100755 --- a/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettings.cs +++ b/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettings.cs @@ -397,6 +397,23 @@ namespace Tizen.System } } } + + /// + /// Once System changes time, this event occurs to notify time change. + /// + public static int Time + { + get + { + int time; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.Time, out time); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get Time system setting."); + } + return time; + } + } /// /// Indicates whether the screen lock sound is enabled on the device. ex) LCD on/off sound /// @@ -1253,8 +1270,9 @@ namespace Tizen.System private static readonly Interop.Settings.SystemSettingsChangedCallback s_timeChangedCallback = (SystemSettingsKeys key, IntPtr userData) => { - //bool motionActivation = SystemSettings.Time; - TimeChangedEventArgs eventArgs = new TimeChangedEventArgs(); + + int time = SystemSettings.Time; + TimeChangedEventArgs eventArgs = new TimeChangedEventArgs(time); s_timeChanged?.Invoke(null, eventArgs); }; private static event EventHandler s_timeChanged; diff --git a/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsEventArgs.cs b/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsEventArgs.cs index ff03859..c0a5a04 100755 --- a/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsEventArgs.cs +++ b/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsEventArgs.cs @@ -347,8 +347,17 @@ namespace Tizen.System /// public class TimeChangedEventArgs : EventArgs { - internal TimeChangedEventArgs() + private readonly int _time; + internal TimeChangedEventArgs(int val) { + _time = val; + } + public int Value + { + get + { + return _time; + } } } diff --git a/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsExceptionFactory.cs b/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsExceptionFactory.cs index 0ff6f0b..039ff41 100644 --- a/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsExceptionFactory.cs +++ b/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsExceptionFactory.cs @@ -40,15 +40,15 @@ namespace Tizen.System case SystemSettingsError.InvalidParameter: exp = new ArgumentException(msg); break; + case SystemSettingsError.NotSupported: + exp = new NotSupportedException(msg); + break; case SystemSettingsError.OutOfMemory: //fall through case SystemSettingsError.IoError: //fall through case SystemSettingsError.PermissionDenied: //fall through - case SystemSettingsError.NotSupported: - exp = new NotSupportedException(msg); - break; case SystemSettingsError.LockScreenAppPasswordMode: //fall through default: