Added TimeChanged get value API and modified exception. 98/128798/2 accepted/tizen/unified/20170516.180025 submit/tizen/20170516.111519 tizen_4.0.m1_release
authorjinwang.an <jinwang.an@samsung.com>
Thu, 11 May 2017 10:58:18 +0000 (19:58 +0900)
committerjinwang.an <jinwang.an@samsung.com>
Tue, 16 May 2017 11:11:52 +0000 (20:11 +0900)
Change-Id: Icc6b60ad130fddc0d4499d892a770ec36c973045
Signed-off-by: jinwang.an <jinwang.an@samsung.com>
Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettings.cs
Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsEventArgs.cs
Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsExceptionFactory.cs
packaging/csapi-system-settings.spec

index d400954..b0ec8e8 100755 (executable)
@@ -397,6 +397,23 @@ namespace Tizen.System
                 }
             }
         }
+
+        /// <summary>
+        /// Once System changes time, this event occurs to notify time change.
+        /// </summary>
+        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;
+            }
+        }
         /// <summary>
         /// Indicates whether the screen lock sound is enabled on the device. ex) LCD on/off sound
         /// </summary>
@@ -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<TimeChangedEventArgs> s_timeChanged;
index ff03859..c0a5a04 100755 (executable)
@@ -347,8 +347,17 @@ namespace Tizen.System
     /// </summary>
     public class TimeChangedEventArgs : EventArgs
     {
-        internal TimeChangedEventArgs()
+        private readonly int _time;
+        internal TimeChangedEventArgs(int val)
         {
+            _time = val;
+        }
+        public int Value
+        {
+            get
+            {
+                return _time;
+            }
         }
     }
 
index 0ff6f0b..039ff41 100644 (file)
@@ -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:
index 7dfe837..b870a4b 100644 (file)
@@ -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