[assembly: ExportRenderer(typeof(CustomButton), typeof(CustomButtonRenderer))]
namespace TVApps.TizenTV.Renderer
{
+ /// <summary>
+ /// A custom renderer for CustomButton
+ /// </summary>
+ /// <see cref="CustomButton"/>
class CustomButtonRenderer : ButtonRenderer//ViewRenderer<Xamarin.Forms.Button, Button>
{
+ /// <summary>
+ /// Register touch event callback for the Tap.
+ /// </summary>
+ /// <param name="args"> A button element changed event's argument </param>
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Button> args)
{
base.OnElementChanged(args);
Control.Released += KeyUp;
}
+ /// <summary>
+ /// A action delegate invokes OnButtonUp event
+ /// </summary>
+ /// <param name="sender">The source of the event</param>
+ /// <param name="e">The event that is occurred when Control(Native Button) is pressed</param>
private void KeyUp(object sender, EventArgs e)
{
DbgPort.D("KeyUp");
BtnElement.OnButtonUp.Invoke(sender, e);
}
+ /// <summary>
+ /// A action delegate invokes OnButtonDown event
+ /// </summary>
+ /// <param name="sender">The source of the event</param>
+ /// <param name="e">The event that is occurred when Control(Native Button) is released</param>
private void KeyDown(object sender, EventArgs e)
{
DbgPort.D("KeyDown");
* limitations under the License.
*/
-using LibTVRefCommonTizen.Ports;
-using System;
using System.ComponentModel;
using TVApps.Controls;
[assembly: ExportRenderer(typeof(NinePatchImage), typeof(NinePatchImageRenderer))]
namespace TVApps.TizenTV.Renderer
{
+ /// <summary>
+ /// A custom renderer for NinePatchImage
+ /// </summary>
+ /// <see cref="NinePatchImage"/>
class NinePatchImageRenderer : ImageRenderer
{
- protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Image> e)
+ /// <summary>
+ /// Updates border when Element is changed
+ /// </summary>
+ /// <param name="args">A image element changed event's argument </param>
+ protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Image> args)
{
- base.OnElementChanged(e);
+ base.OnElementChanged(args);
UpdateBorder();
}
- protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
+ /// <summary>
+ /// Updates border when ElementProperty is changed
+ /// </summary>
+ /// <param name="sender">The source of the event</param>
+ /// <param name="args">A image element property changed event's argument </param>
+ protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs args)
{
- if ((e.PropertyName == NinePatchImage.BorderBottomProperty.PropertyName)
- || (e.PropertyName == NinePatchImage.BorderLeftProperty.PropertyName)
- || (e.PropertyName == NinePatchImage.BorderRightProperty.PropertyName)
- || (e.PropertyName == NinePatchImage.BorderTopProperty.PropertyName))
+ if ((args.PropertyName == NinePatchImage.BorderBottomProperty.PropertyName)
+ || (args.PropertyName == NinePatchImage.BorderLeftProperty.PropertyName)
+ || (args.PropertyName == NinePatchImage.BorderRightProperty.PropertyName)
+ || (args.PropertyName == NinePatchImage.BorderTopProperty.PropertyName))
{
UpdateBorder();
}
- base.OnElementPropertyChanged(sender, e);
+ base.OnElementPropertyChanged(sender, args);
}
+ /// <summary>
+ /// A method updates border of Control(Native Image)
+ /// </summary>
void UpdateBorder()
{
var img = Element as NinePatchImage;
Control.SetBorder(img.BorderLeft, img.BorderRight, img.BorderTop, img.BorderBottom);
}
+ /// <summary>
+ /// A method updates border of Control(Native Image) after loading
+ /// </summary>
protected override void UpdateAfterLoading()
{
base.UpdateAfterLoading();
namespace TVApps.TizenTV
{
+ /// <summary>
+ /// TV Apps application main entry point
+ /// </summary>
public class Program : Xamarin.Forms.Platform.Tizen.FormsApplication, IAppLifeControl
{
+ /// <summary>
+ /// The application instance
+ /// </summary>
private static Program instance;
+
+ /// <summary>
+ /// A interface for the platform notification
+ /// </summary>
private IPlatformNotification notification;
- private Timer timerForKeyGrab;
+ /// <summary>
+ /// Gets and Sets application resource path
+ /// </summary>
public static string AppResourcePath
{
get;
private set;
}
+ /// <summary>
+ /// Gets and Sets application data path
+ /// </summary>
public static string AppDataPath
{
get;
private set;
}
- private void CallbackForKeyGrab(Object state)
- {
- MainWindow.KeyGrab(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName, true);
- timerForKeyGrab.Dispose();
- timerForKeyGrab = null;
- DebuggingUtils.Dbg("KeyGrab finished");
- }
-
+ /// <summary>
+ /// A method will be called when application is created
+ /// </summary>
protected override void OnCreate()
{
base.OnCreate();
MainWindow.KeyUp += KeyUpListener;
- TimerCallback timerDelegate = new TimerCallback(CallbackForKeyGrab);
- timerForKeyGrab = new Timer(timerDelegate, MainWindow, 3000, 0);
+ MainWindow.KeyGrab(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName, true);
}
- private void KeyUpListener(object sender, ElmSharp.EvasKeyEventArgs e)
+ /// <summary>
+ /// A method will be called when application receives KeyUp event
+ /// </summary>
+
+ /// <param name="sender">The source of the event</param>
+ /// <param name="args">A EvasKey event's argument</param>
+ private void KeyUpListener(object sender, ElmSharp.EvasKeyEventArgs args)
{
- DebuggingUtils.Dbg("[TVApps.TizenTV.cs] Key Pressed :" + e.KeyName);
- if (e.KeyName.CompareTo(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName) == 0)
+ DebuggingUtils.Dbg("[TVApps.TizenTV.cs] Key Pressed :" + args.KeyName);
+ if (args.KeyName.CompareTo(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName) == 0)
{
if (notification != null)
{
}
}
+ /// <summary>
+ /// A method will be called when application is terminated
+ /// </summary>
protected override void OnTerminate()
{
base.OnTerminate();
notification = null;
PackageManagerPort.UnregisterCallbacks();
- MainWindow.KeyUngrab(ElmSharp.EvasKeyEventArgs.PlatformBackButtonName);
MainWindow.KeyUngrab(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName);
-
}
+ /// <summary>
+ /// A method will be called when application receives AppControl
+ /// </summary>
+ /// <param name="e">AppControl event argument</param>
protected override void OnAppControlReceived(AppControlReceivedEventArgs e)
{
DbgPort.D("OnAppControlReceived, " + e.ReceivedAppControl.Operation);
}
}
+ /// <summary>
+ /// The entry point for the application
+ /// </summary>
+ /// <param name="args">A list of command line arguments</param>
static void Main(string[] args)
{
instance = new Program();
Xamarin.Forms.Platform.Tizen.Forms.Init(instance, true);
instance.Run(args);
-
}
+ /// <summary>
+ /// A method terminates application
+ /// </summary>
public void SelfTerminate()
{
instance.Exit();
namespace TVApps
{
+ /// <summary>
+ /// A custom EventArgs with string field
+ /// </summary>
public class TVAppsEventArgs : EventArgs
{
public string arg;
}
+ /// <summary>
+ /// A class that represents TV Apps application.
+ /// </summary>
public class App : Application, IPlatformNotification
{
+ /// <summary>
+ /// A event handler for handling MenuKey event
+ /// </summary>
private static EventHandler<TVAppsEventArgs> MenuKeyListener;
+
+ /// <summary>
+ /// A event handler for handling AppInstalled event
+ /// </summary>
private static EventHandler<TVAppsEventArgs> AppInstalledListener;
+
+ /// <summary>
+ /// A event handler for handling AppUninstalled event
+ /// </summary>
private static EventHandler<TVAppsEventArgs> AppUninstalledListener;
+
+ /// <summary>
+ /// A event handler for handling PinApp request for TV Home
+ /// </summary>
private static EventHandler<TVAppsEventArgs> PinAppRequestListener;
+
+ /// <summary>
+ /// A constructor
+ /// Sets main page to MainPage instance
+ /// </summary>
+ /// <see cref="MainPage"/>
public App()
{
MainPage = new MainPage();
}
+ /// <summary>
+ /// This method is called when the application starts
+ /// </summary>
protected override void OnStart()
{
}
+ /// <summary>
+ /// This method is called when the application enters the sleeping state
+ /// </summary>
protected override void OnSleep()
{
}
+ /// <summary>
+ /// This method is called when the application resumes from a sleeping state
+ /// </summary>
protected override void OnResume()
{
}
+ /// <summary>
+ /// A method adds EventHandler to MenuKeyListener
+ /// </summary>
+ /// <param name="listener">The EventHandler for adding</param>
public static void SetMenuKeyListener(EventHandler<TVAppsEventArgs> listener)
{
MenuKeyListener += listener;
}
+ /// <summary>
+ /// A method adds EventHandler to AppInstalledListener
+ /// </summary>
+ /// <param name="listener">The EventHandler for adding</param>
public static void SetAppInstalledListener(EventHandler<TVAppsEventArgs> listener)
{
AppInstalledListener += listener;
}
+ /// <summary>
+ /// A method adds EventHandler to AppUninstalledListener
+ /// </summary>
+ /// <param name="listener">The EventHandler for adding</param>
public static void SetAppUninstalledListener(EventHandler<TVAppsEventArgs> listener)
{
AppUninstalledListener += listener;
}
+ /// <summary>
+ /// A method adds EventHandler to PinAppRequestListener
+ /// </summary>
+ /// <param name="listener">The EventHandler for adding</param>
public static void SetPinAppRequestListener(EventHandler<TVAppsEventArgs> listener)
{
PinAppRequestListener += listener;
}
+ /// <summary>
+ /// A method will be called if a app is installed.
+ /// </summary>
+ /// <param name="pkgID">A package ID of newly installed.</param>
public void OnAppInstalled(string pkgID)
{
DebuggingUtils.Dbg("[[[ App Installed ]]] " + pkgID);
});
}
+ /// <summary>
+ /// A method will be called if a app is uninstalled.
+ /// </summary>
+ /// <param name="pkgID">A package ID of uninstalled.</param>
public void OnAppUninstalled(string pkgID)
{
DebuggingUtils.Dbg("[[[ App Uninstalled ]]] " + pkgID);
});
}
+ /// <summary>
+ /// A method will be called if the app gets a pin app App Control request.
+ /// </summary>
public void OnPinAppRequestReceived()
{
DebuggingUtils.Dbg("[[[ Pin Add Request ]]] ");
PinAppRequestListener.Invoke(this, new TVAppsEventArgs());
}
+ /// <summary>
+ /// A method will be called if the app gets a app pinned notification App Control request.
+ /// </summary>
+ /// <param name="appID">A pinned app ID</param>/// <summary>
public void OnAppPinnedNotificationReceived(string appID)
{
}
+ /// <summary>
+ /// A method will be called when the Home remote control key is pressed.
+ /// </summary>
public void OnHomeKeyPressed()
{
}
+ /// <summary>
+ /// A method will be called when the Menu remote control key is pressed.
+ /// </summary>
public void OnMenuKeyPressed()
{
DebuggingUtils.Dbg("[APPS] Menu Key is pressed");
*/
using Xamarin.Forms;
-using TVApps.Controls;
namespace TVApps.Views
{
/// <summary>
- /// hahaha
+ /// A custom view for displaying footer when CurrentStatus of MainPage is AppsStatus.Delete
/// </summary>
public partial class FooterDeleteStatus : Grid
{
+ /// <summary>
+ /// A constructor
+ /// </summary>
public FooterDeleteStatus()
{
InitializeComponent();
namespace TVApps.Views
{
/// <summary>
- /// hahaha
+ /// A custom view for displaying footer when CurrentStatus of MainPage is AppsStatus.Default
/// </summary>
public partial class FooterNormalStatus : Grid
{
+ /// <summary>
+ /// A constructor
+ /// </summary>
public FooterNormalStatus()
{
InitializeComponent();
namespace TVApps.Views
{
/// <summary>
- /// hahaha
+ /// A custom view for displaying footer when CurrentStatus of MainPage is AppsStatus.Pin
/// </summary>
public partial class FooterPinStatus : Grid
{
+ /// <summary>
+ /// Identifies the SumOfCheckedApp bindable property
+ /// </summary>
public static readonly BindableProperty SumOfCheckedAppProperty = BindableProperty.Create("SumOfCheckedApp", typeof(int), typeof(FooterPinStatus), default(int));
+
+ /// <summary>
+ /// Gets or sets count of checked AppItemCell
+ /// </summary>
public int SumOfCheckedApp
{
get { return (int)GetValue(SumOfCheckedAppProperty); }
set { SetValue(SumOfCheckedAppProperty, value); }
}
+ /// <summary>
+ /// A constructor
+ /// </summary>
public FooterPinStatus()
{
InitializeComponent();
namespace TVApps.Views
{
/// <summary>
- /// Root Page of TV Apps Application
+ /// A custom view for displaying main page of TV Apps
/// </summary>
public partial class MainPage : ContentPage
{
+ /// <summary>
+ /// Identifies the CurrentStatus bindable property
+ /// </summary>
public static readonly BindableProperty CurrentStatusProperty = BindableProperty.Create("CurrentStatus", typeof(AppsStatus), typeof(MainPage), default(AppsStatus));
+
+ /// <summary>
+ /// Gets or sets current status of MainPage
+ /// </summary>
public AppsStatus CurrentStatus
{
get { return (AppsStatus)GetValue(CurrentStatusProperty); }
}
*/
+ /// <summary>
+ /// A method runs animation when TV Apps is started
+ /// </summary>
private async void PlayShowAnimation()
{
await AppList.TranslateTo(0, 12, 0);
AppList.InitializeFocus();
}
+ /// <summary>
+ /// A constructor
+ /// Adds PropertyChanged event handler and MenuKey event listener
+ /// </summary>
public MainPage()
{
InitializeComponent();
- PropertyChanged += MainPage_PropertyChanged;
- SetCurrntStatus(AppsStatus.Default);
+ PropertyChanged += MainPagePropertyChanged;
+ SetCurrentStatus(AppsStatus.Default);
PlayShowAnimation();
// TODO: This code is temporary for menu option test
});
}
- private void SetCurrntStatus(AppsStatus status)
+ /// <summary>
+ /// A method sets current status of MainPage
+ /// Changes visibility of footers
+ /// </summary>
+ /// <param name="status">The next status name</param>
+ private void SetCurrentStatus(AppsStatus status)
{
switch (status)
{
}
}
- private void MainPage_PropertyChanged(object sender, PropertyChangedEventArgs e)
+ /// <summary>
+ /// This method is called when the properties of MainPage is changed
+ /// If CurrentStatus is changed, call SetCurrentStatus method
+ /// </summary>
+ /// <param name="sender">The source of the event</param>
+ /// <param name="e">The event that is occurred when property of MainPage is changed</param>
+ private void MainPagePropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName.CompareTo("CurrentStatus") == 0)
{
- SetCurrntStatus(CurrentStatus);
+ SetCurrentStatus(CurrentStatus);
}
}
+ /// <summary>
+ /// A task for handling BackKey event
+ /// </summary>
+ /// <returns>Always returns true</returns>
private async Task<bool> OnBackKeyPressedAtMain()
{
if (CurrentStatus != AppsStatus.Default)
return true;
}
+ /// <summary>
+ /// This method is called when Back button is pressed
+ /// </summary>
+ /// <returns>Always returns true</returns>
+ /// <see cref="Page.OnBackButtonPressed"/>
protected override bool OnBackButtonPressed()
{
SynchronizationContext.Current.Post(async (o) =>