[NUI] Fix build warning[CA1000]
authorhuiyu <huiyu.eun@samsung.com>
Mon, 14 Dec 2020 04:49:29 +0000 (13:49 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 15 Dec 2020 06:33:59 +0000 (15:33 +0900)
Signed-off-by: huiyu <huiyu.eun@samsung.com>
12 files changed:
src/Tizen.NUI.Components/Controls/Extension/SlidingSwitchExtension.cs
src/Tizen.NUI/src/internal/DisposeQueue.cs
src/Tizen.NUI/src/public/Accessibility/Accessibility.cs
src/Tizen.NUI/src/public/BaseComponents/Style/ViewStyle.cs
src/Tizen.NUI/src/public/KeyValue.cs
src/Tizen.NUI/src/public/Layouting/LayoutItem.cs
src/Tizen.NUI/src/public/Layouting/LayoutTransition.cs
src/Tizen.NUI/src/public/Layouting/LinearLayout.cs
src/Tizen.NUI/src/public/TransitionAnimations/TransitionAnimations.cs
src/Tizen.NUI/src/public/ViewProperty/BackgroundExtraData.cs
src/Tizen.NUI/src/public/ViewProperty/TextShadow.cs
src/Tizen.NUI/src/public/VisualMaps.cs

index 1086ceb..b37cb5e 100755 (executable)
@@ -27,7 +27,7 @@ namespace Tizen.NUI.Components.Extension
     /// </remark>
     /// </summary>
     [EditorBrowsable(EditorBrowsableState.Never)]
-    internal class SlidingSwitchExtension : SwitchExtension
+    internal class SlidingSwitchExtension : SwitchExtension, IDisposable
     {
         private Animation slidingAnimation;
 
@@ -68,6 +68,7 @@ namespace Tizen.NUI.Components.Extension
             }
         }
 
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public override void OnDispose(Button button)
         {
             if (slidingAnimation != null)
@@ -80,5 +81,22 @@ namespace Tizen.NUI.Components.Extension
                 slidingAnimation = null;
             }
         }
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                // Dispose managed resources.
+                slidingAnimation?.Dispose();
+            }
+            // Free native resources.
+        }
+
+        public void Dispose()
+        {
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
     }
 }
index 917ee28..5fc50b5 100755 (executable)
@@ -12,7 +12,7 @@ using System.Collections.Generic;
 
 namespace Tizen.NUI
 {
-    internal class DisposeQueue
+    internal class DisposeQueue : IDisposable
     {
         private static readonly DisposeQueue _disposableQueue = new DisposeQueue();
         private List<IDisposable> _disposables = new List<IDisposable>();
@@ -68,5 +68,22 @@ namespace Tizen.NUI
                 _disposables.Clear();
             }
         }
+
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                // Dispose managed resources.
+                _disposableQueue?.Dispose();
+            }
+            // Free native resources.
+        }
+
+        public void Dispose()
+        {
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
+
     }
 }
index ccd593a..9bf85c0 100755 (executable)
@@ -30,7 +30,7 @@ namespace Tizen.NUI.Accessibility
     /// </summary>
     // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
     [EditorBrowsable(EditorBrowsableState.Never)]
-    public class Accessibility
+    public class Accessibility : IDisposable
     {
         #region Constructor, Distructor, Dispose
         private Accessibility()
@@ -221,5 +221,21 @@ namespace Tizen.NUI.Accessibility
 
         private static string tag = "NUITEST";
         #endregion Private
+
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                // Dispose managed resources.
+                dummy?.Dispose();
+            }
+            // Free native resources.
+        }
+
+        public void Dispose()
+        {
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
     }
 }
index 782e050..8543257 100755 (executable)
@@ -26,7 +26,7 @@ namespace Tizen.NUI.BaseComponents
     /// </summary>
     /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
     [EditorBrowsable(EditorBrowsableState.Never)]
-    public partial class ViewStyle : BindableObject
+    public partial class ViewStyle : BindableObject, IDisposable
     {
         private string styleName;
         private View.States? state;
@@ -768,5 +768,21 @@ namespace Tizen.NUI.BaseComponents
         {
             Margin = new Extents(start, end, top, bottom);
         }
+
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                // Dispose managed resources.
+                padding?.Dispose();
+            }
+            // Free native resources.
+        }
+
+        public void Dispose()
+        {
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
     }
 }
index 87c5445..033e210 100755 (executable)
@@ -16,6 +16,7 @@
  */
 
 using System;
+using System.ComponentModel;
 using Tizen.NUI.Binding;
 
 namespace Tizen.NUI
@@ -23,7 +24,7 @@ namespace Tizen.NUI
     /// <summary>
     /// KeyValue class.
     /// </summary>
-    public class KeyValue
+    public class KeyValue : IDisposable
     {
         /// <summary>
         /// Int key.
@@ -352,5 +353,23 @@ namespace Tizen.NUI
                 KeyString = Key;
             }
         }
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                // Dispose managed resources.
+                TrueValue?.Dispose();
+            }
+            // Free native resources.
+        }
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void Dispose()
+        {
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
     }
 }
index 3133f44..e330949 100755 (executable)
@@ -37,7 +37,7 @@ namespace Tizen.NUI
     /// [Draft] Base class for layouts. It is used to layout a View
     /// It can be laid out by a LayoutGroup.
     /// </summary>
