Changed to disable option button if there are no installed applications 76/152776/1
authorJH Choi <jjie.choi@samsung.com>
Wed, 27 Sep 2017 05:10:25 +0000 (14:10 +0900)
committerJH Choi <jjie.choi@samsung.com>
Wed, 27 Sep 2017 05:10:25 +0000 (14:10 +0900)
Signed-off-by: JH Choi <jjie.choi@samsung.com>
i

Change-Id: Ia9480f341253cd54094790a0a146d3464a25a376

TVApps/TVApps/Controls/EnableStateConverter.cs [new file with mode: 0644]
TVApps/TVApps/Views/FooterNormalStatus.xaml.cs

diff --git a/TVApps/TVApps/Controls/EnableStateConverter.cs b/TVApps/TVApps/Controls/EnableStateConverter.cs
new file mode 100644 (file)
index 0000000..2908c48
--- /dev/null
@@ -0,0 +1,22 @@
+using LibTVRefCommonPortable.DataModels;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using Xamarin.Forms;
+
+namespace TVApps.Controls
+{
+    class EnableStateConverter : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            return ((List<AppShortcutInfo>)value).Count > 0;
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}
index 07bc4fd..bc133d1 100755 (executable)
@@ -20,6 +20,7 @@ using LibTVRefCommonPortable.Utils;
 using System.Windows.Input;
 using System;
 using System.Collections.Generic;
+using TVApps.Controls;
 
 namespace TVApps.Views
 {
@@ -124,6 +125,9 @@ namespace TVApps.Views
                 FontSize = SizeUtils.GetFontSize(28),
             };
             OptionButton.Clicked += OnOptionsClicked;
+            Binding binding = new Binding("InstalledAppList");
+            binding.Converter = new EnableStateConverter();
+            OptionButton.SetBinding(Button.IsEnabledProperty, binding);
 
             this.Children.Add(OptionButton,
                 heightConstraint: Constraint.Constant(SizeUtils.GetHeightSize(80)),