TVHome - Apps Move
authorHyerim Kim <rimi.kim@samsung.com>
Thu, 30 Mar 2017 04:57:17 +0000 (13:57 +0900)
committerChulSeung Kim <charles0.kim@samsung.com>
Thu, 8 Jun 2017 09:34:52 +0000 (18:34 +0900)
Change-Id: I639c69dedd626c348ad7c00af031dac314a61d24
Signed-off-by: Hyerim Kim <rimi.kim@samsung.com>
(cherry picked from commit 97d0a1943a3873935b3646dbaea65eb4ee7d4348)

16 files changed:
TVHome/TVHome/Controls/MainPanelButton.xaml.cs
TVHome/TVHome/Controls/PanelButton.cs
TVHome/TVHome/Controls/SubPanelAllAppsButton.xaml.cs
TVHome/TVHome/Controls/SubPanelButton.xaml
TVHome/TVHome/Controls/SubPanelButton.xaml.cs
TVHome/TVHome/Controls/SubPanelReservedButton.xaml.cs
TVHome/TVHome/Controls/SubPanelSettingButton.xaml [new file with mode: 0755]
TVHome/TVHome/Controls/SubPanelSettingButton.xaml.cs [new file with mode: 0755]
TVHome/TVHome/Controls/SubPanelThumbnailButton.xaml.cs
TVHome/TVHome/TVHome.csproj
TVHome/TVHome/ViewModels/MainPageViewModel.cs
TVHome/TVHome/Views/MainPage.xaml
TVHome/TVHome/Views/MainPage.xaml.cs
TVHome/TVHome/Views/Panel.cs
TVHome/TVHome/Views/SubPanel.xaml.cs
TVHome/TVHome/Views/SubThumbnailPanel.xaml.cs

index 1942141cd00aa74dbfd9f5345ff64f93e3c61592..32e899f9fab90a6cf00b17a8a3f1d028e330b6bb 100755 (executable)
@@ -29,6 +29,9 @@ namespace TVHome.Controls
         /// </summary>
         public static readonly BindableProperty StatusProperty = BindableProperty.Create("Status", typeof(string), typeof(PanelButton), default(string));
 
+        /// <summary>
+        /// Gets or sets status of Main Panel
+        /// </summary>
         public string Status
         {
             get { return (string)GetValue(StatusProperty); }
@@ -125,5 +128,22 @@ namespace TVHome.Controls
                 OnClickedCommand.Execute("");
             }
         }
+
+        /// <summary>
+        /// A method for handling the button when button is changed to move mode
+        /// </summary>
+        /// <param name="isMoveMode">A flag indicates whether the button is move mode or not</param>
+        public override void ChangeMoveMode(bool isMoveMode)
+        {
+
+        }
+
+        /// <summary>
+        /// A method for changing the button's LayoutOptions according to parameter
+        /// </summary>
+        /// <param name="isMoveMode">A flag indicates whether the SubPanel is MoveMode or not</param>
+        public override void ChangeLayoutOptions(bool isMoveMode)
+        {
+        }
     }
 }
index 4f1b236b04a5ce05d25ca80ac7924fff3bac409b..56eaa9a7552e7c7ae0c6e6b822b2e96f785724f3 100755 (executable)
@@ -26,6 +26,7 @@ namespace TVHome.Controls
     /// </summary>
     public abstract class PanelButton : ViewCell
     {
+        public bool isMoveMode;
         /// <summary>
         /// A Command will be executed the button is focused.
         /// </summary>
@@ -36,6 +37,16 @@ namespace TVHome.Controls
         /// </summary>
         public ICommand OnClickedCommand { get; set; }
 
+        /// <summary>
+        /// A Command will be executed the button is moved.
+        /// </summary>
+        public ICommand OnMoveCommand { get; set; }
+
+        /// <summary>
+        /// A Command will be executed the button is unpinned.
+        /// </summary>
+        public ICommand OnUnpinCommand { get; set; }
+
         /// <summary>
         /// Handles Button Focused event
         /// </summary>
@@ -56,5 +67,17 @@ namespace TVHome.Controls
         /// <param name="sender">The source of the event</param>
         /// <param name="e">The event that is occurred when button is clicked</param>
         public abstract void OnClicked(object sender, EventArgs e);
+
+        /// <summary>
+        /// A method for handling the button when button is changed to move mode
+        /// </summary>
+        /// <param name="isMoveMode">A flag indicates whether the button is move mode or not</param>
+        public abstract void ChangeMoveMode(bool isMoveMode);
+
+        /// <summary>
+        /// A method for changing the button's LayoutOptions according to parameter
+        /// </summary>
+        /// <param name="isMoveMode">A flag indicates whether the SubPanel is MoveMode or not</param>
+        public abstract void ChangeLayoutOptions(bool isMoveMode);
     }
 }
index 0abfe3125475a41c600d3e3e3b725ac13c0e41a1..22575b64db60c6627065abcdd53337210a14e601 100755 (executable)
@@ -68,6 +68,11 @@ namespace TVHome.Controls
             await ButtonBgImage.ScaleTo(1.3, 300);
         }
 
+        /// <summary>
+        /// Handles Button Unfocused event
+        /// </summary>
+        /// <param name="sender">The source of the event</param>
+        /// <param name="e">The event that is occurred when button is unfocused</param>
         public override async void OnUnfocused(object sender, FocusEventArgs e)
         {
 #pragma warning disable CS4014
@@ -77,5 +82,32 @@ namespace TVHome.Controls
 #pragma warning restore CS4014
             await ButtonBgImage.ScaleTo(1, 300);
         }
+
+        /// <summary>
+        /// A method for handling the button when button is changed to move mode
+        /// </summary>
+        /// <param name="isMoveMode">A flag indicates whether the button is move mode or not</param>
+        public override void ChangeMoveMode(bool isMoveMode)
+        {
+
+        }
+
+        /// <summary>
+        /// A method for changing the button's LayoutOptions according to parameter
+        /// </summary>
+        /// <param name="isMoveMode">A flag indicates whether the SubPanel is MoveMode or not</param>
+        public override void ChangeLayoutOptions(bool isMoveMode)
+        {
+            if (isMoveMode)
+            {
+                View.VerticalOptions = LayoutOptions.End;
+            }
+            else
+            {
+                View.VerticalOptions = LayoutOptions.Start;
+            }
+
+            View.TranslateTo(0, 0, 0);
+        }
     }
 }
index 2ca9626e419ab9b4520f265ce8676337de377541..b41d065867ec69c3f5bee3b5f891cdda8de145f2 100755 (executable)
            Unfocused="OnUnfocused"
            Clicked="OnClicked"
            Opacity="0" />
+    <Image x:Name="LeftBtnImg"
+           RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0}"
+           RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.369565}"
+           RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.156521}"
+           RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.06044}"
+           Source="btn_tizen_home_list_move_left_focused.png"
+           Opacity="0"/>
+    <Image x:Name="RightBtnImg"
+           RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.93956}"
+           RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.369565}"
+           RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.156521}"
+           RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.06044}"
+            Source="btn_tizen_home_list_move_right_focused.png"
+           Opacity="0"/>
+    <Button x:Name="LeftBtn"
+           RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0}"
+           RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.369565}"
+           RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.156521}"
+           RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.06044}"
+            Clicked="OnMoveToLeftClicked"
+            Opacity="0"/>
+    <Button x:Name="RightBtn"
+           RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.93956}"
+           RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.369565}"
+           RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.156521}"
+           RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.06044}"
+            Clicked="OnMoveToRightClicked"
+            Opacity="0"/>
   </RelativeLayout>
 </Controls:PanelButton>
\ No newline at end of file
index b12b4db456b365280c5a12cd74833b62597b207d..dc5ace21d7b4c1926ba54ac02e3cc8152e15ca98 100755 (executable)
@@ -49,6 +49,58 @@ namespace TVHome.Controls
             await View.FadeTo(0.99, 300);
         }
 
+        /// <summary>
+        /// A method for handling the button when button is changed to move mode
+        /// </summary>
+        /// <param name="moveMode">A flag indicates whether the button is move mode or not</param>
+        public override async void ChangeMoveMode(bool moveMode)
+        {
+#pragma warning disable CS4014
+            if (moveMode)
+            {
+                ButtonTitle.FadeTo(0, 300);
+                View.TranslateTo(0, -130, 300);
+                ButtonImage.ScaleTo(1, 300);
+                isMoveMode = true;
+
+                for (int i = 0; i < 2; i++)
+                {
+                    LeftBtnImg.FadeTo(1, 300);
+                    await RightBtnImg.FadeTo(1, 300);
+                    LeftBtnImg.FadeTo(0, 300);
+                    await RightBtnImg.FadeTo(0, 300);
+                }
+                LeftBtnImg.FadeTo(1, 300);
+                await RightBtnImg.FadeTo(1, 300);
+            }
+            else
+            {
+                isMoveMode = false;
+
+                LeftBtnImg.FadeTo(0, 300);
+                RightBtnImg.FadeTo(0, 300);
+            }
+#pragma warning restore CS4014
+        }
+
+        /// <summary>
+        /// A method for changing the button's LayoutOptions according to parameter
+        /// </summary>
+        /// <param name="isMoveMode">A flag indicates whether the SubPanel is MoveMode or not</param>
+        public override void ChangeLayoutOptions(bool isMoveMode)
+        {
+            if (isMoveMode)
+            {
+                View.VerticalOptions = LayoutOptions.End;
+            }
+            else
+            {
+                View.VerticalOptions = LayoutOptions.Start;
+            }
+
+            View.TranslateTo(0, 0, 0);
+        }
+
         /// <summary>
         /// Handles Button Focused event
         /// </summary>
@@ -75,11 +127,34 @@ namespace TVHome.Controls
         /// <param name="e">The event that is occurred when button is unfocused</param>
         public override async void OnUnfocused(object sender, FocusEventArgs e)
         {
+            if (!isMoveMode)
+            {
 #pragma warning disable CS4014
-            ButtonTitle.FadeTo(0.5, 300);
-            ButtonTitle.TranslateTo(0, 0, 300);
+                ButtonTitle.FadeTo(0.5, 300);
+                ButtonTitle.TranslateTo(0, 0, 300);
 #pragma warning restore CS4014
-            await ButtonImage.ScaleTo(1, 300);
+                await ButtonImage.ScaleTo(1, 300);
+            }
+        }
+
+        /// <summary>
+        /// A method is called when right navigation button is clicked
+        /// </summary>
+        /// <param name="sender">The source of the event</param>
+        /// <param name="e">The event that is occurred when right navigation button is clicked</param>
+        private void OnMoveToRightClicked(object sender, EventArgs e)
+        {
+            OnMoveCommand.Execute("right");
+        }
+
+        /// <summary>
+        /// A method is called when left navigation button is clicked
+        /// </summary>
+        /// <param name="sender">The source of the event</param>
+        /// <param name="e">The event that is occurred when left navigation button is clicked</param>
+        private void OnMoveToLeftClicked(object sender, EventArgs e)
+        {
+            OnMoveCommand.Execute("left");
         }
     }
 }
\ No newline at end of file
index f25796347b3c22d593ce760b6afe1e290bfd2cb5..f29ed59306d6dcd6421a013999f30688b2370a14 100755 (executable)
@@ -83,5 +83,32 @@ namespace TVHome.Controls
 #pragma warning restore CS4014
             await ButtonBgImage.ScaleTo(1, 300);
         }
