[NUI] Sync with dalihub & API5 branch (#631)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / WatchTime.cs
index 7c0f63d..ee5c316 100755 (executable)
@@ -26,120 +26,47 @@ namespace Tizen.NUI
     /// <since_tizen> 4 </since_tizen>
     public class WatchTime : global::System.IDisposable
     {
-        private global::System.Runtime.InteropServices.HandleRef swigCPtr;
-
         /// <summary>
         /// swigCMemOwn.
         /// </summary>
         /// <since_tizen> 4 </since_tizen>
         protected bool swigCMemOwn;
 
-        internal WatchTime(global::System.IntPtr cPtr, bool cMemoryOwn)
-        {
-            swigCMemOwn = cMemoryOwn;
-            swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
-        }
-
-        internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WatchTime obj)
-        {
-            return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
-        }
-
-        //A Flag to check who called Dispose(). (By User or DisposeQueue)
-        private bool isDisposeQueued = false;
-
         /// <summary>
         /// A Flat to check if it is already disposed.
         /// </summary>
         /// <since_tizen> 4 </since_tizen>
         protected bool disposed = false;
 
-        /// <summary>
-        /// Distructor.
-        /// </summary>
-        ~WatchTime()
-        {
-            if (!isDisposeQueued)
-            {
-                isDisposeQueued = true;
-                DisposeQueue.Instance.Add(this);
-            }
-        }
-
-        /// <summary>
-        /// To make watch time instance be disposed.
-        /// </summary>
-        /// <since_tizen> 4 </since_tizen>
-        public void Dispose()
-        {
-            //Throw excpetion if Dispose() is called in separate thread.
-            if (!Window.IsInstalled())
-            {
-                throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
-            }
-
-            if (isDisposeQueued)
-            {
-                Dispose(DisposeTypes.Implicit);
-            }
-            else
-            {
-                Dispose(DisposeTypes.Explicit);
-                System.GC.SuppressFinalize(this);
-            }
-        }
+        private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+        //A Flag to check who called Dispose(). (By User or DisposeQueue)
+        private bool isDisposeQueued = false;
 
         /// <summary>
-        /// you can override it to clean-up your own resources.
+        /// Constructor.
         /// </summary>
-        /// <param name="type">DisposeTypes</param>
         /// <since_tizen> 4 </since_tizen>
-        protected virtual void Dispose(DisposeTypes type)
+        public WatchTime() : this(NDalicManualPINVOKE.new_WatchTime(), true)
         {
-            if (disposed)
-            {
-                return;
-            }
-
-            if (type == DisposeTypes.Explicit)
-            {
-                //Called by User
-                //Release your own managed resources here.
-                //You should release all of your own disposable objects here.
-
-            }
-
-            //Release your own unmanaged resources here.
-            //You should not access any managed member here except static instance.
-            //because the execution order of Finalizes is non-deterministic.
-
-            if (swigCPtr.Handle != global::System.IntPtr.Zero)
-            {
-                if (swigCMemOwn)
-                {
-                    swigCMemOwn = false;
-                    NDalicManualPINVOKE.delete_WatchTime(swigCPtr);
-                }
-                swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
-            }
-
-            disposed = true;
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-        internal static WatchTime GetWatchTimeFromPtr(global::System.IntPtr cPtr)
+        internal WatchTime(global::System.IntPtr cPtr, bool cMemoryOwn)
         {
-            WatchTime ret = new WatchTime(cPtr, false);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
+            swigCMemOwn = cMemoryOwn;
+            swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
         }
 
         /// <summary>
-        /// Constructor.
+        /// Distructor.
         /// </summary>
-        /// <since_tizen> 4 </since_tizen>
-        public WatchTime() : this(NDalicManualPINVOKE.new_WatchTime(), true)
+        ~WatchTime()
         {
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            if (!isDisposeQueued)
+            {
+                isDisposeQueued = true;
+                DisposeQueue.Instance.Add(this);
+            }
         }
 
         /// <summary>
@@ -155,13 +82,6 @@ namespace Tizen.NUI
             }
         }
 
-        internal int GetHour()
-        {
-            int ret = NDalicManualPINVOKE.WatchTime_GetHour(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
-
         /// <summary>
         /// Get the current hour24.
         /// </summary>
@@ -175,13 +95,6 @@ namespace Tizen.NUI
             }
         }
 
-        internal int GetHour24()
-        {
-            int ret = NDalicManualPINVOKE.WatchTime_GetHour24(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
-
         /// <summary>
         /// Get the current minute.
         /// </summary>
@@ -195,13 +108,6 @@ namespace Tizen.NUI
             }
         }
 
-        internal int GetMinute()
-        {
-            int ret = NDalicManualPINVOKE.WatchTime_GetMinute(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
-
         /// <summary>
         /// Get the current second.
         /// </summary>
@@ -215,13 +121,6 @@ namespace Tizen.NUI
             }
         }
 
-        internal int GetSecond()
-        {
-            int ret = NDalicManualPINVOKE.WatchTime_GetSecond(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
-
         /// <summary>
         /// Get the current millisecond.
         /// </summary>
@@ -235,13 +134,6 @@ namespace Tizen.NUI
             }
         }
 
-        internal int GetMillisecond()
-        {
-            int ret = NDalicManualPINVOKE.WatchTime_GetMillisecond(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
-
         /// <summary>
         /// Get the current year.
         /// </summary>
@@ -255,13 +147,6 @@ namespace Tizen.NUI
             }
         }
 
-        internal int GetYear()
-        {
-            int ret = NDalicManualPINVOKE.WatchTime_GetYear(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
-
         /// <summary>
         /// Get the current month.
         /// </summary>
@@ -275,13 +160,6 @@ namespace Tizen.NUI
             }
         }
 
