using System.Runtime.InteropServices;
using System.ComponentModel;
using System.Threading;
+using System.Diagnostics;
namespace Tizen.NUI
{
/// <since_tizen> 3 </since_tizen>
public class Timer : BaseHandle
{
- private global::System.Runtime.InteropServices.HandleRef swigCPtr;
private bool played = false;
private EventHandlerWithReturnType<object, TickEventArgs, bool> _timerTickEventHandler;
private TickCallbackDelegate _timerTickCallbackDelegate;
/// <param name="milliSec">Interval in milliseconds.</param>
/// <returns>A new timer.</returns>
/// <since_tizen> 3 </since_tizen>
- public Timer(uint milliSec) : this(NDalicPINVOKE.Timer_New(milliSec), true)
+ public Timer(uint milliSec) : this(Interop.Timer.Timer_New(milliSec), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
NUILog.Debug($"(0x{swigCPtr.Handle:X}) Timer({milliSec}) Constructor!");
}
- internal Timer(Timer timer) : this(NDalicPINVOKE.new_Timer__SWIG_1(Timer.getCPtr(timer)), true)
+ internal Timer(Timer timer) : this(Interop.Timer.new_Timer__SWIG_1(Timer.getCPtr(timer)), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- internal Timer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Timer_SWIGUpcast(cPtr), cMemoryOwn)
+ internal Timer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Timer.Timer_SWIGUpcast(cPtr), cMemoryOwn)
{
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
_timerTickCallbackDelegate = OnTick;
_timerTickCallbackOfNative = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(_timerTickCallbackDelegate);
/// <since_tizen> 3 </since_tizen>
public void Start()
{
+ if (Thread.CurrentThread.ManagedThreadId != 1)
+ {
+ Tizen.Log.Error("NUI", "current threadID : " + Thread.CurrentThread.ManagedThreadId);
+
+ StackTrace st = new StackTrace(true);
+ for (int i = 0; i < st.FrameCount; i++)
+ {
+ StackFrame sf = st.GetFrame(i);
+ Tizen.Log.Error("NUI", " Method " + sf.GetMethod());
+ }
+ }
+
+ if (swigCPtr.Handle == global::System.IntPtr.Zero || disposed)
+ {
+ NUILog.Error("[ERR] already disposed! can not get this done! just return here! please make sure that the handle gets free when using explicit Dispose()! For example, timer.Dispose(); timer = null; this must be done!");
+ return;
+ }
+
played = true;
- NDalicPINVOKE.Timer_Start(swigCPtr);
+ Interop.Timer.Timer_Start(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <since_tizen> 3 </since_tizen>
public void Stop()
{
+ if (Thread.CurrentThread.ManagedThreadId != 1)
+ {
+ Tizen.Log.Error("NUI", "current threadID : " + Thread.CurrentThread.ManagedThreadId);
+
+
+ StackTrace st = new StackTrace(true);
+ for (int i = 0; i < st.FrameCount; i++)
+ {
+ StackFrame sf = st.GetFrame(i);
+ Tizen.Log.Error("NUI", " Method " + sf.GetMethod());
+ }
+ }
+
+ if (swigCPtr.Handle == global::System.IntPtr.Zero || disposed)
+ {
+ NUILog.Error("[ERR] already disposed! can not get this done! just return here! please make sure that the handle gets free when using explicit Dispose()! For example, timer.Dispose(); timer = null; this must be done!");
+ return;
+ }
+
played = false;
- NDalicPINVOKE.Timer_Stop(swigCPtr);
+ Interop.Timer.Timer_Stop(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
/// <since_tizen> 3 </since_tizen>
public bool IsRunning()
{
- bool ret = NDalicPINVOKE.Timer_IsRunning(swigCPtr);
+ if (Thread.CurrentThread.ManagedThreadId != 1)
+ {
+ Tizen.Log.Error("NUI", "current threadID : " + Thread.CurrentThread.ManagedThreadId);
+
+ StackTrace st = new StackTrace(true);
+ for (int i = 0; i < st.FrameCount; i++)
+ {
+ StackFrame sf = st.GetFrame(i);
+ Tizen.Log.Error("NUI", " Method " + sf.GetMethod());
+ }
+ }
+
+ if (swigCPtr.Handle == global::System.IntPtr.Zero || disposed)
+ {
+ NUILog.Error("[ERR] already disposed! can not get this done! just return here! please make sure that the handle gets free when using explicit Dispose()! For example, timer.Dispose(); timer = null; this must be done!");
+ return false;
+ }
+
+ bool ret = Interop.Timer.Timer_IsRunning(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
{
NUILog.Debug($"(0x{swigCPtr.Handle:X})SetInterval({milliSec})");
+ if (swigCPtr.Handle == global::System.IntPtr.Zero || disposed)
+ {
+ NUILog.Error("[ERR] already disposed! can not get this done! just return here! please make sure that the handle gets free when using explicit Dispose()! For example, timer.Dispose(); timer = null; this must be done!");
+ return;
+ }
+
played = true;
- NDalicPINVOKE.Timer_SetInterval(swigCPtr, milliSec);
+ Interop.Timer.Timer_SetInterval(swigCPtr, milliSec);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal uint GetInterval()
{
- uint ret = NDalicPINVOKE.Timer_GetInterval(swigCPtr);
+ if (swigCPtr.Handle == global::System.IntPtr.Zero || disposed)
+ {
+ NUILog.Error("[ERR] already disposed! can not get this done! just return here! please make sure that the handle gets free when using explicit Dispose()! For example, timer.Dispose(); timer = null; this must be done!");
+ return 0;
+ }
+
+ uint ret = Interop.Timer.Timer_GetInterval(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal TimerSignalType TickSignal()
{
- TimerSignalType ret = new TimerSignalType(NDalicPINVOKE.Timer_TickSignal(swigCPtr), false);
+ TimerSignalType ret = new TimerSignalType(Interop.Timer.Timer_TickSignal(swigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
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;
- NDalicPINVOKE.delete_Timer(swigCPtr);
- }
- swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
- }
-
played = false;
base.Dispose(type);
}
+ /// This will not be public opened.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
+ {
+ Interop.Timer.delete_Timer(swigCPtr);
+ }
+
private bool OnTick()
{
TickEventArgs e = new TickEventArgs();