+
+        /// <summary>
+        /// A method for handling the button when button is changed to move mode
+        /// </summary>
+        /// <param name="isMoveMode">A flag indicates whether the button is move mode or not</param>
+        public override void ChangeMoveMode(bool isMoveMode)
+        {
+
+        }
+
+        /// <summary>
+        /// A method for changing the button's LayoutOptions according to parameter
+        /// </summary>
+        /// <param name="isMoveMode">A flag indicates whether the SubPanel is MoveMode or not</param>
+        public override void ChangeLayoutOptions(bool isMoveMode)
+        {
+            if (isMoveMode)
+            {
+                View.VerticalOptions = LayoutOptions.End;
+            }
+            else
+            {
+                View.VerticalOptions = LayoutOptions.Start;
+            }
+
+            View.TranslateTo(0, 0, 0);
+        }
     }
 }
\ No newline at end of file
diff --git a/TVHome/TVHome/Controls/SubPanelSettingButton.xaml b/TVHome/TVHome/Controls/SubPanelSettingButton.xaml
new file mode 100755 (executable)
index 0000000..0427bdb
--- /dev/null
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Controls:PanelButton xmlns="http://xamarin.com/schemas/2014/forms"
+                      xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+                      xmlns:Controls="clr-namespace:TVHome.Controls"
+                      x:Class="TVHome.Controls.SubPanelSettingButton">
+  <RelativeLayout x:Name="ButtonBox"
+               WidthRequest="182"
+               HeightRequest="230"
+               HorizontalOptions="Center" >
+    <Image x:Name="ButtonImage"
+           RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.120879}"
+           RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.095652}"
+           RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.6}"
+           RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.75824}"
+           Source="{Binding CurrentStateDescription.IconPath}" />
+    <Image x:Name="ButtonDimmedImage"
+           RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.120879}"
+           RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.095652}"
+           RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.6}"
+           RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.75824}"
+           Source="img_tizen_home_list_dim_apps.png" />
+    <Label x:Name="ButtonTitle"
+           RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.120879}"
+           RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.77391}"
+           RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.1303478}"
+           RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.758241}"
+           Opacity="0.6"
+           TextColor="White"
+           FontSize="38"
+           LineBreakMode="TailTruncation"
+           HorizontalTextAlignment="Center"
+           Text="{Binding CurrentStateDescription.Label}"/>
+    <Button x:Name = "ButtonFocusArea"
+           RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0}"
+           RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0}"
+           RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=1}"
+           RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
+           Focused="OnFocused"
+           Unfocused="OnUnfocused"
+           Clicked="OnClicked"
+           Opacity="0" />
+  </RelativeLayout>
+</Controls:PanelButton>
\ No newline at end of file
diff --git a/TVHome/TVHome/Controls/SubPanelSettingButton.xaml.cs b/TVHome/TVHome/Controls/SubPanelSettingButton.xaml.cs
new file mode 100755 (executable)
index 0000000..b9e737a
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using Xamarin.Forms;
+
+namespace TVHome.Controls
+{
+    /// <summary>
+    /// Custom Control for Button in Settings SubPanel
+    /// </summary>
+    public partial class SubPanelSettingButton : PanelButton
+    {
+        /// <summary>
+        /// A Constructor
+        /// </summary>
+        public SubPanelSettingButton()
+        {
+            InitializeComponent();
+        }
+
+        /// <summary>
+        /// Handles Button Clicked event
+        /// </summary>
+        /// <param name="sender">The source of the event</param>
+        /// <param name="e">The event that is occurred when button is clicked</param>
+        public override async void OnClicked(object sender, EventArgs e)
+        {
+            if (OnClickedCommand != null)
+            {
+                OnClickedCommand.Execute("");
+            }
+
+            await View.FadeTo(0.99, 300);
+        }
+
+        /// <summary>
+        /// Handles Button Focused event
+        /// </summary>
+        /// <param name="sender">The source of the event</param>
+        /// <param name="e">The event that is occurred when button is focused</param>
+        public override async void OnFocused(object sender, FocusEventArgs e)
+        {
+            if (OnFocusedCommand != null)
+            {
+                OnFocusedCommand.Execute("");
+            }
+
+#pragma warning disable CS4014
+            ButtonTitle.FadeTo(0.99, 300);
+            ButtonTitle.TranslateTo(0, 22, 300);
+#pragma warning restore CS4014
+            await ButtonImage.ScaleTo(1.3, 300);
+        }
+
+        /// <summary>
+        /// Handles Button Unfocused event
+        /// </summary>
+        /// <param name="sender">The source of the event</param>
+        /// <param name="e">The event that is occurred when button is unfocused</param>
+        public override async void OnUnfocused(object sender, FocusEventArgs e)
+        {
+#pragma warning disable CS4014
+            ButtonTitle.FadeTo(0.5, 300);
+            ButtonTitle.TranslateTo(0, 0, 300);
+#pragma warning restore CS4014
+            await ButtonImage.ScaleTo(1, 300);
+        }
+
+        /// <summary>
+        /// A method for handling the button when button is changed to move mode
+        /// </summary>
+        /// <param name="isMoveMode">A flag indicates whether the button is move mode or not</param>
+        public override void ChangeMoveMode(bool isMoveMode)
+        {
+
+        }
+
+        /// <summary>
+        /// A method for changing the button's LayoutOptions according to parameter
+        /// </summary>
+        /// <param name="isMoveMode">A flag indicates whether the SubPanel is MoveMode or not</param>
+        public override void ChangeLayoutOptions(bool isMoveMode)
+        {
+        }
+    }
+}
index 68bf0cda56bd1b1a39f3b77a573c2d513073df3c..aa4444a2318b148b5fbed62206279e2835693b79 100755 (executable)
@@ -109,5 +109,22 @@ namespace TVHome.Controls
 #pragma warning restore CS4014
             await View.ScaleTo(1.0, 300);
         }
