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.
18 using System.Runtime.InteropServices;
19 using System.ComponentModel;
24 /// Please do not use! this will be deprecated
26 /// <since_tizen> 3 </since_tizen>
27 [Obsolete("Please do not use! This will be deprecated!")]
28 [EditorBrowsable(EditorBrowsableState.Never)]
29 public class ActivatedSignalType : global::System.IDisposable
31 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
35 /// <since_tizen> 3 </since_tizen>
36 protected bool swigCMemOwn;
38 internal ActivatedSignalType(global::System.IntPtr cPtr, bool cMemoryOwn)
40 swigCMemOwn = cMemoryOwn;
41 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
44 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ActivatedSignalType obj)
46 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
49 //A Flag to check who called Dispose(). (By User or DisposeQueue)
50 private bool isDisposeQueued = false;
52 /// A Flat to check if it is already disposed.
54 /// <since_tizen> 3 </since_tizen>
55 protected bool disposed = false;
60 /// <since_tizen> 3 </since_tizen>
61 ~ActivatedSignalType()
65 isDisposeQueued = true;
66 DisposeQueue.Instance.Add(this);
73 /// <since_tizen> 3 </since_tizen>
76 //Throw excpetion if Dispose() is called in separate thread.
77 if (!Window.IsInstalled())
79 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
84 Dispose(DisposeTypes.Implicit);
88 Dispose(DisposeTypes.Explicit);
89 System.GC.SuppressFinalize(this);
96 /// <since_tizen> 3 </since_tizen>
97 protected virtual void Dispose(DisposeTypes type)
104 if (type == DisposeTypes.Explicit)
107 //Release your own managed resources here.
108 //You should release all of your own disposable objects here.
112 //Release your own unmanaged resources here.
113 //You should not access any managed member here except static instance.
114 //because the execution order of Finalizes is non-deterministic.
116 if (swigCPtr.Handle != global::System.IntPtr.Zero)
121 NDalicManualPINVOKE.delete_ActivatedSignalType(swigCPtr);
123 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
130 /// Queries whether there are any connected slots.
132 /// <returns>True if there are any slots connected to the signal</returns>
133 /// <since_tizen> 3 </since_tizen>
136 bool ret = NDalicManualPINVOKE.ActivatedSignalType_Empty(swigCPtr);
137 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
142 /// Queries the number of slots.
144 /// <returns>The number of slots connected to this signal</returns>
145 /// <since_tizen> 3 </since_tizen>
146 public uint GetConnectionCount()
148 uint ret = NDalicManualPINVOKE.ActivatedSignalType_GetConnectionCount(swigCPtr);
149 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
154 /// Connects a function.
156 /// <param name="func">The function to connect</param>
157 /// <since_tizen> 3 </since_tizen>
158 public void Connect(System.Delegate func)
160 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
162 NDalicManualPINVOKE.ActivatedSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
163 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168 /// Disconnects a function.
170 /// <param name="func">The function to disconnect</param>
171 /// <since_tizen> 3 </since_tizen>
172 public void Disconnect(System.Delegate func)
174 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
176 NDalicManualPINVOKE.ActivatedSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
177 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
182 /// Emits the signal.
184 /// <param name="arg">The first value to pass to callbacks</param>
185 /// <since_tizen> 4 </since_tizen>
186 public void Emit(ImfManager arg)
188 NDalicManualPINVOKE.ActivatedSignalType_Emit(swigCPtr, ImfManager.getCPtr(arg));
189 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
195 /// <since_tizen> 3 </since_tizen>
196 public ActivatedSignalType() : this(NDalicManualPINVOKE.new_ActivatedSignalType(), true)
198 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();