1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
\r
3 * Licensed under the Apache License, Version 2.0 (the "License");
\r
4 * you may not use this file except in compliance with the License.
\r
5 * You may obtain a copy of the License at
\r
7 * http://www.apache.org/licenses/LICENSE-2.0
\r
9 * Unless required by applicable law or agreed to in writing, software
\r
10 * distributed under the License is distributed on an "AS IS" BASIS,
\r
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
12 * See the License for the specific language governing permissions and
\r
13 * limitations under the License.
\r
16 // This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts
\r
17 //------------------------------------------------------------------------------
\r
18 // <auto-generated />
\r
20 // This file was automatically generated by SWIG (http://www.swig.org).
\r
23 // Do not make changes to this file unless you know what you are doing--modify
\r
24 // the SWIG interface file instead.
\r
25 //------------------------------------------------------------------------------
\r
30 using System.Runtime.InteropServices;
\r
33 public class Timer : BaseHandle
\r
35 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
\r
37 internal Timer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Timer_SWIGUpcast(cPtr), cMemoryOwn)
\r
39 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
\r
42 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Timer obj)
\r
44 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
\r
49 DisposeQueue.Instance.Add(this);
\r
52 public override void Dispose()
\r
54 if (!Stage.IsInstalled())
\r
56 DisposeQueue.Instance.Add(this);
\r
62 if (swigCPtr.Handle != global::System.IntPtr.Zero)
\r
66 swigCMemOwn = false;
\r
67 NDalicPINVOKE.delete_Timer(swigCPtr);
\r
69 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
\r
71 global::System.GC.SuppressFinalize(this);
\r
77 public Timer(uint milliSec) : this(NDalicPINVOKE.Timer_New(milliSec), true)
\r
79 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
82 internal Timer(Timer timer) : this(NDalicPINVOKE.new_Timer__SWIG_1(Timer.getCPtr(timer)), true)
\r
84 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
87 internal Timer Assign(Timer timer)
\r
89 Timer ret = new Timer(NDalicPINVOKE.Timer_Assign(swigCPtr, Timer.getCPtr(timer)), false);
\r
90 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
94 public static Timer DownCast(BaseHandle handle)
\r
96 Timer ret = new Timer(NDalicPINVOKE.Timer_DownCast(BaseHandle.getCPtr(handle)), true);
\r
97 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
101 public void Start()
\r
103 NDalicPINVOKE.Timer_Start(swigCPtr);
\r
104 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
109 NDalicPINVOKE.Timer_Stop(swigCPtr);
\r
110 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
113 public uint Interval
\r
117 SetInterval(value);
\r
121 return GetInterval();
\r
125 internal void SetInterval(uint milliSec)
\r
127 NDalicPINVOKE.Timer_SetInterval(swigCPtr, milliSec);
\r
128 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
131 internal uint GetInterval()
\r
133 uint ret = NDalicPINVOKE.Timer_GetInterval(swigCPtr);
\r
134 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
138 public bool Running
\r
142 return IsRunning();
\r
146 internal bool IsRunning()
\r
148 bool ret = NDalicPINVOKE.Timer_IsRunning(swigCPtr);
\r
149 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
156 internal TimerSignalType TickSignal()
\r
158 TimerSignalType ret = new TimerSignalType(NDalicPINVOKE.Timer_TickSignal(swigCPtr), false);
\r
159 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
\r
163 private DaliEventHandlerWithReturnType<object, EventArgs, bool> _tickEventHandler;
\r
164 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
\r
165 internal delegate bool TickCallbackType();
\r
166 private TickCallbackType _tickCallBack;
\r
168 public event DaliEventHandlerWithReturnType<object, EventArgs, bool> Tick
\r
172 if (_tickCallBack == null)
\r
174 _tickCallBack = OnTick;
\r
175 this.TickSignal().Connect(_tickCallBack);
\r
177 _tickEventHandler += value;
\r
181 if (_tickCallBack != null)
\r
183 this.TickSignal().Disconnect(_tickCallBack);
\r
184 _tickCallBack = null;
\r
186 _tickEventHandler -= value;
\r
189 private bool OnTick()
\r
191 if (_tickEventHandler != null)
\r
193 return _tickEventHandler(this, null);
\r