+
+        /// <summary>
+        /// A method for handling the button when button is changed to move mode
+        /// </summary>
+        /// <param name="isMoveMode">A flag indicates whether the button is move mode or not</param>
+        public override void ChangeMoveMode(bool isMoveMode)
+        {
+
+        }
+
+        /// <summary>
+        /// A method for changing the button's LayoutOptions according to parameter
+        /// </summary>
+        /// <param name="isMoveMode">A flag indicates whether the SubPanel is MoveMode or not</param>
+        public override void ChangeLayoutOptions(bool isMoveMode)
+        {
+        }
     }
 }
\ No newline at end of file
index f53ff2a13c7ef77961fa20db2ddaeb6d1a8ab096..3667365bf6b725fe5027e93dae4bd565b9c49dd5 100755 (executable)
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
-  <PropertyGroup>\r
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>\r
-    <ProjectGuid>{54DD6673-7E64-48E6-A008-4D455E19E017}</ProjectGuid>\r
-    <OutputType>Library</OutputType>\r
-    <RootNamespace>TVHome</RootNamespace>\r
-    <AssemblyName>TVHome</AssemblyName>\r
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
-    <TargetFrameworkProfile>Profile259</TargetFrameworkProfile>\r
-    <MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>\r
-    <NuGetPackageImportStamp>\r
-    </NuGetPackageImportStamp>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
-    <DebugSymbols>true</DebugSymbols>\r
-    <DebugType>portable</DebugType>\r
-    <Optimize>false</Optimize>\r
-    <OutputPath>bin\Debug\</OutputPath>\r
-    <DefineConstants>DEBUG;TRACE</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-    <ConsolePause>false</ConsolePause>\r
-  </PropertyGroup>\r
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
-    <DebugType>portable</DebugType>\r
-    <Optimize>true</Optimize>\r
-    <OutputPath>bin\Release\</OutputPath>\r
-    <DefineConstants>TRACE</DefineConstants>\r
-    <ErrorReport>prompt</ErrorReport>\r
-    <WarningLevel>4</WarningLevel>\r
-    <ConsolePause>false</ConsolePause>\r
-  </PropertyGroup>\r
-  <ItemGroup>\r
-    <Compile Include="Controls\MainPanelButton.xaml.cs">\r
-      <DependentUpon>MainPanelButton.xaml</DependentUpon>\r
-    </Compile>\r
-    <Compile Include="Controls\PanelButton.cs" />\r
-    <Compile Include="Controls\SubPanelAllAppsButton.xaml.cs">\r
-      <DependentUpon>SubPanelAllAppsButton.xaml</DependentUpon>\r
-    </Compile>\r
-    <Compile Include="Controls\SubPanelReservedButton.xaml.cs">\r
-      <DependentUpon>SubPanelReservedButton.xaml</DependentUpon>\r
-    </Compile>\r
-    <Compile Include="Controls\SubPanelButton.xaml.cs">\r
-      <DependentUpon>SubPanelButton.xaml</DependentUpon>\r
-    </Compile>\r
-    <Compile Include="Controls\SubPanelThumbnailButton.xaml.cs">\r
-      <DependentUpon>SubPanelThumbnailButton.xaml</DependentUpon>\r
-    </Compile>\r
-    <Compile Include="TVHome.cs" />\r
-    <Compile Include="Properties\AssemblyInfo.cs" />\r
-    <Compile Include="ViewModels\IHomeViewModel.cs" />\r
-    <Compile Include="ViewModels\MainPageViewModel.cs" />\r
-    <Compile Include="Views\MainPage.xaml.cs">\r
-      <DependentUpon>MainPage.xaml</DependentUpon>\r
-    </Compile>\r
-    <Compile Include="Views\MainPanel.xaml.cs">\r
-      <DependentUpon>MainPanel.xaml</DependentUpon>\r
-    </Compile>\r
-    <Compile Include="Views\Panel.cs" />\r
-    <Compile Include="Views\SubPanel.xaml.cs">\r
-      <DependentUpon>SubPanel.xaml</DependentUpon>\r
-    </Compile>\r
-    <Compile Include="Views\SubThumbnailPanel.xaml.cs">\r
-      <DependentUpon>SubThumbnailPanel.xaml</DependentUpon>\r
-    </Compile>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <EmbeddedResource Include="Views\MainPanel.xaml">\r
-      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>\r
-      <SubType>Designer</SubType>\r
-    </EmbeddedResource>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <EmbeddedResource Include="Controls\MainPanelButton.xaml">\r
-      <SubType>Designer</SubType>\r
-      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>\r
-    </EmbeddedResource>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <EmbeddedResource Include="Controls\SubPanelButton.xaml">\r
-      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>\r
-      <SubType>Designer</SubType>\r
-    </EmbeddedResource>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <EmbeddedResource Include="Controls\SubPanelThumbnailButton.xaml">\r
-      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>\r
-      <SubType>Designer</SubType>\r
-    </EmbeddedResource>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <EmbeddedResource Include="Views\MainPage.xaml">\r
-      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>\r
-      <SubType>Designer</SubType>\r
-    </EmbeddedResource>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <EmbeddedResource Include="Views\SubPanel.xaml">\r
-      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>\r
-      <SubType>Designer</SubType>\r
-    </EmbeddedResource>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">\r
-      <HintPath>..\..\packages\Xamarin.Forms.2.3.3.193\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Core.dll</HintPath>\r
-      <Private>True</Private>\r
-    </Reference>\r
-    <Reference Include="Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">\r
-      <HintPath>..\..\packages\Xamarin.Forms.2.3.3.193\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Platform.dll</HintPath>\r
-      <Private>True</Private>\r
-    </Reference>\r
-    <Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">\r
-      <HintPath>..\..\packages\Xamarin.Forms.2.3.3.193\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Xaml.dll</HintPath>\r
-      <Private>True</Private>\r
-    </Reference>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <None Include="packages.config">\r
-      <SubType>Designer</SubType>\r
-    </None>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <EmbeddedResource Include="Views\SubThumbnailPanel.xaml">\r
-      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>\r
-      <SubType>Designer</SubType>\r
-    </EmbeddedResource>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <EmbeddedResource Include="Controls\SubPanelReservedButton.xaml">\r
-      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>\r
-      <SubType>Designer</SubType>\r
-    </EmbeddedResource>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <EmbeddedResource Include="Controls\SubPanelAllAppsButton.xaml">\r
-      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>\r
-      <SubType>Designer</SubType>\r
-    </EmbeddedResource>\r
-  </ItemGroup>\r
-  <ItemGroup>\r
-    <ProjectReference Include="..\..\LibTVRefCommonPortable\LibTVRefCommonPortable.csproj">\r
-      <Project>{67f9d3a8-f71e-4428-913f-c37ae82cdb24}</Project>\r
-      <Name>LibTVRefCommonPortable</Name>\r
-    </ProjectReference>\r
-  </ItemGroup>\r
-  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />\r
-  <Import Project="..\..\packages\Xamarin.Forms.2.3.3.193\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.3.3.193\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" />\r
-  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">\r
-    <PropertyGroup>\r
-      <ErrorText>이 프로젝트는 이 컴퓨터에 없는 NuGet 패키지를 참조합니다. 해당 패키지를 다운로드하려면 NuGet 패키지 복원을 사용하십시오. 자세한 내용은 http://go.microsoft.com/fwlink/?LinkID=322105를 참조하십시오. 누락된 파일은 {0}입니다.</ErrorText>\r
-    </PropertyGroup>\r
-    <Error Condition="!Exists('..\..\packages\Xamarin.Forms.2.3.3.193\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.2.3.3.193\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets'))" />\r
-  </Target>\r
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.\r
-               Other similar extension points exist, see Microsoft.Common.targets.\r
-       <Target Name="BeforeBuild">\r
-       </Target>\r
-       <Target Name="AfterBuild">\r
-       </Target>\r
-       -->\r
-</Project>
\ No newline at end of file
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <ProjectGuid>{54DD6673-7E64-48E6-A008-4D455E19E017}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <RootNamespace>TVHome</RootNamespace>
+    <AssemblyName>TVHome</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
+    <MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>portable</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ConsolePause>false</ConsolePause>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>portable</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <ConsolePause>false</ConsolePause>
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Include="Controls\MainPanelButton.xaml.cs">
+      <DependentUpon>MainPanelButton.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Controls\PanelButton.cs" />
+    <Compile Include="Controls\SubPanelAllAppsButton.xaml.cs">
+      <DependentUpon>SubPanelAllAppsButton.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Controls\SubPanelReservedButton.xaml.cs">
+      <DependentUpon>SubPanelReservedButton.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Controls\SubPanelButton.xaml.cs">
+      <DependentUpon>SubPanelButton.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Controls\SubPanelSettingButton.xaml.cs">
+      <DependentUpon>SubPanelSettingButton.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Controls\SubPanelThumbnailButton.xaml.cs">
+      <DependentUpon>SubPanelThumbnailButton.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="TVHome.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="ViewModels\IHomeViewModel.cs" />
+    <Compile Include="ViewModels\MainPageViewModel.cs" />
+    <Compile Include="Views\MainPage.xaml.cs">
+      <DependentUpon>MainPage.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\MainPanel.xaml.cs">
+      <DependentUpon>MainPanel.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\Panel.cs" />
+    <Compile Include="Views\SubPanel.xaml.cs">
+      <DependentUpon>SubPanel.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Views\SubThumbnailPanel.xaml.cs">
+      <DependentUpon>SubThumbnailPanel.xaml</DependentUpon>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Views\MainPanel.xaml">
+      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Controls\MainPanelButton.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+    </EmbeddedResource>
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Controls\SubPanelButton.xaml">
+      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Controls\SubPanelThumbnailButton.xaml">
+      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Views\MainPage.xaml">
+      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Views\SubPanel.xaml">
+      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+  </ItemGroup>
+  <ItemGroup>
+    <Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Xamarin.Forms.2.3.3.193\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Core.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Xamarin.Forms.2.3.3.193\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Platform.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\..\packages\Xamarin.Forms.2.3.3.193\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Xaml.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config">
+      <SubType>Designer</SubType>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Views\SubThumbnailPanel.xaml">
+      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Controls\SubPanelReservedButton.xaml">
+      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Controls\SubPanelAllAppsButton.xaml">
+      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\LibTVRefCommonPortable\LibTVRefCommonPortable.csproj">
+      <Project>{67f9d3a8-f71e-4428-913f-c37ae82cdb24}</Project>
+      <Name>LibTVRefCommonPortable</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <EmbeddedResource Include="Controls\SubPanelSettingButton.xaml">
+      <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+  </ItemGroup>
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
+  <Import Project="..\..\packages\Xamarin.Forms.2.3.3.193\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.2.3.3.193\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>이 프로젝트는 이 컴퓨터에 없는 NuGet 패키지를 참조합니다. 해당 패키지를 다운로드하려면 NuGet 패키지 복원을 사용하십시오. 자세한 내용은 http://go.microsoft.com/fwlink/?LinkID=322105를 참조하십시오. 누락된 파일은 {0}입니다.</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\..\packages\Xamarin.Forms.2.3.3.193\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.2.3.3.193\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets'))" />
+  </Target>
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+               Other similar extension points exist, see Microsoft.Common.targets.
+       <Target Name="BeforeBuild">
+       </Target>
+       <Target Name="AfterBuild">
+       </Target>
+       -->
+</Project>
index 5ee9ec1a99e9eba5736c45f0f134e671ba71d2fd..44c64c47b0633a53a4bfe94542586a604b37e6ee 100755 (executable)
@@ -86,6 +86,9 @@ namespace TVHome.ViewModels
         /// </summary>
         public Command SetUnpinStatusCommand { get; set; }
 
+        public Command OnMoveCommand { get; set; }
+        public Command OnUnpinCommand { get; set; }
+
         /// <summary>
         /// Gets or set CurrentStatus of HomeStatus
         /// </summary>
@@ -186,6 +189,16 @@ namespace TVHome.ViewModels
             {
                 ChangeCurrentStatus(HomeStatus.UnPin);
             });
+
+            OnMoveCommand = new Command<List<View>>((moveList) =>
+            {
+                MoveAppShortcutInfo(moveList);
+            });
+
+            OnUnpinCommand = new Command<string>((appId) =>
+            {
+                UnpinAppShortcutInfo(appId);
+            });
         }
 
         /// <summary>
@@ -431,5 +444,55 @@ namespace TVHome.ViewModels
                 OnPropertyChanged("SelectedMenuName");
             }
         }
+
+        private void UnpinAppShortcutInfo(string appId)
+        {
+            RemovePinnedApp(appId);
+        }
+
+        private void UpdatePinnedApps(Dictionary<string, string> pinnedApps)
+        {
+            List<AppShortcutInfo> pinnedAppList = new List<AppShortcutInfo>();
+            foreach (var item in pinnedApps)
+            {
+                pinnedAppList.Add(new AppShortcutInfo()
+                {
+                    AppID = item.Key,
+                });
+            }
+
+            TVHomeImpl.GetInstance.AppShortcutControllerInstance.UpdatePinnedApps(pinnedAppList);
+        }
+
+        private async void RemovePinnedApp(string appID)
+        {
+            Dictionary<string, string> PinnedApps = await TVHomeImpl.GetInstance.AppShortcutControllerInstance.GetPinnedAppsAppIDs();
+            if (PinnedApps.ContainsKey(appID))
+            {
+                PinnedApps.Remove(appID);
+                UpdatePinnedApps(PinnedApps);
+                return;
+            }
+        }
+
+        private void MoveAppShortcutInfo(List<View> moveList)
+        {
+            List<AppShortcutInfo> pinnedAppList = new List<AppShortcutInfo>();
+            AppShortcutInfo appShortcut;
+
+            foreach (var item in moveList)
+            {
+                appShortcut = (AppShortcutInfo)item.BindingContext;
+                if (appShortcut.AppID != null && appShortcut.AppID.Length > 0)
+                {
+                    pinnedAppList.Add(new AppShortcutInfo()
+                    {
+                        AppID = appShortcut.AppID,
+                    });
+                }
+            }
+
+            TVHomeImpl.GetInstance.AppShortcutControllerInstance.UpdatePinnedApps(pinnedAppList);
+        }
     }
 }
