X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Finternal%2FControlKeySignal.cs;h=01ccdd5fe0d931f0bd766cecc2d76e820dd8de3f;hb=c3ecc722bf90238ce39641035c599e0c7880477b;hp=3bd06b74aa16499de50960f9b06efa31e8634f43;hpb=559676592d798bebf93db9d89bf1649eae06f8ab;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.NUI/src/internal/ControlKeySignal.cs b/src/Tizen.NUI/src/internal/ControlKeySignal.cs index 3bd06b7..01ccdd5 100755 --- a/src/Tizen.NUI/src/internal/ControlKeySignal.cs +++ b/src/Tizen.NUI/src/internal/ControlKeySignal.cs @@ -1,5 +1,5 @@ /* - * Copyright(c) 2017 Samsung Electronics Co., Ltd. + * Copyright(c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,16 +19,11 @@ using Tizen.NUI.BaseComponents; namespace Tizen.NUI { - - internal class ControlKeySignal : global::System.IDisposable + internal class ControlKeySignal : Disposable { - private global::System.Runtime.InteropServices.HandleRef swigCPtr; - protected bool swigCMemOwn; - internal ControlKeySignal(global::System.IntPtr cPtr, bool cMemoryOwn) + internal ControlKeySignal(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) { - swigCMemOwn = cMemoryOwn; - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); } internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ControlKeySignal obj) @@ -36,83 +31,21 @@ namespace Tizen.NUI return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; } - //A Flag to check who called Dispose(). (By User or DisposeQueue) - private bool isDisposeQueued = false; - //A Flat to check if it is already disposed. - protected bool disposed = false; - - - ~ControlKeySignal() - { - if (!isDisposeQueued) - { - isDisposeQueued = true; - DisposeQueue.Instance.Add(this); - } - } - - public void Dispose() - { - //Throw excpetion if Dispose() is called in separate thread. - if (!Window.IsInstalled()) - { - throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); - } - - if (isDisposeQueued) - { - Dispose(DisposeTypes.Implicit); - } - else - { - Dispose(DisposeTypes.Explicit); - System.GC.SuppressFinalize(this); - } - } - - protected virtual void Dispose(DisposeTypes type) + protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr) { - if (disposed) - { - return; - } - - if (type == DisposeTypes.Explicit) - { - //Called by User - //Release your own managed resources here. - //You should release all of your own disposable objects here. - - } - - //Release your own unmanaged resources here. - //You should not access any managed member here except static instance. - //because the execution order of Finalizes is non-deterministic. - - if (swigCPtr.Handle != global::System.IntPtr.Zero) - { - if (swigCMemOwn) - { - swigCMemOwn = false; - NDalicPINVOKE.delete_ControlKeySignal(swigCPtr); - } - swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); - } - - disposed = true; + Interop.ControlKeySignal.delete_ControlKeySignal(swigCPtr); } - public bool Empty() { - bool ret = NDalicPINVOKE.ControlKeySignal_Empty(swigCPtr); + bool ret = Interop.ControlKeySignal.ControlKeySignal_Empty(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } public uint GetConnectionCount() { - uint ret = NDalicPINVOKE.ControlKeySignal_GetConnectionCount(swigCPtr); + uint ret = Interop.ControlKeySignal.ControlKeySignal_GetConnectionCount(swigCPtr); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -121,7 +54,7 @@ namespace Tizen.NUI { System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); { - NDalicPINVOKE.ControlKeySignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + Interop.ControlKeySignal.ControlKeySignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } } @@ -130,23 +63,21 @@ namespace Tizen.NUI { System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); { - NDalicPINVOKE.ControlKeySignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + Interop.ControlKeySignal.ControlKeySignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } } public bool Emit(View arg1, Key arg2) { - bool ret = NDalicPINVOKE.ControlKeySignal_Emit(swigCPtr, View.getCPtr(arg1), Key.getCPtr(arg2)); + bool ret = Interop.ControlKeySignal.ControlKeySignal_Emit(swigCPtr, View.getCPtr(arg1), Key.getCPtr(arg2)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - public ControlKeySignal() : this(NDalicPINVOKE.new_ControlKeySignal(), true) + public ControlKeySignal() : this(Interop.ControlKeySignal.new_ControlKeySignal(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - } - }