/// </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); }
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)
+ {
+ }
}
}
/// </summary>
public abstract class PanelButton : ViewCell
{
+ public bool isMoveMode;
/// <summary>
/// A Command will be executed the button is focused.
/// </summary>
/// </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>
/// <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);
}
}
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
#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);
+ }
}
}
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
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>
/// <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
#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
--- /dev/null
+<?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
--- /dev/null
+/*
+ * 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)
+ {
+ }
+ }
+}
#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
-<?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>
/// </summary>
public Command SetUnpinStatusCommand { get; set; }
+ public Command OnMoveCommand { get; set; }
+ public Command OnUnpinCommand { get; set; }
+
/// <summary>
/// Gets or set CurrentStatus of HomeStatus
/// </summary>
{
ChangeCurrentStatus(HomeStatus.UnPin);
});
+
+ OnMoveCommand = new Command<List<View>>((moveList) =>
+ {
+ MoveAppShortcutInfo(moveList);
+ });
+
+ OnUnpinCommand = new Command<string>((appId) =>
+ {
+ UnpinAppShortcutInfo(appId);
+ });
}
/// <summary>
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);
+ }
}
}
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"
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) =>
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>
}
/// <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>
/// 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
using LibTVRefCommonPortable.DataModels;
using Xamarin.Forms;
using System.Threading.Tasks;
+using System.Windows.Input;
+using System.Collections.Generic;
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
{
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>
}
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)
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>
#pragma warning disable CS4014
PanelScrollView.ScrollToAsync(0, 0, true);
- this.TranslateTo(0, 1, 0);
+ this.TranslateTo(0, 146, 300);
#pragma warning restore CS4014
- await this.FadeTo(0, 0);
+ await this.FadeTo(0, 300);
}
/// <summary>
#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
#pragma warning disable CS4014
PanelScrollView.ScrollToAsync(0, 0, true);
- this.TranslateTo(0, 1, 0);
+ this.TranslateTo(0, 140, 300);
#pragma warning restore CS4014
- await this.FadeTo(0, 0);
+ await this.FadeTo(0, 300);
}
}
}
#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);
}
}