index fe668c9b5ed850581f3f1d3d30afd6dff7f666ee..460d01c126549eef7e79f8645fbbf15da1261bdf 100755 (executable)
@@ -41,7 +41,9 @@
                             RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
                             RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.8981}"
                             OnFocusedCommand="{Binding SubPanelFocusedCommand}"
-                            ItemsSource="{Binding AppList}">
+                            OnMoveVMCommand="{Binding OnMoveCommand}"
+                            OnUnpinVMCommand="{Binding OnUnpinCommand}"
+                            ItemsSource="{Binding AppList}" >
             </Views:SubPanel>
 
             <Views:SubPanel x:Name="SettingsSubPanel"
index 49eb6571a5b98a5b3323674563ee5f797e87202b..a15ec5f0e3083e53e2e4f0233f86d51a69ebca5b 100755 (executable)
@@ -127,22 +127,25 @@ namespace TVHome.Views
                 ToggleIconified();
             });
 
-            // TODO : this is for the unpin test.
-            App.SetMenuKeyListener((e, arg) =>
+            AppsSubPanel.OnMoveCommand = new Command<bool>((isMoveMode) =>
             {
-                AppShortcutInfo item = null;
-                item = AppsSubPanel.GetFocusedItem() as AppShortcutInfo;
-
-                DebuggingUtils.Dbg("Menu key is pressed : " + item.AppID);
-                if (item != null && item.AppID != null)
+                var bounds = AppsSubPanel.Bounds;
+                if (isMoveMode)
                 {
-                    UnpinAppShortcutInfo(item.AppID);
+                    PageMainPanel.FadeTo(0, 300);
+                    PageMainPanel.IsVisible = false;
+                    bounds.Height += 300;
+                    bounds.Y -= 300;
+                }
+                else
+                {
+                    PageMainPanel.FadeTo(1, 300);
+                    PageMainPanel.IsVisible = true;
+                    bounds.Height -= 300;
+                    bounds.Y += 300;
                 }
-            });
 
-            AppsSubPanel.OnUnpinCommand = new Command<string>((appId) =>
-            {
-                //UnpinAppShortcutInfo(appId);
+                AppsSubPanel.LayoutTo(bounds, 0);
             });
 
             MessagingCenter.Subscribe<App, TVHomeStatus>(this, App.AppStatus, (sender, arg) =>
@@ -207,48 +210,6 @@ namespace TVHome.Views
 
             SubPanelDictionary[panelName].ShowPanel();
         }
-
-        /// <summary>
-        /// A method unpins selected item according to parameter
-        /// </summary>
-        /// <param name="appId">Selected item's app ID</param>
-        private void UnpinAppShortcutInfo(string appId)
-        {
-            RemovePinnedApp(appId);
-        }
-
-        /// <summary>
-        /// A method updates the pinned app list according to parameter
-        /// </summary>
-        /// <param name="PinnedApps">A new pinned apps list</param>
-        private void UpdatePinnedApps(Dictionary<string, string> PinnedApps)
-        {
-            List<AppShortcutInfo> pinnedAppList = new List<AppShortcutInfo>();
-            foreach (var item in PinnedApps)
-            {
-                pinnedAppList.Add(new AppShortcutInfo()
-                {
-                    AppID = item.Key,
-                });
-            }
-
-            TVHomeImpl.GetInstance.AppShortcutControllerInstance.UpdatePinnedApps(pinnedAppList);
-        }
-
-        /// <summary>
-        /// A method removes specific pinned app according to parameter
-        /// </summary>
-        /// <param name="AppID">To be removed app's app ID</param>
-        private async void RemovePinnedApp(string AppID)
-        {
-            Dictionary<string, string> PinnedApps = await TVHomeImpl.GetInstance.AppShortcutControllerInstance.GetPinnedAppsAppIDs();
-            if (PinnedApps.ContainsKey(AppID))
-            {
-                PinnedApps.Remove(AppID);
-                UpdatePinnedApps(PinnedApps);
-            }
-        }
-
         /// <summary>
         /// A task for handling BackKey event
         /// </summary>
index a25b70d290d548f2d3b9961af45e64e0a6d0f407..7c8eed1102211c98efc4362e4c3f917e8e06007c 100755 (executable)
@@ -41,17 +41,31 @@ namespace TVHome.Views
         }
 
         /// <summary>