-        internal int GetMonth()
-        {
-            int ret = NDalicManualPINVOKE.WatchTime_GetMonth(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
-
         /// <summary>
         /// Get the current day.
         /// </summary>
@@ -295,13 +173,6 @@ namespace Tizen.NUI
             }
         }
 
-        internal int GetDay()
-        {
-            int ret = NDalicManualPINVOKE.WatchTime_GetDay(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
-
         /// <summary>
         /// Get the current week.
         /// </summary>
@@ -315,27 +186,6 @@ namespace Tizen.NUI
             }
         }
 
-        internal int GetDayOfWeek()
-        {
-            int ret = NDalicManualPINVOKE.WatchTime_GetDayOfWeek(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
-
-        internal SWIGTYPE_p_tm GetUtcTime()
-        {
-            SWIGTYPE_p_tm ret = new SWIGTYPE_p_tm(NDalicManualPINVOKE.WatchTime_GetUtcTime(swigCPtr), true);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
-
-        internal SWIGTYPE_p_time_t GetUtcTimeStamp()
-        {
-            SWIGTYPE_p_time_t ret = new SWIGTYPE_p_time_t(NDalicManualPINVOKE.WatchTime_GetUtcTimeStamp(swigCPtr), true);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
-
         /// <summary>
         /// Get the ID of timezone.
         /// </summary>
@@ -354,13 +204,6 @@ namespace Tizen.NUI
             }
         }
 
-        internal string GetTimeZone()
-        {
-            string ret = NDalicManualPINVOKE.WatchTime_GetTimeZone(swigCPtr);
-            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-            return ret;
-        }
-
         /// <summary>
         /// Get the daylight saving time status.
         /// </summary>
@@ -374,6 +217,69 @@ namespace Tizen.NUI
             }
         }
 
+        /// <summary>
+        /// To make watch time instance be disposed.
+        /// </summary>
+        /// <since_tizen> 4 </since_tizen>
+        public void Dispose()
+        {
+            //Throw excpetion if Dispose() is called in separate thread.
+            if (!Window.IsInstalled())
+            {
+                throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
+            }
+
+            if (isDisposeQueued)
+            {
+                Dispose(DisposeTypes.Implicit);
+            }
+            else
+            {
+                Dispose(DisposeTypes.Explicit);
+                System.GC.SuppressFinalize(this);
+            }
+        }
+
+        internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WatchTime obj)
+        {
+            return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+        }
+
+        internal static WatchTime GetWatchTimeFromPtr(global::System.IntPtr cPtr)
+        {
+            WatchTime ret = new WatchTime(cPtr, false);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal int GetDayOfWeek()
+        {
+            int ret = NDalicManualPINVOKE.WatchTime_GetDayOfWeek(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal SWIGTYPE_p_tm GetUtcTime()
+        {
+            SWIGTYPE_p_tm ret = new SWIGTYPE_p_tm(NDalicManualPINVOKE.WatchTime_GetUtcTime(swigCPtr), true);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal SWIGTYPE_p_time_t GetUtcTimeStamp()
+        {
+            SWIGTYPE_p_time_t ret = new SWIGTYPE_p_time_t(NDalicManualPINVOKE.WatchTime_GetUtcTimeStamp(swigCPtr), true);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal string GetTimeZone()
+        {
+            string ret = NDalicManualPINVOKE.WatchTime_GetTimeZone(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
         internal bool GetDaylightSavingTimeStatus()
         {
             bool ret = NDalicManualPINVOKE.WatchTime_GetDaylightSavingTimeStatus(swigCPtr);
@@ -381,6 +287,99 @@ namespace Tizen.NUI
             return ret;
         }
 
+        internal int GetHour()
+        {
+            int ret = NDalicManualPINVOKE.WatchTime_GetHour(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal int GetHour24()
+        {
+            int ret = NDalicManualPINVOKE.WatchTime_GetHour24(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal int GetMinute()
+        {
+            int ret = NDalicManualPINVOKE.WatchTime_GetMinute(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal int GetSecond()
+        {
+            int ret = NDalicManualPINVOKE.WatchTime_GetSecond(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal int GetMillisecond()
+        {
+            int ret = NDalicManualPINVOKE.WatchTime_GetMillisecond(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal int GetYear()
+        {
+            int ret = NDalicManualPINVOKE.WatchTime_GetYear(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal int GetMonth()
+        {
+            int ret = NDalicManualPINVOKE.WatchTime_GetMonth(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        internal int GetDay()
+        {
+            int ret = NDalicManualPINVOKE.WatchTime_GetDay(swigCPtr);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+            return ret;
+        }
+
+        /// <summary>
+        /// you can override it to clean-up your own resources.
+        /// </summary>
+        /// <param name="type">DisposeTypes</param>
+        /// <since_tizen> 4 </since_tizen>
+        protected virtual void Dispose(DisposeTypes type)
+        {
+            if (disposed)
+            {
+                return;
+            }
+
+            if (type == DisposeTypes.Explicit)
+            {
+                //Called by User
+                //Release your own managed resources here.
+                //You should release all of your own disposable objects here.
+
+            }
+
+            //Release your own unmanaged resources here.
+            //You should not access any managed member here except static instance.
+            //because the execution order of Finalizes is non-deterministic.
+
+            if (swigCPtr.Handle != global::System.IntPtr.Zero)
+            {
+                if (swigCMemOwn)
+                {
+                    swigCMemOwn = false;
+                    NDalicManualPINVOKE.delete_WatchTime(swigCPtr);
+                }
+                swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+            }
+
+            disposed = true;
+        }
+
     }
 
 }