2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 /// LowBatterySignalType.
24 internal class LowBatterySignalType : global::System.IDisposable
26 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
31 protected bool swigCMemOwn;
33 internal LowBatterySignalType(global::System.IntPtr cPtr, bool cMemoryOwn)
35 swigCMemOwn = cMemoryOwn;
36 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
39 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(LowBatterySignalType obj)
41 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
44 //A Flag to check who called Dispose(). (By User or DisposeQueue)
45 private bool isDisposeQueued = false;
48 /// A Flat to check if it is already disposed.
50 protected bool disposed = false;
56 ~LowBatterySignalType()
60 isDisposeQueued = true;
61 DisposeQueue.Instance.Add(this);
70 //Throw excpetion if Dispose() is called in separate thread.
71 if (!Window.IsInstalled())
73 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
78 Dispose(DisposeTypes.Implicit);
82 Dispose(DisposeTypes.Explicit);
83 System.GC.SuppressFinalize(this);
88 /// you can override it to clean-up your own resources.
90 /// <param name="type">DisposeTypes</param>
91 /// <since_tizen> 3 </since_tizen>
92 protected virtual void Dispose(DisposeTypes type)
99 if (type == DisposeTypes.Explicit)
102 //Release your own managed resources here.
103 //You should release all of your own disposable objects here.
107 //Release your own unmanaged resources here.
108 //You should not access any managed member here except static instance.
109 //because the execution order of Finalizes is non-deterministic.
111 if (swigCPtr.Handle != global::System.IntPtr.Zero)
116 NDalicPINVOKE.delete_LowBatterySignalType(swigCPtr);
118 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
126 /// <returns>true if there is no signal attached</returns>
129 bool ret = NDalicPINVOKE.LowBatterySignalType_Empty(swigCPtr);
130 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
135 /// GetConnectionCount
137 /// <returns>number of attached signals</returns>
138 public uint GetConnectionCount()
140 uint ret = NDalicPINVOKE.LowBatterySignalType_GetConnectionCount(swigCPtr);
141 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
148 /// <param name="func"></param>
149 public void Connect(System.Delegate func)
151 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
153 NDalicPINVOKE.LowBatterySignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
154 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
159 /// signal disconnect
161 /// <param name="func"></param>
162 public void Disconnect(System.Delegate func)
164 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
166 NDalicPINVOKE.LowBatterySignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
167 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
171 internal void Emit(Application.BatteryStatus arg)
173 NDalicPINVOKE.LowBatterySignalType_Emit(swigCPtr, (int)arg);
174 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
178 /// LowBatterySignalType
180 public LowBatterySignalType() : this(NDalicPINVOKE.new_LowBatterySignalType(), true)
182 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();