2 * Copyright(c) 2019 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;
23 internal class ContentReceivedSignalType : global::System.IDisposable
25 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
27 /// ContentReceivedSignalType
29 protected bool swigCMemOwn;
31 internal ContentReceivedSignalType(global::System.IntPtr cPtr, bool cMemoryOwn)
33 swigCMemOwn = cMemoryOwn;
34 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
37 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ContentReceivedSignalType obj)
39 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
42 //A Flag to check who called Dispose(). (By User or DisposeQueue)
43 private bool isDisposeQueued = false;
45 /// A Flat to check if it is already disposed.
47 protected bool disposed = false;
52 ~ContentReceivedSignalType()
56 isDisposeQueued = true;
57 DisposeQueue.Instance.Add(this);
66 //Throw excpetion if Dispose() is called in separate thread.
67 if (!Window.IsInstalled())
69 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
74 Dispose(DisposeTypes.Implicit);
78 Dispose(DisposeTypes.Explicit);
79 System.GC.SuppressFinalize(this);
86 protected virtual void Dispose(DisposeTypes type)
93 if (type == DisposeTypes.Explicit)
96 //Release your own managed resources here.
97 //You should release all of your own disposable objects here.
101 //Release your own unmanaged resources here.
102 //You should not access any managed member here except static instance.
103 //because the execution order of Finalizes is non-deterministic.
104 if (swigCPtr.Handle != global::System.IntPtr.Zero)
109 Interop.ContentReceivedSignalType.delete_ContentReceivedSignalType(swigCPtr);
111 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
118 /// Queries whether there are any connected slots.
120 /// <returns>True if there are any slots connected to the signal</returns>
123 bool ret = Interop.ContentReceivedSignalType.ContentReceivedSignalType_Empty(swigCPtr);
124 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
129 /// Queries the number of slots.
131 /// <returns>The number of slots connected to this signal</returns>
132 public uint GetConnectionCount()
134 uint ret = Interop.ContentReceivedSignalType.ContentReceivedSignalType_GetConnectionCount(swigCPtr);
135 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
140 /// Connects a function.
142 /// <param name="func">The function to connect</param>
143 public void Connect(System.Delegate func)
145 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
147 Interop.ContentReceivedSignalType.ContentReceivedSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
148 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
153 /// Disconnects a function.
155 /// <param name="func">The function to disconnect</param>
156 public void Disconnect(System.Delegate func)
158 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
160 Interop.ContentReceivedSignalType.ContentReceivedSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
161 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
166 /// Connects a member function.
168 /// <param name="arg1">The member function to connect</param>
169 /// <param name="arg2">The member function to connect</param>
170 /// <param name="arg3">The member function to connect</param>
171 public void Emit(string arg1, string arg2, string arg3)
173 Interop.ContentReceivedSignalType.ContentReceivedSignalType_Emit(swigCPtr, arg1, arg2, arg3);
174 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
180 public ContentReceivedSignalType() : this(Interop.ContentReceivedSignalType.new_ContentReceivedSignalType(), true)
182 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();