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.
17 using System.ComponentModel;
23 /// Signal connection class for PropertyNotification
25 /// <since_tizen> 4 </since_tizen>
26 /// This will be changed internal API after ACR done. Before ACR, need to be hidden as inhouse API.
27 [EditorBrowsable(EditorBrowsableState.Never)]
28 public class PropertyNotifySignal : global::System.IDisposable
33 /// <since_tizen> 4 </since_tizen>
34 /// This will be changed internal API after ACR done. Before ACR, need to be hidden as inhouse API.
35 [EditorBrowsable(EditorBrowsableState.Never)]
36 protected bool swigCMemOwn;
38 /// A Flat to check if it is already disposed.
40 /// <since_tizen> 4 </since_tizen>
41 /// This will be changed internal API after ACR done. Before ACR, need to be hidden as inhouse API.
42 [EditorBrowsable(EditorBrowsableState.Never)]
43 protected bool disposed = false;
45 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
47 //A Flag to check who called Dispose(). (By User or DisposeQueue)
48 private bool isDisposeQueued = false;
53 /// <since_tizen> 4 </since_tizen>
54 /// This will be changed internal API after ACR done. Before ACR, need to be hidden as inhouse API.
55 [EditorBrowsable(EditorBrowsableState.Never)]
56 public PropertyNotifySignal() : this(NDalicPINVOKE.new_PropertyNotifySignal(), true)
58 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
61 internal PropertyNotifySignal(global::System.IntPtr cPtr, bool cMemoryOwn)
63 swigCMemOwn = cMemoryOwn;
64 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
70 /// <since_tizen> 3 </since_tizen>
71 /// This will be changed internal API after ACR done. Before ACR, need to be hidden as inhouse API.
72 [EditorBrowsable(EditorBrowsableState.Never)]
73 ~PropertyNotifySignal()
77 isDisposeQueued = true;
78 DisposeQueue.Instance.Add(this);
85 /// <since_tizen> 4 </since_tizen>
86 /// This will be changed internal API after ACR done. Before ACR, need to be hidden as inhouse API.
87 [EditorBrowsable(EditorBrowsableState.Never)]
90 //Throw excpetion if Dispose() is called in separate thread.
91 if (!Window.IsInstalled())
93 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
98 Dispose(DisposeTypes.Implicit);
102 Dispose(DisposeTypes.Explicit);
103 System.GC.SuppressFinalize(this);
108 /// Queries whether there are any connected slots.
110 /// <returns>True if there are any slots connected to the signal.</returns>
111 /// <since_tizen> 4 </since_tizen>
112 /// This will be changed internal API after ACR done. Before ACR, need to be hidden as inhouse API.
113 [EditorBrowsable(EditorBrowsableState.Never)]
116 bool ret = NDalicPINVOKE.PropertyNotifySignal_Empty(swigCPtr);
117 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
122 /// Queries the number of slots.
124 /// <returns>The number of slots connected to this signal</returns>
125 /// <since_tizen> 4 </since_tizen>
126 /// This will be changed internal API after ACR done. Before ACR, need to be hidden as inhouse API.
127 [EditorBrowsable(EditorBrowsableState.Never)]
128 public uint GetConnectionCount()
130 uint ret = NDalicPINVOKE.PropertyNotifySignal_GetConnectionCount(swigCPtr);
131 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
136 /// Connects a function.
138 /// <param name="func">The function to connect</param>
139 /// <since_tizen> 4 </since_tizen>
140 /// This will be changed internal API after ACR done. Before ACR, need to be hidden as inhouse API.
141 [EditorBrowsable(EditorBrowsableState.Never)]
142 public void Connect(System.Delegate func)
144 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
146 NDalicPINVOKE.PropertyNotifySignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
147 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
152 /// Disconnects a function.
154 /// <param name="func">The function to disconnect.</param>
155 /// <since_tizen> 4 </since_tizen>
156 /// This will be changed internal API after ACR done. Before ACR, need to be hidden as inhouse API.
157 [EditorBrowsable(EditorBrowsableState.Never)]
158 public void Disconnect(System.Delegate func)
160 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
162 NDalicPINVOKE.PropertyNotifySignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
163 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
168 /// Emits a signal with 1 parameter.
170 /// <param name="arg">The first value to pass to callbacks.</param>
171 /// <since_tizen> 4 </since_tizen>
172 /// This will be changed internal API after ACR done. Before ACR, need to be hidden as inhouse API.
173 [EditorBrowsable(EditorBrowsableState.Never)]
174 public void Emit(PropertyNotification arg)
176 NDalicPINVOKE.PropertyNotifySignal_Emit(swigCPtr, PropertyNotification.getCPtr(arg));
177 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
180 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PropertyNotifySignal obj)
182 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
188 /// <param name="type">The dispose type.</param>
189 /// <since_tizen> 4 </since_tizen>
190 /// This will be changed internal API after ACR done. Before ACR, need to be hidden as inhouse API.
191 [EditorBrowsable(EditorBrowsableState.Never)]
192 protected virtual void Dispose(DisposeTypes type)
199 if (type == DisposeTypes.Explicit)
202 //Release your own managed resources here.
203 //You should release all of your own disposable objects here.
207 //Release your own unmanaged resources here.
208 //You should not access any managed member here except static instance.
209 //because the execution order of Finalizes is non-deterministic.
211 if (swigCPtr.Handle != global::System.IntPtr.Zero)
216 NDalicPINVOKE.delete_PropertyNotifySignal(swigCPtr);
218 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);