-    public class LayoutItem
+    public class LayoutItem : IDisposable
     {
         static bool LayoutDebugFrameData = false; // Debug flag
         private MeasureSpecification OldWidthMeasureSpec; // Store measure specification to compare against later
@@ -624,5 +624,24 @@ namespace Tizen.NUI
 
             return changed;
         }
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                // Dispose managed resources.
+                _padding?.Dispose();
+                _margin?.Dispose();
+            }
+            // Free native resources.
+        }
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void Dispose()
+        {
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
     }
 }
index 3611f15..0b851cb 100755 (executable)
@@ -17,6 +17,7 @@
 
 using System.Collections.Generic;
 using System;
+using System.ComponentModel;
 
 namespace Tizen.NUI
 {
@@ -100,7 +101,7 @@ namespace Tizen.NUI
     /// Parts of the transition that can be configured to provide a custom effect.
     /// </summary>
     /// <since_tizen> 6 </since_tizen>
-    public class TransitionComponents
+    public class TransitionComponents : IDisposable
     {
         /// <summary>
         /// TransitionComponents default constructor.
@@ -143,6 +144,24 @@ namespace Tizen.NUI
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
         public AlphaFunction AlphaFunction;
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                // Dispose managed resources.
+                AlphaFunction?.Dispose();
+            }
+            // Free native resources.
+        }
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void Dispose()
+        {
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
     }
 
     /// <summary>
index 584f235..fcbd291 100755 (executable)
@@ -18,6 +18,7 @@ using System;
 using Tizen.NUI.BaseComponents;
 using System.Collections.Generic;
 using System.Linq;
+using System.ComponentModel;
 
 namespace Tizen.NUI
 {
@@ -829,5 +830,18 @@ namespace Tizen.NUI
                 }
             }
         }
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                // Dispose managed resources.
+                _cellPadding?.Dispose();
+            }
+            // Free native resources.
+            base.Dispose(disposing);
+        }
+
     } //LinearLayout
 } // namespace
index f2799d5..16cf635 100755 (executable)
@@ -42,7 +42,7 @@ namespace Tizen.NUI
     /// Transition animation effect
     /// </summary>
     [EditorBrowsable(EditorBrowsableState.Never)]
-    public class TransitionAnimation
+    public class TransitionAnimation : IDisposable
     {
         private ImageViewStyle defaultImageStyle;
         private List<TransitionAnimationData> animationDataList;
@@ -136,6 +136,24 @@ namespace Tizen.NUI
                 defaultImageStyle = value;
             }
         }
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                // Dispose managed resources.
+                defaultImageStyle?.Dispose();
+            }
+            // Free native resources.
+        }
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void Dispose()
+        {
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
     }
 
     /// <summary>
index 8d95088..387faaa 100755 (executable)
  *
  */
 
+using System;
+
 namespace Tizen.NUI
 {
     /// <summary>
     /// The class storing Background extra properties such as CornerRadius, ImageBorder.
     /// </summary>
-    internal class BackgroundExtraData
+    internal class BackgroundExtraData : IDisposable
     {
         internal BackgroundExtraData()
         {
@@ -53,6 +55,23 @@ namespace Tizen.NUI
         {
             return CornerRadius == 0 && Rectangle.IsNullOrZero(BackgroundImageBorder);
         }
+
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                // Dispose managed resources.
+                backgroundImageBorder?.Dispose();
+            }
+            // Free native resources.
+        }
+
+        public void Dispose()
+        {
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
+
     }
 }
 
index af116f8..6d07c9e 100755 (executable)
@@ -24,7 +24,7 @@ namespace Tizen.NUI
     /// The Text Shadow for TextLabel.
     /// </summary>
     [EditorBrowsable(EditorBrowsableState.Never)]
-    public class TextShadow : ICloneable
+    public class TextShadow : ICloneable, IDisposable
     {
         private readonly PropertyMap propertyMap = null;
 
@@ -113,5 +113,22 @@ namespace Tizen.NUI
 
             return new PropertyValue(instance.propertyMap);
         }
+
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                // Dispose managed resources.
+                propertyMap?.Dispose();
+            }
+            // Free native resources.
+        }
+
+        public void Dispose()
+        {
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
+
     }
 }
index 6ee9e4a..425398a 100755 (executable)
@@ -14,6 +14,7 @@
  * limitations under the License.
  *
  */
+using System;
 using System.ComponentModel;
 using Tizen.NUI.BaseComponents;
 
@@ -23,7 +24,7 @@ namespace Tizen.NUI
     /// A class encapsulating the transform map of the visual.
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
-    public class VisualMap
+    public class VisualMap : IDisposable
     {
         /// <summary>
         /// outputVisualMap.
@@ -676,5 +677,31 @@ namespace Tizen.NUI
             if (_visualOrigin != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Origin, new PropertyValue((int)_visualOrigin)); }
             if (_visualAnchorPoint != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.AnchorPoint, new PropertyValue((int)_visualAnchorPoint)); }
         }
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                // Dispose managed resources.
+                _outputVisualMap?.Dispose();
+                _shader?.Dispose();
+                _mixColor?.Dispose();
+                _visualSize?.Dispose();
+                _visualOffset?.Dispose();
+                _visualOffsetPolicy?.Dispose();
+                _visualSizePolicy?.Dispose();
+                _visualTransformMap?.Dispose();
+            }
+            // Free native resources.
+        }
+
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void Dispose()
+        {
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
+
     }
 }