-        /// Identifies the OnUnpinCommand bindable property
+        /// Identifies the OnUnpinVMCommand bindable property
         /// </summary>
-        public static readonly BindableProperty OnUnpinCommandProperty = BindableProperty.Create("OnUnpinCommand", typeof(ICommand), typeof(SubPanel));
+        public static readonly BindableProperty OnUnpinVMCommandProperty = BindableProperty.Create("OnUnpinVMCommand", typeof(ICommand), typeof(SubPanel));
 
         /// <summary>
         /// A command is executed when item is unpinned
         /// </summary>
-        public ICommand OnUnpinCommand
+        public ICommand OnUnpinVMCommand
         {
-            get { return (ICommand)GetValue(OnUnpinCommandProperty); }
-            set { SetValue(OnUnpinCommandProperty, value); }
+            get { return (ICommand)GetValue(OnUnpinVMCommandProperty); }
+            set { SetValue(OnUnpinVMCommandProperty, value); }
+        }
+
+        /// <summary>
+        /// Identifies the OnMoveVMCommand bindable property
+        /// </summary>
+        public static readonly BindableProperty OnMoveVMCommandProperty = BindableProperty.Create("OnMoveVMCommand", typeof(ICommand), typeof(SubPanel));
+
+        /// <summary>
+        /// A command is executed when item is moved
+        /// </summary>
+        public ICommand OnMoveVMCommand
+        {
+            get { return (ICommand)GetValue(OnMoveVMCommandProperty); }
+            set { SetValue(OnMoveVMCommandProperty, value); }
         }
 
         /// <summary>
@@ -86,6 +100,10 @@ namespace TVHome.Views
         /// A flag indicates whether the panel is focused or not
         /// </summary>
         public bool isFocused;
+        /// <summary>
+        /// A flag indicates whether the panel is move mode or not
+        /// </summary>
+        public bool isMoveMode;
 
         /// <summary>
         /// A method for handling panel focused event
index 153fc6f21b8c791ed2c7b3424c8638d0e747a05c..81c7bcc082c9cab34b562648fa1d8c9610feb2fa 100755 (executable)
@@ -19,6 +19,8 @@ using TVHome.Controls;
 using LibTVRefCommonPortable.DataModels;
 using Xamarin.Forms;
 using System.Threading.Tasks;
