DebuggingPort.D("GetInstalledApplication failed");\r
return null;\r
}\r
+\r
result = new Dictionary<string, string>();\r
result.Add("Label", appInfo.Label);\r
result.Add("ApplicationId", appInfo.ApplicationId);\r
result.Add("IconPath", (System.IO.File.Exists(appInfo.IconPath)) ? appInfo.IconPath : icons[random.Next(0, 6)]);\r
}\r
- catch(Exception exception)\r
+ catch (Exception exception)\r
{\r
DebuggingPort.E("Exception " + applicationId + " :" + exception.Message);\r
return null;\r
}\r
+\r
return result;\r
}\r
}\r
using Tizen.Applications;
using TVHome.Utils;
-namespace TVHome.TizenTV.Ports
+namespace TVHome.TizenTV.Ports
{
class FileSystemPort : IFileSystemAPIs
{
{
DebuggingPort.E("Exception!! " + exception.Message);
}
+
return fileStream;
}
var fileStream = stream as FileStream;
fileStream.Dispose();
}
-}
+ }
}
<?xml version="1.0" encoding="UTF-8"?>
-<ViewCell xmlns="http://xamarin.com/schemas/2014/forms"
- xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
- x:Class="TVHome.Controls.MainPanelButton">
+<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.MainPanelButton">
<RelativeLayout Opacity="0.3">
<BoxView x:Name = "ButtonBox"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.126}"
Opacity="0"
- FontSize="26"
+ FontSize="58"
TextColor="White"
LineBreakMode="TailTruncation"
HorizontalTextAlignment="Center"
Clicked="OnClicked"
Opacity="0" />
</RelativeLayout>
-</ViewCell>
+</Controls:PanelButton>
/// <summary>
/// Custom Control for Button in Main Panel
/// </summary>
- public partial class MainPanelButton : ViewCell
+ public partial class MainPanelButton : PanelButton
{
public BindableProperty OnFocusedCommandProperty = BindableProperty.Create("OnFocusedCommand", typeof(ICommand), typeof(MainPanelButton));
InitializeComponent();
}
- private async void OnFocused(object sender, FocusEventArgs e)
+ public override async void OnFocused(object sender, FocusEventArgs e)
{
if (OnFocusedCommand != null)
{
await View.FadeTo(0.6, 300);
}
- private async void OnUnfocused(object sender, FocusEventArgs e)
+ public override async void OnUnfocused(object sender, FocusEventArgs e)
{
if (ButtonTitle.Text.Equals("Apps"))
{
await View.FadeTo(0.3, 300);
}
- private async void OnClicked(object sender, EventArgs e)
+ public override async void OnClicked(object sender, EventArgs e)
{
if (OnClickedCommand != null)
{
--- /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 System.Windows.Input;
+using Xamarin.Forms;
+
+namespace TVHome.Controls
+{
+ public abstract class PanelButton : ViewCell
+ {
+ public BindableProperty OnFocusedCommandProperty = BindableProperty.Create("OnFocusedCommand", typeof(ICommand), typeof(PanelButton));
+
+ public ICommand OnFocusedCommand
+ {
+ get { return (ICommand)GetValue(OnFocusedCommandProperty); }
+ set { SetValue(OnFocusedCommandProperty, value); }
+ }
+
+ public BindableProperty OnClickedCommandProperty = BindableProperty.Create("OnClickedCommand", typeof(ICommand), typeof(PanelButton));
+
+ public ICommand OnClickedCommand
+ {
+ get { return (ICommand)GetValue(OnClickedCommandProperty); }
+ set { SetValue(OnClickedCommandProperty, value); }
+ }
+
+ public abstract void OnFocused(object sender, FocusEventArgs e);
+
+ public abstract void OnUnfocused(object sender, FocusEventArgs e);
+
+ public abstract void OnClicked(object sender, EventArgs e);
+ }
+}
<?xml version="1.0" encoding="UTF-8"?>\r
-<ViewCell xmlns="http://xamarin.com/schemas/2014/forms"\r
- xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"\r
- x:Class="TVHome.Controls.SubPanelButton">\r
+<Controls:PanelButton xmlns="http://xamarin.com/schemas/2014/forms"\r
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"\r
+ xmlns:Controls="clr-namespace:TVHome.Controls"\r
+ x:Class="TVHome.Controls.SubPanelButton">\r
<RelativeLayout Opacity="0.3">\r
<BoxView x:Name = "ButtonBox"\r
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"\r
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"\r
- Color="Blue" />\r
+ Opacity="0"/>\r
<Image x:Name="ButtonImage"\r
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"\r
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"\r
Source="{Binding CurrentStateDescription.IconPath}" />\r
+ <Image x:Name="ButtonGradient"\r
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"\r
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"\r
+ Source="ic_tizen_list_thumbnail_gradient_normal.9.png" />\r
<Label x:Name="ButtonTitle"\r
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.2}"\r
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"\r
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.8}"\r
Opacity="0"\r
+ TextColor="White"\r
LineBreakMode="TailTruncation"\r
+ HorizontalTextAlignment="Center"\r
Text="{Binding CurrentStateDescription.Label}" />\r
<Button x:Name = "ButtonFocusArea"\r
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"\r
Clicked="OnClicked"\r
Opacity="0" />\r
</RelativeLayout>\r
-</ViewCell>
\ No newline at end of file
+</Controls:PanelButton>
\ No newline at end of file
/// <summary>\r
/// Custom Control for Button in Sub Panel\r
/// </summary>\r
- public partial class SubPanelButton : ViewCell\r
+ public partial class SubPanelButton : PanelButton\r
{\r
- public BindableProperty OnFocusedCommandProperty = BindableProperty.Create("OnFocusedCommand", typeof(ICommand), typeof(SubPanelButton));\r
-\r
- public ICommand OnFocusedCommand\r
+ public SubPanelButton()\r
{\r
- get { return (ICommand)GetValue(OnFocusedCommandProperty); }\r
- set { SetValue(OnFocusedCommandProperty, value); }\r
+ InitializeComponent();\r
}\r
\r
- public BindableProperty OnClickedCommandProperty = BindableProperty.Create("OnClickedCommand", typeof(ICommand), typeof(SubPanelButton));\r
-\r
- public ICommand OnClickedCommand\r
+ public override async void OnClicked(object sender, EventArgs e)\r
{\r
- get { return (ICommand)GetValue(OnClickedCommandProperty); }\r
- set { SetValue(OnClickedCommandProperty, value); }\r
- }\r
+ if (OnClickedCommand != null)\r
+ {\r
+ OnClickedCommand.Execute("");\r
+ }\r
\r
- public SubPanelButton()\r
- {\r
- InitializeComponent();\r
+ await View.FadeTo(0.9, 300);\r
}\r
\r
- private async void OnFocused(object sender, FocusEventArgs e)\r
+ public override async void OnFocused(object sender, FocusEventArgs e)\r
{\r
if (OnFocusedCommand != null)\r
{\r
OnFocusedCommand.Execute("");\r
}\r
\r
- ButtonTitle.FadeTo(0.99, 300);\r
+ ButtonTitle.FadeTo(0.8, 300);\r
await View.FadeTo(0.6, 300);\r
}\r
\r
- private async void OnUnfocused(object sender, FocusEventArgs e)\r
+ public override async void OnUnfocused(object sender, FocusEventArgs e)\r
{\r
ButtonTitle.FadeTo(0, 300);\r
await View.FadeTo(0.3, 300);\r
}\r
-\r
- private async void OnClicked(object sender, EventArgs e)\r
- {\r
- if (OnClickedCommand != null)\r
- {\r
- OnClickedCommand.Execute("");\r
- }\r
-\r
- await View.FadeTo(0.9, 300);\r
- }\r
}\r
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
-<ViewCell xmlns="http://xamarin.com/schemas/2014/forms"
- xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
- x:Class="TVHome.Controls.SubPanelThumbnailButton">
- <RelativeLayout Opacity="0.3">
- <BoxView x:Name="ButtonBox"
- WidthRequest="320"
- HeightRequest="180"
- Color="Blue" />
- <Image x:Name="ThumbnailImage"
- RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=1}"
- Source="screenshot.png" />
- <Image x:Name="ThumbnailGradient"
- RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=1}"
- Source="ic_tizen_list_thumbnail_gradient_normal.9.png" />
- <Image x:Name="ThumbnailIcon"
- RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.043}"
- RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.689}"
- RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.131}"
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.233}"
- Source="AppIcon.png" />
- <Label x:Name="ThumbnailTitle"
- RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.206}"
- RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.722}"
- RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.75}"
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.166}"
- Opacity="0"
- LineBreakMode="TailTruncation"
- HorizontalTextAlignment="Start"
- VerticalTextAlignment="Center"
- Text="{Binding CurrentStateDescription.Label}"
- TextColor="#FFFFFFFF"
- FontSize="70"/>
- <Button x:Name="ButtonFocusArea"
- RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=1}"
- Focused="OnFocused"
- Unfocused="OnUnfocused"
- Clicked="OnClicked"
- Opacity="0" />
- </RelativeLayout>
-</ViewCell>
\ No newline at end of file
+<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.SubPanelThumbnailButton">
+ <RelativeLayout Opacity="0.3">
+ <BoxView x:Name="ButtonBox"
+ WidthRequest="320"
+ HeightRequest="180"
+ Opacity="0"/>
+ <Image x:Name="ThumbnailImage"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=1}"
+ Source="screenshot.png" />
+ <Image x:Name="ThumbnailGradient"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=1}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
+ Source="ic_tizen_list_thumbnail_gradient_normal.9.png" />
+ <Image x:Name="ThumbnailIcon"
+ RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.043}"
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.689}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.131}"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.233}"
+ Source="AppIcon.png" />
+ <Label x:Name="ThumbnailTitle"
+ RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.206}"
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.722}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=0.75}"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=0.166}"
+ Opacity="0"
+ LineBreakMode="TailTruncation"
+ HorizontalTextAlignment="Start"
+ VerticalTextAlignment="Center"
+ Text="{Binding CurrentStateDescription.Label}"
+ TextColor="#FFFFFFFF"
+ FontSize="70"/>
+ <Button x:Name="ButtonFocusArea"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Width, Factor=1}"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ButtonBox, Property=Height, Factor=1}"
+ Focused="OnFocused"
+ Unfocused="OnUnfocused"
+ Clicked="OnClicked"
+ Opacity="0" />
+ </RelativeLayout>
+</Controls:PanelButton>
\ No newline at end of file
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
using System;
-using System.Windows.Input;
-using TVHome.Utils;
using Xamarin.Forms;
namespace TVHome.Controls
/// <summary>
/// Custom Control for Thumbnail Button in Sub Panel
/// </summary>
- public partial class SubPanelThumbnailButton : ViewCell
+ public partial class SubPanelThumbnailButton : PanelButton
{
- public BindableProperty OnFocusedCommandProperty = BindableProperty.Create("OnFocusedCommand", typeof(ICommand), typeof(SubPanelThumbnailButton));
-
- public ICommand OnFocusedCommand
+ public SubPanelThumbnailButton()
{
- get { return (ICommand)GetValue(OnFocusedCommandProperty); }
- set { SetValue(OnFocusedCommandProperty, value); }
+ InitializeComponent();
}
- public BindableProperty OnClickedCommandProperty = BindableProperty.Create("OnClickedCommand", typeof(ICommand), typeof(SubPanelThumbnailButton));
-
- public ICommand OnClickedCommand
+ private void AnimationInitialize(object sender, EventArgs e)
{
- get { return (ICommand)GetValue(OnClickedCommandProperty); }
- set { SetValue(OnClickedCommandProperty, value); }
}
- public SubPanelThumbnailButton()
+ public override async void OnClicked(object sender, EventArgs e)
{
- InitializeComponent();
+ if (OnClickedCommand != null)
+ {
+ OnClickedCommand.Execute("");
+ }
+
+ await View.FadeTo(0.9, 300);
}
- private async void OnFocused(object sender, FocusEventArgs e)
+ public override async void OnFocused(object sender, FocusEventArgs e)
{
if (OnFocusedCommand != null)
{
OnFocusedCommand.Execute("");
}
+ // Height, Width 확장 Animiation
+ //var Animation = new Animation();
+ //var viewHeightAnimation = new Animation(v => View.HeightRequest = v, 180, 216);
+ //var viewWidthAnimation = new Animation(v => View.WidthRequest = v, 320, 384);
+ //var imageWidthAnimation = new Animation(v => ThumbnailImage.Scale = v, 1, 1.2);
+ //var imagePositionAnimation = new Animation(v => ThumbnailImage.TranslationX = v, 0, 32);
+ //var titleAnimation = new Animation(v => ThumbnailTitle.Opacity = v, 0, 0.99);
+ //Animation.Add(0, 1, viewHeightAnimation);
+ //Animation.Add(0, 1, viewWidthAnimation);
+ //Animation.Add(0, 1, imageWidthAnimation);
+ //Animation.Add(0, 1, imagePositionAnimation);
+ //Animation.Add(0, 1, titleAnimation);
+ //Animation.Commit(ThumbnailTitle, "FocusedAnimation", 16, 300);
ThumbnailTitle.FadeTo(0.99, 300);
await View.FadeTo(0.6, 300);
}
- private async void OnUnfocused(object sender, FocusEventArgs e)
+ public override async void OnUnfocused(object sender, FocusEventArgs e)
{
+ // Height, Width 확장 Animiation
+ //var Animation = new Animation();
+ //var viewHeightAnimation = new Animation(v => View.HeightRequest = v, 216, 180);
+ //var viewWidthAnimation = new Animation(v => View.WidthRequest = v, 384, 320);
+ //var imageWidthAnimation = new Animation(v => ThumbnailImage.Scale = v, 1.2, 1);
+ //var imagePositionAnimation = new Animation(v => ThumbnailImage.TranslationX = v, 32, 0);
+ //var titleAnimation = new Animation(v => ThumbnailTitle.Opacity = v, 0.99, 0);
+ //Animation.Add(0, 1, viewHeightAnimation);
+ //Animation.Add(0, 1, viewWidthAnimation);
+ //Animation.Add(0, 1, imageWidthAnimation);
+ //Animation.Add(0, 1, imagePositionAnimation);
+ //Animation.Add(0, 1, titleAnimation);
+ //Animation.Commit(ThumbnailTitle, "UnfocusedAnimation", 16, 300);
+
ThumbnailTitle.FadeTo(0, 300);
await View.FadeTo(0.3, 300);
}
-
- private async void OnClicked(object sender, EventArgs e)
- {
- if (OnClickedCommand != null)
- {
- OnClickedCommand.Execute("");
- }
-
- await View.FadeTo(0.9, 300);
- }
}
}
\ No newline at end of file
string appLabel;\r
string appIconPath;\r
\r
- appInfo.TryGetValue("Label",out appLabel);\r
+ appInfo.TryGetValue("Label", out appLabel);\r
appInfo.TryGetValue("IconPath", out appIconPath);\r
\r
DebuggingUtils.Dbg("AppID: " + appShortcutInfo.AppID + ", Label : " + appLabel + " IconPath : " + appIconPath);\r
var defaultStateDescription = new StateDescription()\r
{\r
Label = appLabel,\r
- IconPath = appIconPath??icons[random.Next(0, 6)], //IconPath = (resul5t[2] == null) ? "AppIcon.png" : result[2],\r
+ IconPath = appIconPath ?? icons[random.Next(0, 6)], //IconPath = (resul5t[2] == null) ? "AppIcon.png" : result[2],\r
Action = new AppControlAction\r
{\r
AppID = appShortcutInfo.AppID,\r
}\r
};\r
- \r
+\r
appShortcutInfo.StateDescriptions.Add("default", defaultStateDescription);\r
appShortcutInfo.CurrentStateDescription = defaultStateDescription;\r
}\r
// TODO : Remove the broken appInfo from pinned_apps_info\r
}\r
}\r
+\r
return pinned_apps_info;\r
}\r
\r
<Compile Include="Controls\MainPanelButton.xaml.cs">\r
<DependentUpon>MainPanelButton.xaml</DependentUpon>\r
</Compile>\r
+ <Compile Include="Controls\PanelButton.cs" />\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="DataModels\AppControlAction.cs" />\r
<Compile Include="DataModels\BTLaunchAction.cs" />\r
<Compile Include="DataModels\DBItem.cs" />\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
</Reference>\r
</ItemGroup>\r
<ItemGroup>\r
- <None Include="packages.config" />\r
+ <None Include="packages.config">\r
+ <SubType>Designer</SubType>\r
+ </None>\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
{\r
fileSystemWatcher.Run();\r
}\r
- \r
+\r
private static List<AppShortcutInfo> GetSampleList()\r
{\r
var pinnedAppsInfo = new List<AppShortcutInfo>();\r
\r
return pinnedAppsInfo;\r
}\r
+\r
public static List<AppShortcutInfo> ReadFromFile(string filePath)\r
{\r
IFileSystemAPIs fileSystem = DependencyService.Get<IFileSystemAPIs>();\r
WriteToFile(result, filePath);\r
return result;\r
}\r
+\r
StreamReader streamReader = new StreamReader(fileStream);\r
return (List<AppShortcutInfo>)serializer.Deserialize(streamReader);\r
}\r
XmlSerializer serializer = new XmlSerializer(typeof(List<AppShortcutInfo>));\r
Stream fileStream = fileSystem.OpenFile(filePath, UtilFileMode.OpenOrCreate);\r
if (fileStream == null)\r
+ {\r
return false;\r
+ }\r
+\r
StreamWriter streamWriter = new StreamWriter(fileStream);\r
serializer.Serialize(streamWriter, pinnedAppInfo);\r
streamWriter.Flush();\r
-using System;
+/*
+ * 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 System.Collections.Generic;
using System.Linq;
using System.Text;
Truncate = 5,
Append = 6
}
+
public interface IFileSystemAPIs
{
Stream OpenFile(string filePath, UtilFileMode mode);
-using System;
+/*
+ * 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 TVHome.DataModels;
namespace TVHome.Utils
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:Views="clr-namespace:TVHome.Views"
xmlns:ViewModels="clr-namespace:TVHome.ViewModels"
+ xmlns:Controls="clr-namespace:TVHome.Controls"
Appearing="OnAppearing"
BackgroundImage="background.jpg">
<ContentPage.BackgroundColor>
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0}"
Color="Black"
Opacity="0.6"/>
+
<Views:MainPanel x:Name="PageMainPanel"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.22}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.21875}"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.18}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"
- ItemsSource="{Binding RecentList}" />
+ ItemsSource="{Binding RecentList}" >
+ <Views:SubPanel.ItemTemplate>
+ <DataTemplate>
+ <Controls:SubPanelThumbnailButton/>
+ </DataTemplate>
+ </Views:SubPanel.ItemTemplate>
+ </Views:SubPanel>
<Views:SubPanel x:Name="AppsSubPanel"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.18}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"
- ItemsSource="{Binding AppList}" />
+ ItemsSource="{Binding AppList}">
+ <Views:SubPanel.ItemTemplate>
+ <DataTemplate>
+ <Controls:SubPanelButton/>
+ </DataTemplate>
+ </Views:SubPanel.ItemTemplate>
+ </Views:SubPanel>
<Views:SubPanel x:Name="SettingsSubPanel"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.18}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"
- ItemsSource="{Binding SettingsList}" />
+ ItemsSource="{Binding SettingsList}">
+ <Views:SubPanel.ItemTemplate>
+ <DataTemplate>
+ <Controls:SubPanelButton/>
+ </DataTemplate>
+ </Views:SubPanel.ItemTemplate>
+ </Views:SubPanel>
+
</RelativeLayout>
</ContentPage.Content>
-</ContentPage>
+</ContentPage>
\ No newline at end of file
Orientation="Horizontal"\r
HorizontalOptions="Center">\r
<StackLayout x:Name="PanelButtonStack"\r
- Orientation="Horizontal">\r
+ Orientation="Horizontal"\r
+ Padding="96,0,96,0">\r
</StackLayout>\r
</ScrollView>\r
</ContentView.Content>\r
using TVHome.DataModels;\r
using TVHome.ViewModels;\r
using Xamarin.Forms;\r
+using TVHome.Utils;\r
\r
namespace TVHome.Views\r
{\r
set { SetValue(ItemsSourceProperty, value); }\r
}\r
\r
+ public static readonly BindableProperty ItemTemplateProperty = BindableProperty.Create("ItemTemplate", typeof(DataTemplate), typeof(SubPanel));\r
+\r
+ public DataTemplate ItemTemplate\r
+ {\r
+ get { return (DataTemplate)GetValue(ItemTemplateProperty); }\r
+ set { SetValue(ItemTemplateProperty, value); }\r
+ }\r
+\r
private bool isFocused;\r
\r
public SubPanel()\r
}\r
\r
PanelButtonStack.Children.Clear();\r
+\r
foreach (ShortcutInfo item in ItemsSource)\r
{\r
- var button = new SubPanelButton();\r
+ var button = ItemTemplate.CreateContent() as PanelButton;\r
button.View.BindingContext = item;\r
button.OnFocusedCommand = new Command(() =>\r
{\r