From f3162e2f1b686b472b4c0ef2776890ab5da83705 Mon Sep 17 00:00:00 2001 From: Heonjae Jang Date: Wed, 29 Mar 2017 16:51:29 +0900 Subject: [PATCH] Add comments for TVApps.Controls Change-Id: Ifd3a6313b4eea1ac035ac2777c0b79afcb78237c --- TVApps/TVApps/Controls/AppItemCell.xaml.cs | 60 +++++++++++++------ TVApps/TVApps/Controls/AppListView.xaml.cs | 39 +++++++----- TVApps/TVApps/Controls/CustomButton.xaml.cs | 8 +-- TVApps/TVApps/Controls/NinePatchImage.xaml.cs | 28 +++++++-- TVApps/TVApps/Controls/TVButton.xaml.cs | 39 ++++++------ 5 files changed, 111 insertions(+), 63 deletions(-) diff --git a/TVApps/TVApps/Controls/AppItemCell.xaml.cs b/TVApps/TVApps/Controls/AppItemCell.xaml.cs index bc9cb62..661396d 100755 --- a/TVApps/TVApps/Controls/AppItemCell.xaml.cs +++ b/TVApps/TVApps/Controls/AppItemCell.xaml.cs @@ -21,6 +21,9 @@ using Xamarin.Forms; namespace TVApps.Controls { + /// + /// A enumeration for AppItemCell icon size + /// public enum IconSize { Normal = 0, @@ -28,24 +31,28 @@ namespace TVApps.Controls }; /// - /// Custom Control for Apps List Item Template + /// A custom control for AppListView item template /// public partial class AppItemCell : ViewCell { /// - /// The command will be excuted if the button is clicked + /// A command will be executed if the button is clicked /// public ICommand OnClickedCommand { get; set; } /// - /// The command will be excuted if the button is focused + /// A command will be executed if the button is focused /// public ICommand OnFocusedCommand { get; set; } /// - /// The property for pinned state + /// Identifies the IsPinned bindable property /// public static readonly BindableProperty IsPinnedProperty = BindableProperty.Create("IsPinned", typeof(bool), typeof(AppItemCell), default(bool)); + + /// + /// Gets or sets pin state of AppItemCell + /// public bool IsPinned { get { return (bool)GetValue(IsPinnedProperty); } @@ -53,9 +60,13 @@ namespace TVApps.Controls } /// - /// The property for checked state + /// Identifies the IsChecked bindable property /// public static readonly BindableProperty IsCheckedProperty = BindableProperty.Create("IsChecked", typeof(bool), typeof(AppItemCell), default(bool)); + + /// + /// Gets or sets check state of AppItemCell + /// public bool IsChecked { get { return (bool)GetValue(IsCheckedProperty); } @@ -63,9 +74,13 @@ namespace TVApps.Controls } /// - /// The property for show state of option menu + /// Identifies the IsShowOptions bindable property /// public static readonly BindableProperty IsShowOptionsProperty = BindableProperty.Create("IsShowOptions", typeof(bool), typeof(AppItemCell), default(bool)); + + /// + /// Gets or sets visible state of Option Menu + /// public bool IsShowOptions { get { return (bool)GetValue(IsShowOptionsProperty); } @@ -73,9 +88,13 @@ namespace TVApps.Controls } /// - /// The property for dim state + /// Identifies the IsDim bindable property /// public static readonly BindableProperty IsDimProperty = BindableProperty.Create("IsDim", typeof(bool), typeof(AppItemCell), default(bool)); + + /// + /// Gets or sets dim state of AppItemCell + /// public bool IsDim { get { return (bool)GetValue(IsDimProperty); } @@ -83,9 +102,13 @@ namespace TVApps.Controls } /// - /// The property for focused state + /// Identifies the IsFocused bindable property /// public static readonly BindableProperty IsFocusedProperty = BindableProperty.Create("IsFocused", typeof(bool), typeof(AppItemCell), default(bool), BindingMode.TwoWay); + + /// + /// Gets or sets focus state of AppItemCell + /// public bool IsFocused { get { return (bool)GetValue(IsFocusedProperty); } @@ -93,7 +116,8 @@ namespace TVApps.Controls } /// - /// Constructor + /// A constructor + /// Adds PropertyChanged event handler /// public AppItemCell() { @@ -104,7 +128,7 @@ namespace TVApps.Controls } /// - /// Handles AppItemCell Property Changed event + /// This method is called when the properties of AppItemCell is changed /// Runs animation according to property change of AppItemCell /// /// The source of the event @@ -164,9 +188,9 @@ namespace TVApps.Controls } /// - /// Changes positon and scale of ButtomImage and TextArea + /// A method changes position and scale of ButtomImage and TextArea /// - /// Icon Size for changing + /// IconSize for change scale and position public void ChangeIconSize(IconSize size) { ButtonImage.ScaleTo((size == IconSize.Normal) ? 1.0 : 1.32, 50); @@ -175,7 +199,7 @@ namespace TVApps.Controls } /// - /// Shows option menu + /// A method shows or hides option menu according to parameter /// /// A flag indicates whether the option menu should be showed or not public void ShowOptionMenu(bool isShow) @@ -187,7 +211,7 @@ namespace TVApps.Controls } /// - /// Handles button title Property Changed event + /// This method is called when the properties of TextArea is changed /// /// The source of the event /// The event that is occurred when property of ButtonTitle is changed @@ -200,7 +224,7 @@ namespace TVApps.Controls } /// - /// Handles Button Clicked event + /// This method is called when the AppItemCell is clicked /// /// The source of the event /// The event that is occurred when button is clicked @@ -210,7 +234,7 @@ namespace TVApps.Controls } /// - /// Handles Button Focused event + /// This method is called when the AppItemCell receives focus /// /// The source of the event /// The event that is occurred when button is focused @@ -235,10 +259,10 @@ namespace TVApps.Controls } /// - /// Handles Button Unfocused event + /// This method is called when the AppItemCell loses focus /// /// The source of the event - /// The event that is occured when button is unfocused + /// The event that is occurred when button is unfocused private void OnUnFocused(object sender, EventArgs e) { IsFocused = false; diff --git a/TVApps/TVApps/Controls/AppListView.xaml.cs b/TVApps/TVApps/Controls/AppListView.xaml.cs index b5879ca..0d2a340 100644 --- a/TVApps/TVApps/Controls/AppListView.xaml.cs +++ b/TVApps/TVApps/Controls/AppListView.xaml.cs @@ -24,14 +24,19 @@ using System.Threading.Tasks; namespace TVApps.Controls { /// - /// TV Apps Custom ListView + /// A custom control for list in TV Apps /// public partial class AppListView : ScrollView { + /// - /// The property for source of list items + /// Identifies the ItemsSource bindable property /// public static readonly BindableProperty ItemsSourceProperty = BindableProperty.Create("ItemsSource", typeof(IEnumerable), typeof(AppListView), default(IEnumerable)); + + /// + /// Gets or sets source of list items + /// public IEnumerable ItemsSource { get { return (IEnumerable)GetValue(ItemsSourceProperty); } @@ -39,9 +44,13 @@ namespace TVApps.Controls } /// - /// The property for template of list items + /// Identifies the ItemTemplate bindable property /// public static readonly BindableProperty ItemTemplateProperty = BindableProperty.Create("ItemTemplate", typeof(DataTemplate), typeof(AppListView), default(DataTemplate)); + + /// + /// Gets or sets template of list items + /// public DataTemplate ItemTemplate { get { return (DataTemplate)GetValue(ItemTemplateProperty); } @@ -49,12 +58,12 @@ namespace TVApps.Controls } /// - /// The total count of items in list + /// A count of items in list /// private int AppCount; /// - /// Checks first item in list is focused + /// A flag indicates whether first item in list is focused or not /// public bool IsFirstItemFocused { @@ -70,21 +79,22 @@ namespace TVApps.Controls } /// - /// Constructor + /// A constructor + /// Adds PropertyChanged event handler /// public AppListView() { InitializeComponent(); AppCount = 0; - PropertyChanged += OnPropertyChanged; + PropertyChanged += AppListViewPropertyChanged; } /// - /// Handles AppListView Property Changed event + /// This method is called when the properties of AppListView is changed /// /// The source of the event - /// The event that is occured when property of AppListView is changed - void OnPropertyChanged(object sender, PropertyChangedEventArgs e) + /// The event that is occurred when property of AppListView is changed + void AppListViewPropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "ItemsSource" || e.PropertyName == "ItemTemplate") { @@ -93,7 +103,7 @@ namespace TVApps.Controls } /// - /// Creates and Adds AppItemCells binded with ItemsSource + /// A method creates and adds AppItemCells binded with ItemsSource /// void CreateAppItemCells() { @@ -142,9 +152,9 @@ namespace TVApps.Controls } /// - /// Scrolls the list with spacing + /// A method scrolls the list with spacing /// - /// The index of focused item cell + /// A index of focused item cell private async void ScrollToIndex(int index) { if (AppUpperList.Children.Count > index) @@ -178,8 +188,7 @@ namespace TVApps.Controls } /// - /// Focusing Initialize - /// Focus first item in apps list + /// A method moves focus to first item in list /// public void InitializeFocus() { diff --git a/TVApps/TVApps/Controls/CustomButton.xaml.cs b/TVApps/TVApps/Controls/CustomButton.xaml.cs index 5a77a79..19e76b5 100644 --- a/TVApps/TVApps/Controls/CustomButton.xaml.cs +++ b/TVApps/TVApps/Controls/CustomButton.xaml.cs @@ -21,22 +21,22 @@ using Xamarin.Forms; namespace TVApps.Controls { /// - /// Custom Button for TVButton to get pressed/release status + /// A custom control for TVButton to get pressed/release status /// public partial class CustomButton : Button { /// - /// The event handler for button released event + /// A event handler for button released event /// public EventHandler OnButtonUp; /// - /// The event handler for button pressed event + /// A event handler for button pressed event /// public EventHandler OnButtonDown; /// - /// Constructor + /// A constructor /// public CustomButton() { diff --git a/TVApps/TVApps/Controls/NinePatchImage.xaml.cs b/TVApps/TVApps/Controls/NinePatchImage.xaml.cs index e657f49..96cb0f4 100644 --- a/TVApps/TVApps/Controls/NinePatchImage.xaml.cs +++ b/TVApps/TVApps/Controls/NinePatchImage.xaml.cs @@ -21,15 +21,19 @@ namespace TVApps.Controls { /// - /// Custom Control for Nine Patch Image + /// A custom control for displaying nine patch image /// [XamlCompilation(XamlCompilationOptions.Compile)] public partial class NinePatchImage : Image { /// - /// The property for left border of image + /// Identifies the BorderLeft bindable property /// public static readonly BindableProperty BorderLeftProperty = BindableProperty.Create("BorderLeft", typeof(int), typeof(NinePatchImage), default(int)); + + /// + /// Gets or sets left border of NinePatchImage + /// public int BorderLeft { get { return (int)GetValue(BorderLeftProperty); } @@ -37,9 +41,13 @@ namespace TVApps.Controls } /// - /// The property for right border of image + /// Identifies the BorderRight bindable property /// public static readonly BindableProperty BorderRightProperty = BindableProperty.Create("BorderRight", typeof(int), typeof(NinePatchImage), default(int)); + + /// + /// Gets or sets right border of NinePatchImage + /// public int BorderRight { get { return (int)GetValue(BorderRightProperty); } @@ -47,9 +55,13 @@ namespace TVApps.Controls } /// - /// The property for top border of image + /// Identifies the BorderTop bindable property /// public static readonly BindableProperty BorderTopProperty = BindableProperty.Create("BorderTop", typeof(int), typeof(NinePatchImage), default(int)); + + /// + /// Gets or sets top border of NinePatchImage + /// public int BorderTop { get { return (int)GetValue(BorderTopProperty); } @@ -57,9 +69,13 @@ namespace TVApps.Controls } /// - /// The property for bottom border of image + /// Identifies the BorderBottom bindable property /// public static readonly BindableProperty BorderBottomProperty = BindableProperty.Create("BorderBottom", typeof(int), typeof(NinePatchImage), default(int)); + + /// + /// Gets or sets bottom border of NinePatchImage + /// public int BorderBottom { get { return (int)GetValue(BorderBottomProperty); } @@ -67,7 +83,7 @@ namespace TVApps.Controls } /// - /// Constructor + /// A constructor /// public NinePatchImage() { diff --git a/TVApps/TVApps/Controls/TVButton.xaml.cs b/TVApps/TVApps/Controls/TVButton.xaml.cs index 5289790..00f1a51 100644 --- a/TVApps/TVApps/Controls/TVButton.xaml.cs +++ b/TVApps/TVApps/Controls/TVButton.xaml.cs @@ -21,12 +21,12 @@ using Xamarin.Forms; namespace TVApps.Controls { /// - /// TV Button Control + /// A custom control for buttons in footer of TV Apps /// public partial class TVButton : StackLayout { /// - /// The title of TVButton + /// Gets or sets text of TVButton /// public string Text { @@ -35,14 +35,13 @@ namespace TVApps.Controls } /// - /// The bindable property for command + /// Identifies the Command bindable property /// - /// - public static readonly BindableProperty CommandProperty = - BindableProperty.Create(nameof(Command), typeof(ICommand), typeof(TVButton), null, BindingMode.TwoWay); + public static readonly BindableProperty CommandProperty = BindableProperty.Create(nameof(Command), typeof(ICommand), typeof(TVButton), null, BindingMode.TwoWay); /// - /// A command will be executed if the button is touched. + /// Gets or sets command of TV Button + /// The command will be executed if the button is touched /// public ICommand Command { @@ -51,7 +50,7 @@ namespace TVApps.Controls } /// - /// A command parameter will be passed when the Command is executed. + /// A command parameter will be passed when the Command is executed /// /// public string CommandParameter @@ -85,10 +84,10 @@ namespace TVApps.Controls } /// - /// Handles Button Clicked event + /// This method is called when the TVButton is clicked /// /// The source of the event - /// The event that is occured when button is clicked + /// The event that is occurred when button is clicked private void ButtonClickListener(object sender, EventArgs e) { // Stops playing animation @@ -123,10 +122,10 @@ namespace TVApps.Controls } /// - /// Handles Button Focused event + /// This method is called when the TVButton receives focus /// - /// The source of the event. - /// The event that is occured when button is focused + /// The source of the event + /// The event that is occurred when button is focused private void ButtonFocusedListener(object sender, FocusEventArgs e) { // Stops playing animation @@ -144,10 +143,10 @@ namespace TVApps.Controls } /// - /// Handles Button Unfocused event + /// This method is called when the TVButton loses focus /// /// The source of the event - /// The event that is occured when button is unfocused + /// The event that is occurred when button is unfocused private void ButtonUnfocusedListener(object sender, FocusEventArgs e) { // Stops playing animation @@ -165,10 +164,10 @@ namespace TVApps.Controls } /// - /// Handles Button Up event + /// This method is called when the TVButton is released /// /// The event sender - /// The event that is occured when button is released + /// The event that is occurred when button is released public void ButtonUpListener(object sender, EventArgs e) { BackgroundImage.Source = ButtonImageReleased; @@ -176,17 +175,17 @@ namespace TVApps.Controls } /// - /// Handles Button Down event + /// This method is called when the TVButton is pressed /// /// The source of the event - /// The event that is occured when button is pressed + /// The event that is occurred when button is pressed public void ButtonDownListener(object sender, EventArgs e) { BackgroundImage.Source = ButtonImagePressed; } /// - /// Positions and Sizes the children + /// A method positions and sizes the children /// /// The x position for the children /// The y position for the children -- 2.34.1