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;
25 /// Please do not use! this will be deprecated
27 /// <since_tizen> 4 </since_tizen>
28 [Obsolete("Please do not use! This will be deprecated!")]
29 [EditorBrowsable(EditorBrowsableState.Never)]
30 public class SignalObserver : global::System.IDisposable
32 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
36 /// <since_tizen> 4 </since_tizen>
37 protected bool swigCMemOwn;
39 internal SignalObserver(global::System.IntPtr cPtr, bool cMemoryOwn)
41 swigCMemOwn = cMemoryOwn;
42 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
45 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SignalObserver obj)
47 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
50 //A Flag to check who called Dispose(). (By User or DisposeQueue)
51 private bool isDisposeQueued = false;
53 /// A Flat to check if it is already disposed.
55 /// <since_tizen> 4 </since_tizen>
56 protected bool disposed = false;
61 /// <since_tizen> 3 </since_tizen>
66 isDisposeQueued = true;
67 DisposeQueue.Instance.Add(this);
74 /// <since_tizen> 4 </since_tizen>
77 //Throw excpetion if Dispose() is called in separate thread.
78 if (!Window.IsInstalled())
80 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
85 Dispose(DisposeTypes.Implicit);
89 Dispose(DisposeTypes.Explicit);
90 System.GC.SuppressFinalize(this);
97 /// <since_tizen> 4 </since_tizen>
98 protected virtual void Dispose(DisposeTypes type)
105 if (type == DisposeTypes.Explicit)
108 //Release your own managed resources here.
109 //You should release all of your own disposable objects here.
113 //Release your own unmanaged resources here.
114 //You should not access any managed member here except static instance.
115 //because the execution order of Finalizes is non-deterministic.
117 if (swigCPtr.Handle != global::System.IntPtr.Zero)
122 NDalicPINVOKE.delete_SignalObserver(swigCPtr);
124 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
131 /// This method is called when the signal is disconnecting.
133 /// <param name="slotObserver">The signal that has disconnected</param>
134 /// <param name="callback">The callback attached to the signal disconnected</param>
135 /// <since_tizen> 4 </since_tizen>
136 public virtual void SignalDisconnected(SlotObserver slotObserver, SWIGTYPE_p_Dali__CallbackBase callback)
138 NDalicPINVOKE.SignalObserver_SignalDisconnected(swigCPtr, SlotObserver.getCPtr(slotObserver), SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback));
139 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();