X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Finternal%2FCustomAlgorithmInterface.cs;h=a9be735d8361edf3b16417cf8b785030ea5d9e0f;hb=46b8a31f5c1c75a22b648ca394a4de8a50898513;hp=b33efff92e5819aa48ed5ac59e2087b526e0797d;hpb=5c5de1f44adc3387513454aa2149d2601abd5a74;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.NUI/src/internal/CustomAlgorithmInterface.cs b/src/Tizen.NUI/src/internal/CustomAlgorithmInterface.cs index b33efff..a9be735 100755 --- a/src/Tizen.NUI/src/internal/CustomAlgorithmInterface.cs +++ b/src/Tizen.NUI/src/internal/CustomAlgorithmInterface.cs @@ -20,8 +20,7 @@ using Tizen.NUI.BaseComponents; namespace Tizen.NUI { - - internal class CustomAlgorithmInterface : global::System.IDisposable + internal class CustomAlgorithmInterface : Disposable { private global::System.Runtime.InteropServices.HandleRef swigCPtr; protected bool swigCMemOwn; @@ -37,55 +36,13 @@ 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; - - - ~CustomAlgorithmInterface() - { - 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 Dispose(DisposeTypes type) { 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. @@ -95,22 +52,22 @@ namespace Tizen.NUI if (swigCMemOwn) { swigCMemOwn = false; - NDalicPINVOKE.delete_CustomAlgorithmInterface(swigCPtr); + Interop.CustomAlgorithmInterface.delete_CustomAlgorithmInterface(swigCPtr); } swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); } - disposed = true; + base.Dispose(type); } public virtual View GetNextFocusableView(View current, View proposed, View.FocusDirection direction) { - View ret = new View(NDalicPINVOKE.CustomAlgorithmInterface_GetNextFocusableActor(swigCPtr, View.getCPtr(current), View.getCPtr(proposed), (int)direction), true); + View ret = new View(Interop.CustomAlgorithmInterface.CustomAlgorithmInterface_GetNextFocusableActor(swigCPtr, View.getCPtr(current), View.getCPtr(proposed), (int)direction), true); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return ret; } - internal CustomAlgorithmInterface() : this(NDalicPINVOKE.new_CustomAlgorithmInterface(), true) + internal CustomAlgorithmInterface() : this(Interop.CustomAlgorithmInterface.new_CustomAlgorithmInterface(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); SwigDirectorConnect(); @@ -120,7 +77,7 @@ namespace Tizen.NUI { if (SwigDerivedClassHasMethod("GetNextFocusableView", swigMethodTypes0)) swigDelegate0 = new SwigDelegateCustomAlgorithmInterface_0(SwigDirectorGetNextFocusableView); - NDalicPINVOKE.CustomAlgorithmInterface_director_connect(swigCPtr, swigDelegate0); + Interop.CustomAlgorithmInterface.CustomAlgorithmInterface_director_connect(swigCPtr, swigDelegate0); } private bool SwigDerivedClassHasMethod(string methodName, global::System.Type[] methodTypes) @@ -144,5 +101,4 @@ namespace Tizen.NUI private static global::System.Type[] swigMethodTypes0 = new global::System.Type[] { typeof(View), typeof(View), typeof(View.FocusDirection) }; } - }