[NUI] Add public types to replace nested types of Components.Switch (#1809)
authorjaehyun0cho <jaehyun0cho@gmail.com>
Tue, 21 Jul 2020 02:20:22 +0000 (11:20 +0900)
committerGitHub <noreply@github.com>
Tue, 21 Jul 2020 02:20:22 +0000 (11:20 +0900)
To replace nested types (CA1034 of StyleCop), the following is added.
- event EventHandler<SelectedChangedEventArgs> in Switch class

The followings are deprecated.
- class SelectEventArgs in Switch class
- event EventHandler<SelectEventArgs> in Switch class

Co-authored-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
src/Tizen.NUI.Components/Controls/Switch.cs

index f658e40..0d668dd 100755 (executable)
@@ -66,9 +66,16 @@ namespace Tizen.NUI.Components
         /// An event for the item selected signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
+        [Obsolete("Deprecated in API8; Will be removed in API10. Please use SelectedChanged event instead.")]
         public event EventHandler<SelectEventArgs> SelectedEvent;
 
         /// <summary>
+        /// An event for the item selected signal which can be used to subscribe or unsubscribe the event handler provided by the user.
+        /// </summary>
+        /// <since_tizen> 8 </since_tizen>
+        public event EventHandler<SelectedChangedEventArgs> SelectedChanged;
+
+        /// <summary>
         /// Return a copied Style instance of Switch
         /// </summary>
         /// <remarks>
@@ -334,12 +341,20 @@ namespace Tizen.NUI.Components
                 eventArgs.IsSelected = IsSelected;
                 SelectedEvent(this, eventArgs);
             }
+
+            if (SelectedChanged != null)
+            {
+                SelectedChangedEventArgs eventArgs = new SelectedChangedEventArgs();
+                eventArgs.IsSelected = IsSelected;
+                SelectedChanged(this, eventArgs);
+            }
         }
 
         /// <summary>
         /// SelectEventArgs is a class to record item selected arguments which will sent to user.
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
+        [Obsolete("Deprecated in API8; Will be removed in API10. Please use SelectedChangedEventArgs instead.")]
         public class SelectEventArgs : EventArgs
         {
             /// <summary> Select state of Switch </summary>