From ebfd87cc56d6623b6124198f74c6a962a6cff8b2 Mon Sep 17 00:00:00 2001 From: "yons.kim" Date: Wed, 9 Mar 2016 19:06:19 +0900 Subject: [PATCH] [AppControl] Add Features Manipulating Data Add AppControl's features. - AddData, GetData, RemoveData,TryGetData, - and ExtraData Class for mentioned features - For these features, add code for Libc.so Change-Id: I3ef033f81c394147ed8444d4777cb148e363ea5d --- AppFW.sln | 6 - Tizen.Applications/Interop/Interop.AppControl.cs | 104 ++++- Tizen.Applications/Interop/Interop.Libc.cs | 20 + Tizen.Applications/Interop/Interop.Libraries.cs | 1 + Tizen.Applications/Tizen.Applications.csproj | 6 +- Tizen.Applications/Tizen.Applications.csproj.user | 2 +- .../Tizen.Applications/AppControl.cs | 478 +++++++++++++++------ .../Tizen.Applications/AppControlEventArgs.cs | 13 - .../Tizen.Applications/AppControlLaunchMode.cs | 24 ++ .../Tizen.Applications/AppControlLaunchResult.cs | 34 ++ .../Tizen.Applications/AppControlOperations.cs | 149 +++++++ .../AppControlReplyReceivedEventArgs.cs | 29 ++ .../Tizen.Applications/Application.cs | 39 +- .../Tizen.Applications/ApplicationInfo.cs | 6 + .../Tizen.Applications/LocaleChangedEventArgs.cs | 6 + .../Tizen.Applications/LowMemoryEventArgs.cs | 6 + .../Tizen.Applications/UIApplication.cs | 6 + 17 files changed, 745 insertions(+), 184 deletions(-) create mode 100644 Tizen.Applications/Interop/Interop.Libc.cs delete mode 100755 Tizen.Applications/Tizen.Applications/AppControlEventArgs.cs create mode 100755 Tizen.Applications/Tizen.Applications/AppControlLaunchMode.cs create mode 100755 Tizen.Applications/Tizen.Applications/AppControlLaunchResult.cs create mode 100755 Tizen.Applications/Tizen.Applications/AppControlOperations.cs create mode 100755 Tizen.Applications/Tizen.Applications/AppControlReplyReceivedEventArgs.cs diff --git a/AppFW.sln b/AppFW.sln index b31afed..4d309af 100755 --- a/AppFW.sln +++ b/AppFW.sln @@ -9,8 +9,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen", "..\tizen\Tizen\Tiz EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Internals", "..\tizen\Tizen.Internals\Tizen.Internals.csproj", "{B9AA1CB2-F72D-4A30-A33B-A20C850A38A0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{296FB4FC-D152-45AF-99BF-09CC7A212262}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -29,10 +27,6 @@ Global {B9AA1CB2-F72D-4A30-A33B-A20C850A38A0}.Debug|Any CPU.Build.0 = Debug|Any CPU {B9AA1CB2-F72D-4A30-A33B-A20C850A38A0}.Release|Any CPU.ActiveCfg = Release|Any CPU {B9AA1CB2-F72D-4A30-A33B-A20C850A38A0}.Release|Any CPU.Build.0 = Release|Any CPU - {296FB4FC-D152-45AF-99BF-09CC7A212262}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {296FB4FC-D152-45AF-99BF-09CC7A212262}.Debug|Any CPU.Build.0 = Debug|Any CPU - {296FB4FC-D152-45AF-99BF-09CC7A212262}.Release|Any CPU.ActiveCfg = Release|Any CPU - {296FB4FC-D152-45AF-99BF-09CC7A212262}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Tizen.Applications/Interop/Interop.AppControl.cs b/Tizen.Applications/Interop/Interop.AppControl.cs index 90595e7..a2e36a6 100755 --- a/Tizen.Applications/Interop/Interop.AppControl.cs +++ b/Tizen.Applications/Interop/Interop.AppControl.cs @@ -6,34 +6,108 @@ /// it only in accordance with the terms of the license agreement /// you entered into with Samsung. - using System; using System.Runtime.InteropServices; +using Tizen.Internals.Errors; + internal static partial class Interop { internal static partial class AppControl { + internal delegate bool ExtraDataCallback(SafeAppControlHandle handle, string key, IntPtr userData); + internal delegate bool AppMatchedCallback(SafeAppControlHandle handle, string applicationId, IntPtr userData); + internal delegate void ReplyCallback(SafeAppControlHandle request, SafeAppControlHandle reply, int result, IntPtr userData); + [DllImport(Libraries.AppControl, EntryPoint = "app_control_create")] - internal static extern int Create(out SafeAppControlHandle handle); + internal static extern ErrorCode Create(out SafeAppControlHandle handle); [DllImport(Libraries.AppControl, EntryPoint = "app_control_clone")] - internal static extern int Clone(out SafeAppControlHandle clone, SafeAppControlHandle handle); + internal static extern ErrorCode DangerousClone(out SafeAppControlHandle clone, IntPtr handle); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_app_id")] + internal static extern ErrorCode GetAppId(IntPtr app_control, out IntPtr app_id); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_operation")] + internal static extern ErrorCode GetOperation(SafeAppControlHandle handle, out string operation); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_set_operation")] + internal static extern ErrorCode SetOperation(SafeAppControlHandle handle, string operation); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_uri")] + internal static extern ErrorCode GetUri(SafeAppControlHandle handle, out string uri); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_set_uri")] + internal static extern ErrorCode SetUri(SafeAppControlHandle handle, string uri); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_mime")] + internal static extern ErrorCode GetMime(SafeAppControlHandle handle, out string mime); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_set_mime")] + internal static extern ErrorCode SetMime(SafeAppControlHandle handle, string mime); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_category")] + internal static extern ErrorCode GetCategory(SafeAppControlHandle handle, out string category); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_set_category")] + internal static extern ErrorCode SetCategory(SafeAppControlHandle handle, string category); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_app_id")] + internal static extern ErrorCode GetAppId(SafeAppControlHandle handle, out string appId); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_set_app_id")] + internal static extern ErrorCode SetAppId(SafeAppControlHandle handle, string appId); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_set_launch_mode")] + internal static extern ErrorCode SetLaunchMode(SafeAppControlHandle handle, int mode); - [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_app_id", CallingConvention = CallingConvention.Cdecl)] - internal static extern int GetAppId(IntPtr app_control, out IntPtr app_id); + [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_launch_mode")] + internal static extern ErrorCode GetLaunchMode(SafeAppControlHandle handle, out int mode); - [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_operation", CallingConvention = CallingConvention.Cdecl)] - internal static extern int GetOperation(SafeAppControlHandle handle, out string operation); + [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_caller")] + internal static extern ErrorCode GetCaller(SafeAppControlHandle handle, out string caller); - [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_uri", CallingConvention = CallingConvention.Cdecl)] - internal static extern int GetUri(SafeAppControlHandle handle, out string uri); + [DllImport(Libraries.AppControl, EntryPoint = "app_control_is_reply_requested")] + internal static extern ErrorCode IsReplyRequested(SafeAppControlHandle handle, out bool requested); - [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_mime", CallingConvention = CallingConvention.Cdecl)] - internal static extern int GetMime(SafeAppControlHandle handle, out string mime); + [DllImport(Libraries.AppControl, EntryPoint = "app_control_add_extra_data")] + internal static extern ErrorCode AddExtraData(SafeAppControlHandle handle, string key, string value); - [DllImport(Libraries.AppControl, EntryPoint = "app_control_destroy", CallingConvention = CallingConvention.Cdecl)] - private static extern int DangerousDestroy(IntPtr handle); + [DllImport(Libraries.AppControl, EntryPoint = "app_control_remove_extra_data")] + internal static extern ErrorCode RemoveExtraData(SafeAppControlHandle handle, string key); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_extra_data")] + internal static extern ErrorCode GetExtraData(SafeAppControlHandle handle, string key, out string value); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_add_extra_data_array")] + internal static extern ErrorCode AddExtraDataArray(SafeAppControlHandle handle, string key, string[] value, int length); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_extra_data_array")] + internal static extern ErrorCode GetExtraDataArray(SafeAppControlHandle handle, string key, out IntPtr value, out int length); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_is_extra_data_array")] + internal static extern ErrorCode IsExtraDataArray(SafeAppControlHandle handle, string key, out bool array); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_destroy")] + private static extern ErrorCode DangerousDestroy(IntPtr handle); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_foreach_extra_data")] + internal static extern ErrorCode ForeachExtraData(SafeAppControlHandle handle, ExtraDataCallback callback, IntPtr userData); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_foreach_app_matched")] + internal static extern ErrorCode ForeachAppMatched(SafeAppControlHandle handle, AppMatchedCallback callback, IntPtr userData); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_send_launch_request")] + internal static extern ErrorCode SendLaunchRequest(SafeAppControlHandle handle, ReplyCallback callback, IntPtr userData); + + [DllImport(Libraries.Application, EntryPoint = "app_control_send_terminate_request")] + internal static extern ErrorCode SendTerminateRequest(SafeAppControlHandle handle); + + [DllImport(Libraries.Application, EntryPoint = "app_control_reply_to_launch_request")] + internal static extern ErrorCode ReplyToLaunchRequest(SafeAppControlHandle reply, SafeAppControlHandle request, int result); + + [DllImport(Libraries.Application, EntryPoint = "app_control_enable_app_started_result_event")] + internal static extern ErrorCode EnableAppStartedResultEvent(SafeAppControlHandle handle); internal sealed class SafeAppControlHandle : SafeHandle { @@ -41,10 +115,6 @@ internal static partial class Interop { } - public SafeAppControlHandle(IntPtr handle) : base(handle, false) - { - } - public override bool IsInvalid { get { return this.handle == IntPtr.Zero; } diff --git a/Tizen.Applications/Interop/Interop.Libc.cs b/Tizen.Applications/Interop/Interop.Libc.cs new file mode 100644 index 0000000..c968cb2 --- /dev/null +++ b/Tizen.Applications/Interop/Interop.Libc.cs @@ -0,0 +1,20 @@ +/// Copyright 2016 by Samsung Electronics, Inc., +/// +/// This software is the confidential and proprietary information +/// of Samsung Electronics, Inc. ("Confidential Information"). You +/// shall not disclose such Confidential Information and shall use +/// it only in accordance with the terms of the license agreement +/// you entered into with Samsung. + + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Libc + { + [DllImport(Libraries.Libc, EntryPoint = "free", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Free(IntPtr ptr); + } +} diff --git a/Tizen.Applications/Interop/Interop.Libraries.cs b/Tizen.Applications/Interop/Interop.Libraries.cs index 5ce88c4..9141ea0 100755 --- a/Tizen.Applications/Interop/Interop.Libraries.cs +++ b/Tizen.Applications/Interop/Interop.Libraries.cs @@ -17,5 +17,6 @@ internal static partial class Interop public const string AppcoreAgent = "libappcore-agent.so.1"; public const string Bundle = "libbundle.so.0"; public const string Glib = "libglib-2.0.so.0"; + public const string Libc = "libc.so.6"; } } diff --git a/Tizen.Applications/Tizen.Applications.csproj b/Tizen.Applications/Tizen.Applications.csproj index 3536789..6ec4179 100755 --- a/Tizen.Applications/Tizen.Applications.csproj +++ b/Tizen.Applications/Tizen.Applications.csproj @@ -57,10 +57,10 @@ + - @@ -68,6 +68,10 @@ + + + + diff --git a/Tizen.Applications/Tizen.Applications.csproj.user b/Tizen.Applications/Tizen.Applications.csproj.user index ca1d04b..5283ef1 100755 --- a/Tizen.Applications/Tizen.Applications.csproj.user +++ b/Tizen.Applications/Tizen.Applications.csproj.user @@ -1,6 +1,6 @@  - ProjectFiles + ShowAllFiles \ No newline at end of file diff --git a/Tizen.Applications/Tizen.Applications/AppControl.cs b/Tizen.Applications/Tizen.Applications/AppControl.cs index 24fae1c..f923d2a 100755 --- a/Tizen.Applications/Tizen.Applications/AppControl.cs +++ b/Tizen.Applications/Tizen.Applications/AppControl.cs @@ -8,6 +8,9 @@ using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using Tizen.Internals.Errors; namespace Tizen.Applications { @@ -16,197 +19,400 @@ namespace Tizen.Applications /// public class AppControl { - private readonly string _operation; - private readonly string _mime; - private readonly string _uri; + private const string LogTag = "Tizen.Applications"; + + private readonly Interop.AppControl.SafeAppControlHandle _handle; + + private string _operation = null; + private string _mime = null; + private string _uri = null; + private string _category = null; + private string _applicationId = null; + + private ExtraDataCollection _extraData = null; /// /// /// - /// - /// - /// - public AppControl(string operation, string mime, string uri) + public event EventHandler AppControlReplyReceived; + + /// + /// + /// + public AppControl() { - _operation = operation; - _mime = mime; - _uri = uri; + ErrorCode err = Interop.AppControl.Create(out _handle); + if (err != ErrorCode.None) + { + throw new InvalidOperationException("Failed to create the appcontrol handle. Err = " + err); + } } - internal AppControl(IntPtr appControlHandle) + internal AppControl(IntPtr handle) { - var handle = new Interop.AppControl.SafeAppControlHandle(appControlHandle); - Interop.AppControl.GetOperation(handle, out _operation); - Interop.AppControl.GetMime(handle, out _mime); - Interop.AppControl.GetUri(handle, out _uri); + ErrorCode err = Interop.AppControl.DangerousClone(out _handle, handle); + if (err != ErrorCode.None) + { + throw new InvalidOperationException("Failed to create the appcontrol handle. Err = " + err); + } } + #region Public Properties + /// - /// Gets the operation to be performed. + /// The operation to be performed. /// - public string Operation { get { return _operation; } } + public string Operation + { + get + { + if (String.IsNullOrEmpty(_operation)) + { + ErrorCode err = Interop.AppControl.GetOperation(_handle, out _operation); + if (err != ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the operation from the appcontrol. Err = " + err); + } + } + return _operation; + } + set + { + ErrorCode err = Interop.AppControl.SetOperation(_handle, value); + if (err == ErrorCode.None) + { + _operation = value; + } + else + { + Log.Warn(LogTag, "Failed to set the operation to the appcontrol. Err = " + err); + } + } + } /// - /// Gets the explicit MIME type of the data. + /// The explicit MIME type of the data. /// - public string Mime { get { return _mime; } } + public string Mime + { + get + { + if (String.IsNullOrEmpty(_mime)) + { + ErrorCode err = Interop.AppControl.GetMime(_handle, out _mime); + if (err != ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the mime from the appcontrol. Err = " + err); + } + } + return _mime; + } + set + { + ErrorCode err = Interop.AppControl.SetMime(_handle, value); + if (err == ErrorCode.None) + { + _mime = value; + } + else + { + Log.Warn(LogTag, "Failed to set the mime to the appcontrol. Err = " + err); + } + } + } /// - /// Gets the URI of the data. + /// The URI of the data. /// - public string Uri { get { return _uri; } } - - internal bool IsLaunchOperation() + public string Uri { - if (_operation == null) return false; - return (_operation == Operations.Main) || (_operation == Operations.Default); + get + { + if (String.IsNullOrEmpty(_uri)) + { + ErrorCode err = Interop.AppControl.GetUri(_handle, out _uri); + if (err != ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the uri from the appcontrol. Err = " + err); + } + } + return _uri; + } + set + { + ErrorCode err = Interop.AppControl.SetUri(_handle, value); + if (err == ErrorCode.None) + { + _uri = value; + } + else + { + Log.Warn(LogTag, "Failed to set the uri to the appcontrol. Err = " + err); + } + } } - internal bool IsService + /// + /// + /// + public string Category { - get { return false; } + get + { + if (String.IsNullOrEmpty(_category)) + { + ErrorCode err = Interop.AppControl.GetCategory(_handle, out _category); + if (err != ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the category from the appcontrol. Err = " + err); + } + } + return _category; + } + set + { + ErrorCode err = Interop.AppControl.SetCategory(_handle, value); + if (err == ErrorCode.None) + { + _category = value; + } + else + { + Log.Warn(LogTag, "Failed to set the category to the appcontrol. Err = " + err); + } + } } - /// /// /// - public static class Operations + public string ApplicationId { - /// - /// An explicit launch for a homescreen application. - /// - public const string Main = "http://tizen.org/appcontrol/operation/main"; - - /// - /// An explicit launch for an application that excludes a homescreen application. - /// - public const string Default = "http://tizen.org/appcontrol/operation/default"; - - /// - /// Provides an editable access to the given data. - /// - public const string Edit = "http://tizen.org/appcontrol/operation/edit"; - - /// - /// Displays the data. - /// - public const string View = "http://tizen.org/appcontrol/operation/view"; - - /// - /// Picks items. - /// - public const string Pick = "http://tizen.org/appcontrol/operation/pick"; - - /// - /// Creates contents. - /// - public const string CreateContent = "http://tizen.org/appcontrol/operation/create_content"; - - /// - /// Performs a call to someone. - /// - public const string Call = "http://tizen.org/appcontrol/operation/call"; - - /// - /// Delivers some data to someone else. - /// - public const string Send = "http://tizen.org/appcontrol/operation/send"; - - /// - /// Delivers text data to someone else. - /// - public const string SendText = "http://tizen.org/appcontrol/operation/send_text"; - - /// - /// Shares an item with someone else. - /// - public const string Share = "http://tizen.org/appcontrol/operation/share"; + get + { + if (String.IsNullOrEmpty(_applicationId)) + { + ErrorCode err = Interop.AppControl.GetAppId(_handle, out _applicationId); + if (err != ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the appId from the appcontrol. Err = " + err); + } + } + return _applicationId; + } + set + { + ErrorCode err = Interop.AppControl.SetAppId(_handle, value); + if (err == ErrorCode.None) + { + _applicationId = value; + } + else + { + Log.Warn(LogTag, "Failed to set the appId to the appcontrol. Err = " + err); + } + } + } - /// - /// Shares multiple items with someone else. - /// - public const string MultiShare = "http://tizen.org/appcontrol/operation/multi_share"; + /// + /// + /// + public AppControlLaunchMode LaunchMode + { + get + { + int value = 0; + ErrorCode err = Interop.AppControl.GetLaunchMode(_handle, out value); + if (err != ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the launchMode from the appcontrol. Err = " + err); + } + return (AppControlLaunchMode)value; + } + set + { + ErrorCode err = Interop.AppControl.SetLaunchMode(_handle, (int)value); + if (err != ErrorCode.None) + { + Log.Warn(LogTag, "Failed to set the launchMode to the appcontrol. Err = " + err); + } + } + } - /// - /// Shares text data with someone else. - /// - public const string ShareText = "http://tizen.org/appcontrol/operation/share_text"; + /// + /// + /// + public string CallerApplicationId + { + get + { + string value = String.Empty; + ErrorCode err = Interop.AppControl.GetCaller(_handle, out value); + if (err != ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the caller appId from the appcontrol. Err = " + err); + } + return value; + } + } - /// - /// Dials a number. This shows a UI with the number to be dialed, allowing the user to explicitly initiate the call. - /// - public const string Dial = "http://tizen.org/appcontrol/operation/dial"; + /// + /// + /// + public bool IsReplyRequested + { + get + { + bool value = false; + ErrorCode err = Interop.AppControl.IsReplyRequested(_handle, out value); + if (err != ErrorCode.None) + { + Log.Warn(LogTag, "Failed to check the replyRequested of the appcontrol. Err = " + err); + } + return value; + } + } - /// - /// Performs a search. - /// - public const string Search = "http://tizen.org/appcontrol/operation/search"; + public ExtraDataCollection ExtraData + { + get + { + if (_extraData == null) + { + _extraData = new ExtraDataCollection(_handle); + } + return _extraData; + } + } - /// - /// Downloads items. - /// - public const string Download = "http://tizen.org/appcontrol/operation/download"; + #endregion // Public Properties - /// - /// Prints contents. - /// - public const string Print = "http://tizen.org/appcontrol/operation/print"; + /// + /// + /// + /// + public IEnumerable GetMatchedApplicationIds() + { + List ids = new List(); + Interop.AppControl.AppMatchedCallback callback = new Interop.AppControl.AppMatchedCallback( + (handle, applicationId, userData) => + { + List idsList = Marshal.GetObjectForIUnknown(userData) as List; + if (idsList != null) + { + idsList.Add(applicationId); + return true; + } + else + { + return false; + } + }); + + IntPtr pointerToApplicationIds = Marshal.GetIUnknownForObject(ids); + if (pointerToApplicationIds != null) + { + ErrorCode err = Interop.AppControl.ForeachAppMatched(_handle, callback, pointerToApplicationIds); + if (err != ErrorCode.None) + { + throw new InvalidOperationException("Failed to get matched appids. err = " + err); + } + return ids; + } + + return ids; + } - /// - /// Composes a message. - /// - public const string Compose = "http://tizen.org/appcontrol/operation/compose"; + /// + /// + /// + /// + public static void SendLaunchRequest(AppControl request) + { + throw new NotImplementedException(); + } - /// - /// Can be launched by interested System-Event. - /// - public const string LaunchOnEvent = "http://tizen.org/appcontrol/operation/launch_on_event"; + /// + /// + /// + /// + public static void SendLaunchRequestForReply(AppControl request) + { + throw new NotImplementedException(); + } - /// - /// Adds an item. - /// - public const string Add = "http://tizen.org/appcontrol/operation/add"; + /// + /// + /// + /// + public void Reply(AppControl reply) + { + throw new NotImplementedException(); + } - /// - /// Captures images by camera applications. - /// - public const string ImageCapture = "http://tizen.org/appcontrol/operation/image_capture"; - /// - /// Captures videos by camera applications. - /// - public const string VideoCapture = "http://tizen.org/appcontrol/operation/video_capture"; + /// + /// + /// + public class ExtraDataCollection + { + private readonly Interop.AppControl.SafeAppControlHandle _handle; - /// - /// Shows system settings. - /// - public const string Setting = "http://tizen.org/appcontrol/operation/setting"; + internal ExtraDataCollection(Interop.AppControl.SafeAppControlHandle handle) + { + _handle = handle; + } /// - /// Shows settings to enable Bluetooth. + /// /// - public const string SettingBluetoothEnable = "http://tizen.org/appcontrol/operation/setting/bt_enable"; + /// + /// + public void Add(string key, string value) + { + throw new NotImplementedException(); + } /// - /// Shows settings to configure Bluetooth visibility. + /// /// - public const string SettingBluetoothVisibility = "http://tizen.org/appcontrol/operation/setting/bt_visibility"; + /// + /// + public void Add(string key, IEnumerable value) + { + throw new NotImplementedException(); + } /// - /// Shows settings to allow configuration of current location sources. + /// /// - public const string SettingLocation = "http://tizen.org/appcontrol/operation/setting/location"; + /// + /// + /// + public T Get(string key) + { + throw new NotImplementedException(); + } /// - /// Shows NFC settings. + /// /// - public const string SettingNfc = "http://tizen.org/appcontrol/operation/setting/nfc"; + /// + /// + public object Get(string key) + { + throw new NotImplementedException(); + } /// - /// Shows settings to allow configuration of Wi-Fi. + /// /// - public const string SettingWifi = "http://tizen.org/appcontrol/operation/setting/wifi"; + /// + public void Remove(string key) + { + throw new NotImplementedException(); + } } + } } diff --git a/Tizen.Applications/Tizen.Applications/AppControlEventArgs.cs b/Tizen.Applications/Tizen.Applications/AppControlEventArgs.cs deleted file mode 100755 index dd735b1..0000000 --- a/Tizen.Applications/Tizen.Applications/AppControlEventArgs.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tizen.Applications -{ - public class AppControlEventArgs : EventArgs - { - public AppControl AppControl { get; internal set; } - } -} diff --git a/Tizen.Applications/Tizen.Applications/AppControlLaunchMode.cs b/Tizen.Applications/Tizen.Applications/AppControlLaunchMode.cs new file mode 100755 index 0000000..c240a34 --- /dev/null +++ b/Tizen.Applications/Tizen.Applications/AppControlLaunchMode.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tizen.Applications +{ + /// + /// + /// + public enum AppControlLaunchMode + { + /// + /// + /// + Single = 0, + + /// + /// + /// + Group, + } +} diff --git a/Tizen.Applications/Tizen.Applications/AppControlLaunchResult.cs b/Tizen.Applications/Tizen.Applications/AppControlLaunchResult.cs new file mode 100755 index 0000000..1464443 --- /dev/null +++ b/Tizen.Applications/Tizen.Applications/AppControlLaunchResult.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tizen.Applications +{ + /// + /// Enumeration for App Control Result. + /// + public enum AppControlLaunchResult + { + /// + /// Callee application is launched actually. + /// + AppStarted = 1, + + /// + /// Operation is succeeded + /// + Succeeded = 0, + + /// + /// Operation is failed by the callee + /// + Failed = -1, + + /// + /// Operation is canceled by the platform + /// + Canceled = -2, + } +} diff --git a/Tizen.Applications/Tizen.Applications/AppControlOperations.cs b/Tizen.Applications/Tizen.Applications/AppControlOperations.cs new file mode 100755 index 0000000..b9137f2 --- /dev/null +++ b/Tizen.Applications/Tizen.Applications/AppControlOperations.cs @@ -0,0 +1,149 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tizen.Applications +{ + /// + /// + /// + public static class AppControlOperations + { + /// + /// An explicit launch for a homescreen application. + /// + public const string Main = "http://tizen.org/appcontrol/operation/main"; + + /// + /// An explicit launch for an application that excludes a homescreen application. + /// + public const string Default = "http://tizen.org/appcontrol/operation/default"; + + /// + /// Provides an editable access to the given data. + /// + public const string Edit = "http://tizen.org/appcontrol/operation/edit"; + + /// + /// Displays the data. + /// + public const string View = "http://tizen.org/appcontrol/operation/view"; + + /// + /// Picks items. + /// + public const string Pick = "http://tizen.org/appcontrol/operation/pick"; + + /// + /// Creates contents. + /// + public const string CreateContent = "http://tizen.org/appcontrol/operation/create_content"; + + /// + /// Performs a call to someone. + /// + public const string Call = "http://tizen.org/appcontrol/operation/call"; + + /// + /// Delivers some data to someone else. + /// + public const string Send = "http://tizen.org/appcontrol/operation/send"; + + /// + /// Delivers text data to someone else. + /// + public const string SendText = "http://tizen.org/appcontrol/operation/send_text"; + + /// + /// Shares an item with someone else. + /// + public const string Share = "http://tizen.org/appcontrol/operation/share"; + + /// + /// Shares multiple items with someone else. + /// + public const string MultiShare = "http://tizen.org/appcontrol/operation/multi_share"; + + /// + /// Shares text data with someone else. + /// + public const string ShareText = "http://tizen.org/appcontrol/operation/share_text"; + + /// + /// Dials a number. This shows a UI with the number to be dialed, allowing the user to explicitly initiate the call. + /// + public const string Dial = "http://tizen.org/appcontrol/operation/dial"; + + /// + /// Performs a search. + /// + public const string Search = "http://tizen.org/appcontrol/operation/search"; + + /// + /// Downloads items. + /// + public const string Download = "http://tizen.org/appcontrol/operation/download"; + + /// + /// Prints contents. + /// + public const string Print = "http://tizen.org/appcontrol/operation/print"; + + /// + /// Composes a message. + /// + public const string Compose = "http://tizen.org/appcontrol/operation/compose"; + + /// + /// Can be launched by interested System-Event. + /// + public const string LaunchOnEvent = "http://tizen.org/appcontrol/operation/launch_on_event"; + + /// + /// Adds an item. + /// + public const string Add = "http://tizen.org/appcontrol/operation/add"; + + /// + /// Captures images by camera applications. + /// + public const string ImageCapture = "http://tizen.org/appcontrol/operation/image_capture"; + + /// + /// Captures videos by camera applications. + /// + public const string VideoCapture = "http://tizen.org/appcontrol/operation/video_capture"; + + /// + /// Shows system settings. + /// + public const string Setting = "http://tizen.org/appcontrol/operation/setting"; + + /// + /// Shows settings to enable Bluetooth. + /// + public const string SettingBluetoothEnable = "http://tizen.org/appcontrol/operation/setting/bt_enable"; + + /// + /// Shows settings to configure Bluetooth visibility. + /// + public const string SettingBluetoothVisibility = "http://tizen.org/appcontrol/operation/setting/bt_visibility"; + + /// + /// Shows settings to allow configuration of current location sources. + /// + public const string SettingLocation = "http://tizen.org/appcontrol/operation/setting/location"; + + /// + /// Shows NFC settings. + /// + public const string SettingNfc = "http://tizen.org/appcontrol/operation/setting/nfc"; + + /// + /// Shows settings to allow configuration of Wi-Fi. + /// + public const string SettingWifi = "http://tizen.org/appcontrol/operation/setting/wifi"; + } +} diff --git a/Tizen.Applications/Tizen.Applications/AppControlReplyReceivedEventArgs.cs b/Tizen.Applications/Tizen.Applications/AppControlReplyReceivedEventArgs.cs new file mode 100755 index 0000000..b3cdf56 --- /dev/null +++ b/Tizen.Applications/Tizen.Applications/AppControlReplyReceivedEventArgs.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tizen.Applications +{ + /// + /// + /// + public class AppControlReplyReceivedEventArgs + { + /// + /// + /// + public AppControl Request { get; internal set; } + + /// + /// + /// + public AppControl Reply { get; internal set; } + + /// + /// + /// + public AppControlLaunchResult Result { get; internal set; } + } +} diff --git a/Tizen.Applications/Tizen.Applications/Application.cs b/Tizen.Applications/Tizen.Applications/Application.cs index fd8a5d9..f9b09b0 100755 --- a/Tizen.Applications/Tizen.Applications/Application.cs +++ b/Tizen.Applications/Tizen.Applications/Application.cs @@ -12,7 +12,7 @@ using System; namespace Tizen.Applications { /// - /// + /// The Application handles an application state change or system events and provides mechanisms that launch other applications. /// public abstract class Application { @@ -22,12 +22,12 @@ namespace Tizen.Applications private Interop.AppEvent.SafeAppEventHandle _localeChangedNativeHandle; /// - /// + /// The low memory event. /// public event EventHandler LowMemory; /// - /// + /// The system language changed event. /// public event EventHandler LocaleChanged; @@ -42,7 +42,7 @@ namespace Tizen.Applications public ApplicationInfo ApplicationInfo { get; internal set; } /// - /// + /// Runs the application's main loop. /// /// public virtual void Run(string[] args) @@ -54,27 +54,36 @@ namespace Tizen.Applications } /// - /// + /// Exits the main loop of application. /// public abstract void Exit(); - internal void SendCreate() - { - ApplicationInfo = new ApplicationInfo(); - OnCreate(); - } + /// + /// + /// protected virtual void OnCreate() { } + /// + /// + /// protected virtual void OnTerminate() { } + /// + /// + /// + /// protected virtual void OnStart(AppControl control) { } + /// + /// + /// + /// protected virtual void OnLowMemory(LowMemoryEventArgs e) { EventHandler eh = LowMemory; @@ -84,6 +93,10 @@ namespace Tizen.Applications } } + /// + /// + /// + /// protected virtual void OnLocaleChanged(LocaleChangedEventArgs e) { EventHandler eh = LocaleChanged; @@ -93,6 +106,12 @@ namespace Tizen.Applications } } + internal void SendCreate() + { + ApplicationInfo = new ApplicationInfo(); + OnCreate(); + } + private void HandleAppEvent(string eventName, IntPtr eventData, IntPtr data) { Bundle b = new Bundle(eventData); diff --git a/Tizen.Applications/Tizen.Applications/ApplicationInfo.cs b/Tizen.Applications/Tizen.Applications/ApplicationInfo.cs index 4122d7e..f30f1db 100755 --- a/Tizen.Applications/Tizen.Applications/ApplicationInfo.cs +++ b/Tizen.Applications/Tizen.Applications/ApplicationInfo.cs @@ -138,6 +138,9 @@ namespace Tizen.Applications } + /// + /// + /// public class SharedPaths { internal SharedPaths() { } @@ -175,6 +178,9 @@ namespace Tizen.Applications } } + /// + /// + /// public class ExternalPaths { internal ExternalPaths() { } diff --git a/Tizen.Applications/Tizen.Applications/LocaleChangedEventArgs.cs b/Tizen.Applications/Tizen.Applications/LocaleChangedEventArgs.cs index 19cc970..c044398 100755 --- a/Tizen.Applications/Tizen.Applications/LocaleChangedEventArgs.cs +++ b/Tizen.Applications/Tizen.Applications/LocaleChangedEventArgs.cs @@ -6,8 +6,14 @@ using System.Threading.Tasks; namespace Tizen.Applications { + /// + /// + /// public class LocaleChangedEventArgs { + /// + /// + /// public string Locale { get; internal set; } } } diff --git a/Tizen.Applications/Tizen.Applications/LowMemoryEventArgs.cs b/Tizen.Applications/Tizen.Applications/LowMemoryEventArgs.cs index 5f172f4..44c222e 100755 --- a/Tizen.Applications/Tizen.Applications/LowMemoryEventArgs.cs +++ b/Tizen.Applications/Tizen.Applications/LowMemoryEventArgs.cs @@ -15,8 +15,14 @@ using System.Threading.Tasks; namespace Tizen.Applications { + /// + /// + /// public class LowMemoryEventArgs : EventArgs { + /// + /// + /// public LowMemoryStatus LowMemoryStatus { get; internal set; } } } diff --git a/Tizen.Applications/Tizen.Applications/UIApplication.cs b/Tizen.Applications/Tizen.Applications/UIApplication.cs index 0e605dc..e80dfca 100755 --- a/Tizen.Applications/Tizen.Applications/UIApplication.cs +++ b/Tizen.Applications/Tizen.Applications/UIApplication.cs @@ -64,10 +64,16 @@ namespace Tizen.Applications Interop.Application.Exit(); } + /// + /// + /// protected virtual void OnResume() { } + /// + /// + /// protected virtual void OnPause() { } -- 2.7.4