From: Geunsun, Lee Date: Tue, 28 Mar 2017 10:39:20 +0000 (+0900) Subject: Add comments for AppControlPort.cs & ApplicationManagerPort.cs X-Git-Tag: submit/tizen/20170808.015446~149 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3570a42faa5076f25b7645021812e680bed362c1;p=profile%2Ftv%2Fapps%2Fdotnet%2Fhome.git Add comments for AppControlPort.cs & ApplicationManagerPort.cs Change-Id: I93f5b331c8dc469a642533df94d06da277651b07 --- diff --git a/LibTVRefCommonTizen/Ports/AppControlPort.cs b/LibTVRefCommonTizen/Ports/AppControlPort.cs index b946580..d3762ae 100644 --- a/LibTVRefCommonTizen/Ports/AppControlPort.cs +++ b/LibTVRefCommonTizen/Ports/AppControlPort.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); @@ -22,7 +22,7 @@ using Tizen.Applications; namespace LibTVRefCommonTizen.Ports { /// - /// This class is for AppControl API + /// Handles the Appcontrol APIs /// public class AppControlPort : IAppControl { @@ -38,11 +38,13 @@ namespace LibTVRefCommonTizen.Ports public static string TVAppsAppID = "org.tizen.example.TVApps.TizenTV"; /// + /// Represents the operation to be performed between TVHome and TVApps /// This operation is sended from TVHomes to TVApps /// public static string AddAppOperation = "http://xahome.tizen.org/appcontrol/operation/add_app"; /// + /// Represents the operation to be performed between TVHome and TVApps /// This operation is sended from TVApps to TVHome /// public static string AppAddedNotifyOperation = "http://xahome.tizen.org/appcontrol/operation/app_added"; diff --git a/LibTVRefCommonTizen/Ports/ApplicationManagerPort.cs b/LibTVRefCommonTizen/Ports/ApplicationManagerPort.cs index 2995618..6610a01 100644 --- a/LibTVRefCommonTizen/Ports/ApplicationManagerPort.cs +++ b/LibTVRefCommonTizen/Ports/ApplicationManagerPort.cs @@ -17,65 +17,99 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using Xamarin.Forms.Platform.Tizen.Native; -using Tizen; using Tizen.Applications; using LibTVRefCommonPortable.Utils; namespace LibTVRefCommonTizen.Ports { + /// + /// Handles the ApplicationsManager APIs + /// public class ApplicationManagerPort : IApplicationManagerAPIs { + /// + /// Defines the default app icon + /// If the app icon is not exist, shows the default app icon + /// private static String DefaultAppIcon = "AppIcon.png"; + /// + /// The constructor of this class + /// Adds the EventHandler for ApplicationLaunched + /// public ApplicationManagerPort() { ApplicationManager.ApplicationLaunched += new EventHandler(OnApplicationLaunched); } + /// + /// Arguments for the event that is raised when the application is launched + /// + /// The source of the event + /// An object that contains no event data + /// + /// https://msdn.microsoft.com/en-us/library/system.eventhandler(v=vs.110).aspx + /// void OnApplicationLaunched(object sender, EventArgs args) { ApplicationLaunchedEventArgs launchedEventArgs = args as ApplicationLaunchedEventArgs; DebuggingUtils.Dbg(launchedEventArgs.ApplicationRunningContext.ApplicationId + " launched"); } + /// + /// Gets the information of the recent applications + /// + /// The list of the recent applications public IEnumerable GetRecentApplications() { List resultList = new List(); - IEnumerable recentApps = ApplicationManager.GetRecentApplications(); - - foreach (var app in recentApps) + try { - if (app.IsNoDisplay || - app.ApplicationId == null || - app.ApplicationId.Length < 1) - { - continue; - } + IEnumerable recentApps = ApplicationManager.GetRecentApplications(); - resultList.Add(new RecentApp() + foreach (var app in recentApps) { - instanceID = app.InstanceId, - instanceLabel = app.InstanceName, - appID = app.ApplicationId, - applabel = (app.Label == null || app.Label.Length < 1) ? "No Name" : app.Label, - iconPath = app.IconPath, - launchedTime = app.LaunchTime, - uri = app.Uri, - }); + if (app.IsNoDisplay || + app.ApplicationId == null || + app.ApplicationId.Length < 1) + { + continue; + } + + resultList.Add(new RecentApp() + { + instanceID = app.InstanceId, + instanceLabel = app.InstanceName, + appID = app.ApplicationId, + applabel = (app.Label == null || app.Label.Length < 1) ? "No Name" : app.Label, + iconPath = app.IconPath, + launchedTime = app.LaunchTime, + uri = app.Uri, + }); + } + } + catch (InvalidOperationException) + { + DebuggingUtils.Err("Failed to get the information of the recent applications"); + return null; } return resultList; } - public Dictionary GetInstalledApplication(string applicationId) + /// + /// Gets the information of the specified application with the app ID + /// + /// The app Id you want to get + /// The information of the installed applications + public Dictionary GetInstalledApplication(string appID) { Dictionary result = null; ApplicationInfo appInfo = null; try { - appInfo = ApplicationManager.GetInstalledApplication(applicationId); + appInfo = ApplicationManager.GetInstalledApplication(appID); if (appInfo == null) { DbgPort.D("GetInstalledApplication failed"); @@ -89,13 +123,17 @@ namespace LibTVRefCommonTizen.Ports } catch (Exception exception) { - DbgPort.E("Exception " + applicationId + " :" + exception.Message); + DbgPort.E("Exception " + appID + " :" + exception.Message); return null; } return result; } + /// + /// Gets the information of the installed applications asynchronously + /// + /// The list of the installed applications public async Task> GetAllInstalledApplication() { try