X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FWatchTime.cs;h=ee5c316beec56b65ba3c28254301a79a7dca0bbd;hb=f03c20962ae3b9e79c32f6c1ea3de1d4583da015;hp=7c0f63d8a6dc67886504356d48d16973a60cef5d;hpb=1df966f31444f14637e0655592cc48c0b5357a98;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.NUI/src/public/WatchTime.cs b/src/Tizen.NUI/src/public/WatchTime.cs index 7c0f63d..ee5c316 100755 --- a/src/Tizen.NUI/src/public/WatchTime.cs +++ b/src/Tizen.NUI/src/public/WatchTime.cs @@ -26,120 +26,47 @@ namespace Tizen.NUI /// 4 public class WatchTime : global::System.IDisposable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - /// /// swigCMemOwn. /// /// 4 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; - /// /// A Flat to check if it is already disposed. /// /// 4 protected bool disposed = false; - /// - /// Distructor. - /// - ~WatchTime() - { - if (!isDisposeQueued) - { - isDisposeQueued = true; - DisposeQueue.Instance.Add(this); - } - } - - /// - /// To make watch time instance be disposed. - /// - /// 4 - 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; /// - /// you can override it to clean-up your own resources. + /// Constructor. /// - /// DisposeTypes /// 4 - 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); } /// - /// Constructor. + /// Distructor. /// - /// 4 - public WatchTime() : this(NDalicManualPINVOKE.new_WatchTime(), true) + ~WatchTime() { - if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } } /// @@ -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; - } - /// /// Get the current hour24. /// @@ -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; - } - /// /// Get the current minute. /// @@ -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; - } - /// /// Get the current second. /// @@ -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; - } - /// /// Get the current millisecond. /// @@ -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; - } - /// /// Get the current year. /// @@ -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; - } - /// /// Get the current month. /// @@ -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; - } - /// /// Get the current day. /// @@ -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; - } - /// /// Get the current week. /// @@ -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; - } - /// /// Get the ID of timezone. /// @@ -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; - } - /// /// Get the daylight saving time status. /// @@ -374,6 +217,69 @@ namespace Tizen.NUI } } + /// + /// To make watch time instance be disposed. + /// + /// 4 + 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; + } + + /// + /// you can override it to clean-up your own resources. + /// + /// DisposeTypes + /// 4 + 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; + } + } }