Implement footer additional text(pinned apps)
authorGeunsun, Lee <gs86.lee@samsung.com>
Fri, 24 Mar 2017 02:59:34 +0000 (11:59 +0900)
committerChulSeung Kim <charles0.kim@samsung.com>
Thu, 8 Jun 2017 09:34:50 +0000 (18:34 +0900)
Change-Id: I4d5c955703e0f1fc62328459c563e26e396eff11

TVApps/TVApps/ViewModels/AppsHolder.cs
TVApps/TVApps/ViewModels/MainPageViewModel.cs
TVApps/TVApps/Views/FooterPinStatus.xaml
TVApps/TVApps/Views/FooterPinStatus.xaml.cs

index 65c99d5..a8be7c1 100644 (file)
@@ -33,7 +33,6 @@ namespace TVApps.ViewModels
 
         public Dictionary<string, string> PinnedApps;
 
-
         public AppsHolder(IAppsViewModel ViewModel)
         {
             this.ViewModel = ViewModel;
@@ -65,6 +64,8 @@ namespace TVApps.ViewModels
             await Task.WhenAll(pinnedAppsGettingTask, installedAppsGettingTask);
 
             PinnedApps = pinnedAppsGettingTask.Result;
+            ViewModel.OnPropertyChanged("SumOfCheckedApp");
+
             var installedApps = installedAppsGettingTask.Result;
 
             foreach (AppShortcutInfo item in installedApps)
@@ -156,6 +157,8 @@ namespace TVApps.ViewModels
                 selectedApp.IsPinned = true;
                 PinnedApps.Add(key, key);
             }
+
+            ViewModel.OnPropertyChanged("SumOfCheckedApp");
         }
 
         public void OptionMenuPinToggle(string key)
@@ -180,6 +183,8 @@ namespace TVApps.ViewModels
                 PinnedApps.Add(key, key);
             }
 
+            ViewModel.OnPropertyChanged("SumOfCheckedApp");
+
             this.UpdatePinnedApps();
             ViewModel.ChangeCurrentStatus(AppsStatus.Default);
         }
index 4757ac0..7daa9df 100644 (file)
@@ -52,6 +52,14 @@ namespace TVApps.ViewModels
             }
         }
 
+        public int SumOfCheckedApp
+        {
+            get
+            {
+                return appsHolder.PinnedApps.Count;
+            }
+        }
+
         public Command ButtonDeleteCancelCommand { get; set; }
         public Command ButtonPinAppCommand { get; set; }
         public Command ButtonDeleteAppCommand { get; set; }
@@ -139,6 +147,8 @@ namespace TVApps.ViewModels
                 appsHolder.ResetPinnedApps();
                 ChangeCurrentStatus(AppsStatus.Default);
 
+                OnPropertyChanged("SumOfCheckedApp");
+
                 if (IsPinAppRequested)
                 {
                     AppControlUtils.SelfTerminate();
index 4d68831..05c7696 100644 (file)
     <ColumnDefinition Width="500*" />
   </Grid.ColumnDefinitions>
 
-  <Label x:Name="FooterAdditionalText"
-         Grid.Row="0"
-         Grid.Column="1"
-         FontSize="56"
-         TextColor="White"
-         HorizontalTextAlignment="Start"
-         VerticalTextAlignment="Center"
-         Text="3 Pinned" />
+  <StackLayout Grid.Row="0" Grid.Column="1"
+               Orientation="Horizontal">
+    <Label x:Name="FooterAdditionalText"
+           FontSize="56"
+           TextColor="White"
+           HorizontalTextAlignment="Start"
+           VerticalTextAlignment="Center"
+           Text="{Binding SumOfCheckedApp}" />
+    <Label FontSize="56"
+           TextColor="White"
+           HorizontalTextAlignment="Start"
+           VerticalTextAlignment="Center"
+           Text=" Pinned" />
+  </StackLayout>
 
   <StackLayout Grid.Row="0" Grid.Column="2"
                Orientation="Horizontal">
index 87d5c5a..d535e4a 100644 (file)
@@ -23,6 +23,13 @@ namespace TVApps.Views
     /// </summary>
     public partial class FooterPinStatus : Grid
     {
+        public static readonly BindableProperty SumOfCheckedAppProperty = BindableProperty.Create("SumOfCheckedApp", typeof(int), typeof(FooterPinStatus), default(int));
+        public int SumOfCheckedApp
+        {
+            get { return (int)GetValue(SumOfCheckedAppProperty); }
+            set { SetValue(SumOfCheckedAppProperty, value); }
+        }
+
         public FooterPinStatus()
         {
             InitializeComponent();