07b54a46781dc26d95ea4781dbd0bbe9566092af
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / AuthenticationSignalType.cs
1 /*
2  * Copyright(c) 2019 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17 using System;
18 using System.Runtime.InteropServices;
19 using System.ComponentModel;
20
21 namespace Tizen.NUI
22 {
23     internal class AuthenticationSignalType : global::System.IDisposable
24     {
25         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
26         /// <summary>
27         /// swigCMemOwn
28         /// </summary>
29         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
30         [EditorBrowsable(EditorBrowsableState.Never)]
31         protected bool swigCMemOwn;
32
33         internal AuthenticationSignalType(global::System.IntPtr cPtr, bool cMemoryOwn)
34         {
35             swigCMemOwn = cMemoryOwn;
36             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
37         }
38
39         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AuthenticationSignalType obj)
40         {
41             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
42         }
43
44         //A Flag to check who called Dispose(). (By User or DisposeQueue)
45         private bool isDisposeQueued = false;
46         /// <summary>
47         /// A Flat to check if it is already disposed.
48         /// </summary>
49         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
50         [EditorBrowsable(EditorBrowsableState.Never)]
51         protected bool disposed = false;
52
53         /// <summary>
54         /// Dispose
55         /// </summary>
56         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
57         [EditorBrowsable(EditorBrowsableState.Never)]
58         ~AuthenticationSignalType()
59         {
60             if (!isDisposeQueued)
61             {
62                 isDisposeQueued = true;
63                 DisposeQueue.Instance.Add(this);
64             }
65         }
66
67         /// <summary>
68         /// Dispose
69         /// </summary>
70         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
71         [EditorBrowsable(EditorBrowsableState.Never)]
72         public void Dispose()
73         {
74             //Throw excpetion if Dispose() is called in separate thread.
75             if (!Window.IsInstalled())
76             {
77                 throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread.");
78             }
79
80             if (isDisposeQueued)
81             {
82                 Dispose(DisposeTypes.Implicit);
83             }
84             else
85             {
86                 Dispose(DisposeTypes.Explicit);
87                 System.GC.SuppressFinalize(this);
88             }
89         }
90
91         /// <summary>
92         /// Dispose
93         /// </summary>
94         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
95         [EditorBrowsable(EditorBrowsableState.Never)]
96         protected virtual void Dispose(DisposeTypes type)
97         {
98             if (disposed)
99             {
100                 return;
101             }
102
103             if (type == DisposeTypes.Explicit)
104             {
105                 //Called by User
106                 //Release your own managed resources here.
107                 //You should release all of your own disposable objects here.
108
109             }
110
111             //Release your own unmanaged resources here.
112             //You should not access any managed member here except static instance.
113             //because the execution order of Finalizes is non-deterministic.
114
115             if (swigCPtr.Handle != global::System.IntPtr.Zero)
116             {
117                 if (swigCMemOwn)
118                 {
119                     swigCMemOwn = false;
120                     Interop.AuthenticationSignalType.delete_AuthenticationSignalType(swigCPtr);
121                 }
122                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
123             }
124
125             disposed = true;
126         }
127
128         /// <summary>
129         /// Queries whether there are any connected slots.
130         /// </summary>
131         /// <returns>True if there are any slots connected to the signal</returns>
132         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
133         [EditorBrowsable(EditorBrowsableState.Never)]
134         public bool Empty()
135         {
136             bool ret = Interop.AuthenticationSignalType.AuthenticationSignalType_Empty(swigCPtr);
137             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
138             return ret;
139         }
140
141         /// <summary>
142         /// Queries the number of slots.
143         /// </summary>
144         /// <returns>The number of slots connected to this signal</returns>
145         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
146         [EditorBrowsable(EditorBrowsableState.Never)]
147         public uint GetConnectionCount()
148         {
149             uint ret = Interop.AuthenticationSignalType.AuthenticationSignalType_GetConnectionCount(swigCPtr);
150             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
151             return ret;
152         }
153
154         /// <summary>
155         /// Connects a member function.
156         /// </summary>
157         /// <param name="func">The member function to connect</param>
158         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
159         [EditorBrowsable(EditorBrowsableState.Never)]
160         public void Connect(System.Delegate func)
161         {
162             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
163             {
164                 Interop.AuthenticationSignalType.AuthenticationSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
165                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
166             }
167         }
168
169         /// <summary>
170         /// Disconnects a function.
171         /// </summary>
172         /// <param name="func">The function to disconnect</param>
173         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
174         [EditorBrowsable(EditorBrowsableState.Never)]
175         public void Disconnect(System.Delegate func)
176         {
177             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
178             {
179                 Interop.AuthenticationSignalType.AuthenticationSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
180                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
181             }
182         }
183
184         /// <summary>
185         /// Emits the signal.
186         /// </summary>
187         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
188         [EditorBrowsable(EditorBrowsableState.Never)]
189         public void Emit(AutofillContainer arg)
190         {
191             Interop.AuthenticationSignalType.AuthenticationSignalType_Emit(swigCPtr, AutofillContainer.getCPtr(arg));
192             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
193         }
194
195         /// <summary>
196         /// The contructor.
197         /// </summary>
198         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
199         [EditorBrowsable(EditorBrowsableState.Never)]
200         public AuthenticationSignalType() : this(Interop.AuthenticationSignalType.new_AuthenticationSignalType(), true)
201         {
202             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
203         }
204
205     }
206
207 }