8903febabaf66034104c98a024fcce12ff2c5663
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / WebViewPageLoadErrorSignal.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
18 namespace Tizen.NUI
19 {
20     internal class WebViewPageLoadErrorSignal : global::System.IDisposable
21     {
22         private global::System.Runtime.InteropServices.HandleRef swigCPtr;
23
24         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WebViewPageLoadErrorSignal obj)
25         {
26             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
27         }
28
29         //A Flag to check who called Dispose(). (By User or DisposeQueue)
30         private bool isDisposeQueued;
31         //A Flat to check if it is already disposed.
32         protected bool disposed;
33
34         ~WebViewPageLoadErrorSignal()
35         {
36             if (!isDisposeQueued)
37             {
38                 isDisposeQueued = true;
39                 DisposeQueue.Instance.Add(this);
40             }
41         }
42
43         public void Dispose()
44         {
45             if (isDisposeQueued)
46             {
47                 Dispose(false);
48             }
49             else
50             {
51                 Dispose(true);
52                 System.GC.SuppressFinalize(this);
53             }
54         }
55
56         protected virtual void Dispose(bool disposing)
57         {
58             if (disposed)
59             {
60                 return;
61             }
62
63             if (disposing)
64             {
65                 //Called by User
66                 //Release your own managed resources here.
67                 //You should release all of your own disposable objects here.
68
69             }
70
71             //Release your own unmanaged resources here.
72             //You should not access any managed member here except static instance.
73             //because the execution order of Finalizes is non-deterministic.
74
75             if (swigCPtr.Handle != global::System.IntPtr.Zero)
76             {
77                 Interop.WebView.delete_WebViewPageLoadErrorSignal(swigCPtr);
78                 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
79             }
80
81             disposed = true;
82         }
83
84         public void Connect(System.Delegate func)
85         {
86             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
87             {
88                 Interop.WebView.WebViewPageLoadErrorSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
89                 if (NDalicPINVOKE.SWIGPendingException.Pending)
90                 {
91                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
92                 }
93             }
94         }
95
96         public void Disconnect(System.Delegate func)
97         {
98             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
99             {
100                 Interop.WebView.WebViewPageLoadErrorSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip));
101                 if (NDalicPINVOKE.SWIGPendingException.Pending)
102                 {
103                     throw NDalicPINVOKE.SWIGPendingException.Retrieve();
104                 }
105             }
106         }
107
108         public WebViewPageLoadErrorSignal(global::System.IntPtr cPtr)
109         {
110             swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
111         }
112
113     }
114
115 }