+using System.Windows.Input;
+using System.Collections.Generic;
 
 namespace TVHome.Views
 {
@@ -28,9 +30,19 @@ namespace TVHome.Views
     public partial class SubPanel : Panel
     {
         /// <summary>
-        /// A focused item in panel
+        /// A list of PanelButtons.
         /// </summary>
-        private ShortcutInfo focusedItem;
+        private List<PanelButton> ButtonList;
+
+        /// <summary>
+        /// A list of Button's Views.
+        /// </summary>
+        private List<View> ButtonViewList;
+
+        /// <summary>
+        /// A Command will be executed the button is moved.
+        /// </summary>
+        public ICommand OnMoveCommand { get; set; }
 
         /// <summary>
         /// Constructor
@@ -39,18 +51,12 @@ namespace TVHome.Views
         {
             InitializeComponent();
             isFocused = false;
-            PropertyChanged += OnItemsSourcePropertyChanged;
-        }
+            isMoveMode = false;
 
-        /// <summary>
-        /// A method provides focused item in panel
-        /// </summary>
-        /// <returns>A focused item</returns>
-        public ShortcutInfo GetFocusedItem()
-        {
-            return focusedItem;
+            ButtonList = new List<PanelButton>();
+            ButtonViewList = new List<View>();
+            PropertyChanged += OnItemsSourcePropertyChanged;
         }
-
         /// <summary>
         /// A event handler for handling property changed event
         /// </summary>
@@ -64,36 +70,82 @@ namespace TVHome.Views
             }
 
             PanelButtonStack.Children.Clear();
+            ButtonViewList.Clear();
+            ButtonList.Clear();
             foreach (ShortcutInfo item in ItemsSource)
             {
                 PanelButton button;
 
-                if (item.StateDescriptions["default"].Label.Equals("All apps")
-                    || item.StateDescriptions["default"].Label.Equals("Add pin")
-                    || item.StateDescriptions["default"].Label.Equals("Settings"))
+                if (item is AppShortcutInfo)
                 {
-                    button = new SubPanelAllAppsButton();
-                }
-                else if (item.StateDescriptions["default"].Label.Equals("Media Hub"))
-                {
-                    button = new SubPanelReservedButton();
+                    if (item.StateDescriptions["default"].Label.Equals("All apps")
+                        || item.StateDescriptions["default"].Label.Equals("Add pin"))
+                    {
+                        button = new SubPanelAllAppsButton();
+                        ButtonList.Add(button);
+                    }
+                    else if (item.StateDescriptions["default"].Label.Equals("Media Hub"))
+                    {
+                        button = new SubPanelReservedButton();
+                        ButtonList.Add(button);
+                    }
+                    else
+                    {
+                        button = new SubPanelButton();
+                        button.OnMoveCommand = new Command<string>((direction) =>
+                        {
+                            int index = ButtonViewList.IndexOf(button.View);
+                            if (direction.Equals("right"))
+                            {
+                                MoveItemToRight(index);
+                            }
+                            else if (direction.Equals("left"))
+                            {
+                                MoveItemToLeft(index);
+                            }
+                        });
+                    }
+                    ButtonList.Add(button);
                 }
                 else
                 {
-                    button = new SubPanelButton();
+                    button = new SubPanelSettingButton();
                 }
 
                 button.View.BindingContext = item;
                 button.OnFocusedCommand = new Command(() =>
                 {
-                    focusedItem = item;
                     FocusPanel();
                 });
                 button.OnClickedCommand = new Command(() =>
                 {
-                    item.DoAction();
+                    if (!(item is AppShortcutInfo))
+                    {
+                        item.DoAction();
+                        return;
+                    }
+
+                    // TODO : This is triggered by LongTap event.
+                    isMoveMode = !isMoveMode;
+
+                    OnMoveCommand.Execute(isMoveMode);
+
+                    ChangeLayoutButtons(isMoveMode);
+                    button.ChangeMoveMode(isMoveMode);
+
+                    if (!isMoveMode)
+                    {
+                        OnMoveVMCommand.Execute(ButtonViewList);
+                    }
                 });
+                button.OnUnpinCommand = new Command(() =>
+                {
+                    AppShortcutInfo shortcut = (AppShortcutInfo)button.View.BindingContext;
+                    OnUnpinVMCommand.Execute(shortcut.AppID);
+                });
+
                 PanelButtonStack.Children.Add(button.View);
+                ButtonViewList.Add(button.View);
             }
 
             if (!isFocused)
@@ -105,7 +157,18 @@ namespace TVHome.Views
                 isFocused = false;
                 FocusPanel();
             }
+        }
 
+        /// <summary>
+        /// A method for changing button's LayoutOptions in SubPanel according to parameter
+        /// </summary>
+        /// <param name="isMoveMode">A flag indicates whether the SubPanel is MoveMode or not</param>
+        private void ChangeLayoutButtons(bool isMoveMode)
+        {
+            foreach (var item in ButtonList)
+            {
+                item.ChangeLayoutOptions(isMoveMode);
+            }
         }
 
         /// <summary>
@@ -121,9 +184,9 @@ namespace TVHome.Views
 
 #pragma warning disable CS4014
             PanelScrollView.ScrollToAsync(0, 0, true);
-            this.TranslateTo(0, 10);
+            this.TranslateTo(0, 146, 300);
 #pragma warning restore CS4014
-            await this.FadeTo(0, 0);
+            await this.FadeTo(0, 300);
         }
 
         /// <summary>
@@ -171,5 +234,50 @@ namespace TVHome.Views
 #pragma warning restore CS4014
             await this.FadeTo(0.99, 300);
         }
+
+        /// <summary>
+        /// A method for moving the selected item to right
+        /// </summary>
+        /// <param name="index">A index of item to be moved</param>
+        private void MoveItemToRight(int index)
+        {
+            View originItemView = ButtonViewList[index];
+            int nextIndex = index + 1;
+            if (nextIndex >= PanelButtonStack.Children.Count - 1)
+            {
+                return;
+            }
+
+            View nextItemView = ButtonViewList[nextIndex];
+
+            originItemView.TranslateTo(originItemView.TranslationX + 216, originItemView.TranslationY, 300);
+            nextItemView.TranslateTo(nextItemView .TranslationX- 216, 0, 300);
+
+            ButtonViewList[index] = nextItemView;
+            ButtonViewList[nextIndex] = originItemView;
+        }
+
+        /// <summary>
+        /// A method for moving the selected item to left
+        /// </summary>
+        /// <param name="index">A index of item to be moved</param>
+        private void MoveItemToLeft(int index)
+        {
+            View originItemView = ButtonViewList[index];
+            int prevIndex = index - 1;
+
+            if (prevIndex < 2)
+            {
+                return;
+            }
+
+            View prevItemView = ButtonViewList[prevIndex];
+
+            originItemView.TranslateTo(originItemView.TranslationX - 216, originItemView.TranslationY, 300);
+            prevItemView.TranslateTo(prevItemView.TranslationX + 216, 0, 300);
+
+            ButtonViewList[index] = prevItemView;
+            ButtonViewList[prevIndex] = originItemView;
+        }
     }
 }
\ No newline at end of file
index 965402e0a6b2961366c94059239f81e3167f3d5a..71963634a0766d60d940496eb7e21514ec79b9e3 100755 (executable)
@@ -118,9 +118,9 @@ namespace TVHome.Views
 
 #pragma warning disable CS4014
                 PanelScrollView.ScrollToAsync(0, 0, true);
-                this.TranslateTo(0, 10);
+                this.TranslateTo(0, 140, 300);
 #pragma warning restore CS4014
-                await this.FadeTo(0, 0);
+                await this.FadeTo(0, 300);
             }
         }
 
@@ -143,9 +143,9 @@ namespace TVHome.Views
                 }
 
 #pragma warning disable CS4014
-                this.TranslateTo(0, 0, 0);
+                this.TranslateTo(0, 0, 300);
 #pragma warning restore CS4014
-                await this.FadeTo(0.3, 0);
+                await this.FadeTo(0.3, 300);
             }
         }