Show toast when the number of selected apps exceeds 10
authorjjie.choi <jjie.choi@samsung.com>
Mon, 22 May 2017 08:37:52 +0000 (17:37 +0900)
committerChulSeung Kim <charles0.kim@samsung.com>
Thu, 8 Jun 2017 09:34:56 +0000 (18:34 +0900)
Change-Id: I22a9b891d4a0a128b179808e91a9a7e3fd0b9e8b
Signed-off-by: jjie.choi <jjie.choi@samsung.com>
TVApps/TVApps/ViewModels/AppsHolder.cs
TVApps/TVApps/ViewModels/MainPageViewModel.cs
TVApps/TVApps/Views/MainPage.xaml
TVApps/TVApps/Views/MainPage.xaml.cs

index 7461a4c..0117ca9 100755 (executable)
@@ -62,6 +62,8 @@ namespace TVApps.ViewModels
         /// </summary>
         public string UnpinnedAppName;
 
+        public bool IsSelectedExceeds;
+
         /// <summary>
         /// A constructor
         /// Initializes installed and pinned app list
@@ -197,6 +199,12 @@ namespace TVApps.ViewModels
             }
             else
             {
+                if(PinnedApps.Count >= 10)
+                {
+                    IsSelectedExceeds = true;
+                    ViewModel.OnPropertyChanged("IsSelectedExceeds");
+                    return;
+                }
                 DebuggingUtils.Dbg("Pin! : " + selectedApp);
                 selectedApp.IsChecked = true;
                 selectedApp.IsPinned = true;
index 84c3ea2..5c77900 100755 (executable)
@@ -118,6 +118,14 @@ namespace TVApps.ViewModels
             }
         }
 
+        public bool IsSelectedExceeds
+        {
+            get
+            {
+                return appsHolder.IsSelectedExceeds;
+            }
+        }
+
         /// <summary>
         /// A command will be executed if the cancel button in FooterDeleteStatus is clicked
         /// </summary>
@@ -439,5 +447,6 @@ namespace TVApps.ViewModels
                 handler(this, new PropertyChangedEventArgs(propertyName));
             }
         }
+
     }
 }
index 62a9fcf..1d3823a 100755 (executable)
@@ -10,7 +10,8 @@
              IsEnabledDeletePopup="{Binding IsEnabledDeletePopup}"
              IsPinAppRequested="{Binding IsPinAppRequested}"
              DeletePopupAppLabel="{Binding DeletePopupAppLabel}"
-             DeletePopupCommand="{Binding DeletePopupCommand}">
+             DeletePopupCommand="{Binding DeletePopupCommand}"
+             IsSelectedExceeds="{Binding IsSelectedExceeds}">
   <ContentPage.BindingContext>
     <ViewModels:MainPageViewModel />
   </ContentPage.BindingContext>
index 9764e59..f3abab6 100755 (executable)
@@ -111,6 +111,14 @@ namespace TVApps.Views
             set { SetValue(DeletePopupCommandProperty, value); }
         }
 
+        public static readonly BindableProperty IsSelectedExceedsProperty = BindableProperty.Create("IsSelectedExceeds", typeof(bool), typeof(FooterPinStatus), false, BindingMode.TwoWay);
+
+        public bool IsSelectedExceeds
+        {
+            get { return (bool)GetValue(IsSelectedExceedsProperty); }
+            set { SetValue(IsSelectedExceedsProperty, value); }
+        }
+
         /// <summary>
         /// A method for animation when application is terminated
         /// </summary>
@@ -437,6 +445,14 @@ namespace TVApps.Views
                     AppList.InitializeFocus();
                 }
             }
+            else if (e.PropertyName.Equals("IsSelectedExceeds"))
+            {
+                if (IsSelectedExceeds)
+                {
+                    Toast.DisplayText("Number of selected apps exceeds 10.");
+                    IsSelectedExceeds = false;
+                }
+            }
         }
 
         /// <summary>