* limitations under the License.
*/
-using System;
using LibTVRefCommonPortable.Utils;
using LibTVRefCommonTizen.Ports;
using Tizen.Applications;
-using System.Threading;
+using Tizen.Xamarin.Forms.Extension.Renderer;
namespace TVApps.TizenTV
{
Xamarin.Forms.DependencyService.Register<FileSystemPort>();
Xamarin.Forms.Platform.Tizen.Forms.Init(instance);
+ TizenFormsExtension.Init();
instance.Run(args);
}
"ElmSharp": "1.1.0-beta-018",
"Microsoft.NETCore.App": "1.1.0",
"Tizen.Library": "1.0.0-pre3",
+ "Tizen.Xamarin.Forms.Extension": "2.3.4-r214-001",
"Xamarin.Forms": "2.3.4.214-pre5",
"Xamarin.Forms.Platform.Tizen": "2.3.4-r214-002"
},
<?xml version="1.0" encoding="UTF-8"?>
<ViewCell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:Control="clr-namespace:TVApps.Controls"
x:Class="TVApps.Controls.AppItemCell">
<RelativeLayout HeightRequest="342"
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.RowSpacing>0</Grid.RowSpacing>
- <Button x:Name="OptionMenuPinToggleButton"
- Grid.Row="0"
- Command="{Binding OptionMenuPinToggleCommand}"
- Text="UNPIN" />
- <Button x:Name="OptionMenuDeleteButton"
- Grid.Row="1"
- Command="{Binding OptionMenuDeleteCommand}"
- Text="DELETE" />
+ <Control:TVButton x:Name="OptionMenuPinToggleButton"
+ Grid.Row="0"
+ Command="{Binding OptionMenuPinToggleCommand}"
+ Text="UNPIN" />
+ <Control:TVButton x:Name="OptionMenuDeleteButton"
+ Grid.Row="1"
+ Command="{Binding OptionMenuDeleteCommand}"
+ Text="DELETE" />
</Grid>
</RelativeLayout>
set { TitleText.Text = value; }
}
+ public event EventHandler Clicked;
+
/// <summary>
/// Identifies the Command bindable property
/// </summary>
{
ButtonGrid.BackgroundColor = Color.FromRgb(255, 255, 255);
Command?.Execute(CommandParameter);
+ Clicked?.Invoke(sender, e);
});
});
}
</ProjectReference>
</ItemGroup>
<ItemGroup>
+ <Reference Include="Tizen.Xamarin.Forms.Extension, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\Tizen.Xamarin.Forms.Extension.2.3.4-r214-001\lib\portable-win+net45+wp80+win81+wpa81\Tizen.Xamarin.Forms.Extension.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
<Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Xamarin.Forms.2.3.4.214-pre5\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Core.dll</HintPath>
<Private>True</Private>
<Grid xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:Control="clr-namespace:TVApps.Controls"
- x:Class="TVApps.Views.FooterNormalStatus">
+ x:Class="TVApps.Views.FooterNormalStatus"
+ PinAppCommand="{Binding ButtonPinAppCommand}"
+ DeleteAppCommand="{Binding ButtonDeleteAppCommand}">
<Grid.Resources>
<ResourceDictionary>
</Grid.ColumnDefinitions>
<StackLayout Grid.Row="0" Grid.Column="1"
- Orientation="Horizontal">
+ Orientation="Horizontal"
+ HorizontalOptions="End">
<Picker Title="SORT BY" SelectedIndex="{Binding SortOptionIndex}">
<Picker.Items>
</Picker.Items>
</Picker>
- <Control:TVButton Text="PIN"
- Command="{Binding ButtonPinAppCommand}"/>
-
- <Control:TVButton Text="DELETE"
- Command="{Binding ButtonDeleteAppCommand}"/>
+ <Control:TVButton Text="Options"
+ Clicked="OnOptionsClicked" />
</StackLayout>
</Grid>
\ No newline at end of file
*/
using Xamarin.Forms;
+using Tizen.Xamarin.Forms.Extension;
+using LibTVRefCommonPortable.Utils;
+using System.Windows.Input;
+using System;
namespace TVApps.Views
{
/// </summary>
public partial class FooterNormalStatus : Grid
{
+ static ContextPopup popup;
+ private bool isPopupShowing = false;
+
+ public static readonly BindableProperty PinAppCommandProperty = BindableProperty.Create("PinAppCommand", typeof(Command), typeof(FooterNormalStatus), null);
+ public ICommand PinAppCommand
+ {
+ get { return (ICommand)GetValue(PinAppCommandProperty); }
+ set { SetValue(PinAppCommandProperty, value); }
+ }
+
+ public static readonly BindableProperty DeleteAppCommandProperty = BindableProperty.Create("DeleteAppCommand", typeof(Command), typeof(FooterNormalStatus), null);
+ public ICommand DeleteAppCommand
+ {
+ get { return (ICommand)GetValue(DeleteAppCommandProperty); }
+ set { SetValue(DeleteAppCommandProperty, value); }
+ }
+
+
/// <summary>
/// A constructor
/// </summary>
public FooterNormalStatus()
{
InitializeComponent();
+
+ popup = new ContextPopup
+ {
+ IsAutoHidingEnabled = true,
+ Orientation = ContextPopupOrientation.Vertical,
+ DirectionPriorities = new ContextPopupDirectionPriorities(ContextPopupDirection.Up, ContextPopupDirection.Right, ContextPopupDirection.Left, ContextPopupDirection.Down),
+ };
+
+ popup.Items.Add(new ContextPopupItem("PIN"));
+ popup.Items.Add(new ContextPopupItem("DELETE"));
+
+ //TODO: need to change the event callback
+ popup.SelectedIndexChanged += (s, e) =>
+ {
+ var ctxPopup = s as ContextPopup;
+
+ DebuggingUtils.Dbg("selected item : " + (ctxPopup.SelectedItem as ContextPopupItem).Label + " (" + ctxPopup.SelectedIndex + ")");
+ switch (ctxPopup.SelectedIndex)
+ {
+ case 0: //PIN
+ PinAppCommand?.Execute("");
+ break;
+ case 1: //DELETE
+ DeleteAppCommand?.Execute("");
+ break;
+ default:
+ break;
+ }
+
+ popup.Dismiss();
+ };
+
+ popup.Dismissed += (s, e) =>
+ {
+ isPopupShowing = false;
+ };
+ }
+
+ void OnOptionsClicked(object sender, EventArgs e)
+ {
+ if (isPopupShowing)
+ {
+ return;
+ }
+
+ popup.Show(sender as View);
+ isPopupShowing = true;
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
+ <package id="Tizen.Xamarin.Forms.Extension" version="2.3.4-r214-001" targetFramework="portable45-net45+win8+wp8+wpa81" />
<package id="Xamarin.Forms" version="2.3.4.214-pre5" targetFramework="portable45-net45+win8+wp8+wpa81" />
</packages>
\ No newline at end of file