Refactor to simple model
authorWonYoung Choi <wy80.choi@samsung.com>
Tue, 22 Mar 2016 07:44:00 +0000 (16:44 +0900)
committerWonYoung Choi <wy80.choi@samsung.com>
Tue, 22 Mar 2016 11:14:42 +0000 (20:14 +0900)
Change-Id: I09342b8e55b77389c00e8fd7874768a1ede5aa89

30 files changed:
.gitignore
AppFW.sln
Tizen.Applications/Interop/Interop.AppCommon.cs [moved from Tizen.Applications/Tizen.Applications/ServiceController.cs with 71% similarity]
Tizen.Applications/Interop/Interop.AppControl.cs
Tizen.Applications/Interop/Interop.AppEvent.cs [new file with mode: 0755]
Tizen.Applications/Interop/Interop.Application.cs
Tizen.Applications/Interop/Interop.Aul.cs [deleted file]
Tizen.Applications/Interop/Interop.Libraries.cs [changed mode: 0644->0755]
Tizen.Applications/Interop/Interop.Service.cs [new file with mode: 0755]
Tizen.Applications/Interop/Interop.Window.cs [deleted file]
Tizen.Applications/Tizen.Applications.csproj [changed mode: 0644->0755]
Tizen.Applications/Tizen.Applications/AppControlEventArgs.cs [new file with mode: 0755]
Tizen.Applications/Tizen.Applications/AppControlFilter.cs [deleted file]
Tizen.Applications/Tizen.Applications/Application.cs
Tizen.Applications/Tizen.Applications/ApplicationInfo.cs [new file with mode: 0755]
Tizen.Applications/Tizen.Applications/Bundle.cs [changed mode: 0644->0755]
Tizen.Applications/Tizen.Applications/Context.cs [deleted file]
Tizen.Applications/Tizen.Applications/Controller.cs [deleted file]
Tizen.Applications/Tizen.Applications/LocaleChangedEventArgs.cs [moved from Tizen.UI/Tizen.UI/Window.cs with 52% similarity]
Tizen.Applications/Tizen.Applications/LowMemoryEventArgs.cs [moved from Tizen.Applications/Tizen.UI/Page.cs with 76% similarity]
Tizen.Applications/Tizen.Applications/LowMemoryStatus.cs [new file with mode: 0755]
Tizen.Applications/Tizen.Applications/ServiceApplication.cs [new file with mode: 0755]
Tizen.Applications/Tizen.Applications/TizenSynchronizationContext.cs
Tizen.Applications/Tizen.Applications/UIApplication.cs [new file with mode: 0755]
Tizen.Applications/Tizen.Applications/UIController.cs [deleted file]
Tizen.Applications/Tizen.UI/IUIContext.cs [deleted file]
Tizen.Applications/Tizen.UI/Window.cs [deleted file]
Tizen.UI/Properties/AssemblyInfo.cs [deleted file]
Tizen.UI/Tizen.UI.csproj [deleted file]
packaging/csapi-application.spec

index 8fd3218..1b085dd 100644 (file)
@@ -3,3 +3,4 @@ obj/
 *.exe
 *.dll
 .vs/
+Test/
index a7f4b55..b31afed 100755 (executable)
--- a/AppFW.sln
+++ b/AppFW.sln
@@ -5,6 +5,12 @@ VisualStudioVersion = 14.0.24720.0
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications", "Tizen.Applications\Tizen.Applications.csproj", "{663C5A3D-E631-4987-AEE7-F498C56A40FC}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen", "..\tizen\Tizen\Tizen.csproj", "{7659CA59-410D-41A1-9841-586E88BC78C9}"
+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
@@ -15,6 +21,18 @@ Global
                {663C5A3D-E631-4987-AEE7-F498C56A40FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {663C5A3D-E631-4987-AEE7-F498C56A40FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {663C5A3D-E631-4987-AEE7-F498C56A40FC}.Release|Any CPU.Build.0 = Release|Any CPU
+               {7659CA59-410D-41A1-9841-586E88BC78C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {7659CA59-410D-41A1-9841-586E88BC78C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {7659CA59-410D-41A1-9841-586E88BC78C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {7659CA59-410D-41A1-9841-586E88BC78C9}.Release|Any CPU.Build.0 = Release|Any CPU
+               {B9AA1CB2-F72D-4A30-A33B-A20C850A38A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {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
@@ -8,13 +8,14 @@
 
 
 using System;
+using System.Runtime.InteropServices;
 
-namespace Tizen.Applications
+using Tizen.Internals.Errors;
+
+internal static partial class Interop
 {
-    /// <summary>
-    /// 
-    /// </summary>
-    public abstract class ServiceController : Controller
+    internal static partial class AppCommon
     {
     }
 }
+
index 84ff6c9..90595e7 100755 (executable)
@@ -14,22 +14,25 @@ internal static partial class Interop
 {
     internal static partial class AppControl
     {
-        [DllImport(Libraries.Application, EntryPoint = "app_control_create")]
+        [DllImport(Libraries.AppControl, EntryPoint = "app_control_create")]
         internal static extern int Create(out SafeAppControlHandle handle);
 
-        [DllImport(Libraries.Application, EntryPoint = "app_control_get_app_id", CallingConvention = CallingConvention.Cdecl)]
+        [DllImport(Libraries.AppControl, EntryPoint = "app_control_clone")]
+        internal static extern int Clone(out SafeAppControlHandle clone, SafeAppControlHandle handle);
+
+        [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.Application, EntryPoint = "app_control_get_operation", CallingConvention = CallingConvention.Cdecl)]
+        [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_operation", CallingConvention = CallingConvention.Cdecl)]
         internal static extern int GetOperation(SafeAppControlHandle handle, out string operation);
 
-        [DllImport(Libraries.Application, EntryPoint = "app_control_get_uri", CallingConvention = CallingConvention.Cdecl)]
+        [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_uri", CallingConvention = CallingConvention.Cdecl)]
         internal static extern int GetUri(SafeAppControlHandle handle, out string uri);
 
-        [DllImport(Libraries.Application, EntryPoint = "app_control_get_mime", CallingConvention = CallingConvention.Cdecl)]
+        [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_mime", CallingConvention = CallingConvention.Cdecl)]
         internal static extern int GetMime(SafeAppControlHandle handle, out string mime);
 
-        [DllImport(Libraries.Application, EntryPoint = "app_control_destroy", CallingConvention = CallingConvention.Cdecl)]
+        [DllImport(Libraries.AppControl, EntryPoint = "app_control_destroy", CallingConvention = CallingConvention.Cdecl)]
         private static extern int DangerousDestroy(IntPtr handle);
 
         internal sealed class SafeAppControlHandle : SafeHandle
diff --git a/Tizen.Applications/Interop/Interop.AppEvent.cs b/Tizen.Applications/Interop/Interop.AppEvent.cs
new file mode 100755 (executable)
index 0000000..53c6c7b
--- /dev/null
@@ -0,0 +1,72 @@
+/// 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;
+
+using Tizen.Internals.Errors;
+
+internal static partial class Interop
+{
+    internal static partial class AppEvent
+    {
+        internal delegate void AppEventCallback(string eventName, IntPtr bundle, IntPtr data);
+
+        [DllImport(Libraries.AppEvent, EntryPoint = "event_add_event_handler")]
+        internal static extern ErrorCode AddEventHandler(string eventName, AppEventCallback callback, IntPtr data, out SafeAppEventHandle eventHandler);
+
+        [DllImport(Libraries.AppEvent, EntryPoint = "event_remove_event_handler")]
+        internal static extern ErrorCode DangerousRemoveEventHandler(IntPtr eventHandler);
+
+        [DllImport(Libraries.AppEvent, EntryPoint = "event_publish_app_event")]
+        internal static extern ErrorCode Publish(string eventName, IntPtr bundle);
+
+        [DllImport(Libraries.AppEvent, EntryPoint = "event_publish_trusted_app_event")]
+        internal static extern ErrorCode PublishTrusted(string eventName, IntPtr bundle);
+
+        internal sealed class SafeAppEventHandle : SafeHandle
+        {
+            public SafeAppEventHandle() : base(IntPtr.Zero, true)
+            {
+            }
+
+            public override bool IsInvalid
+            {
+                get { return handle == IntPtr.Zero; }
+            }
+
+            protected override bool ReleaseHandle()
+            {
+                DangerousRemoveEventHandler(handle);
+                SetHandle(IntPtr.Zero);
+                return true;
+            }
+        }
+
+        internal class EventNames
+        {
+            internal const string LowMemory = "tizen.system.event.low_memory";
+            internal const string LanguageSet = "tizen.system.event.language_set";
+        }
+
+        internal class EventKeys
+        {
+            internal const string LowMemory = "low_memory";
+            internal const string LanguageSet = "language_set";
+        }
+
+        internal class EventValues
+        {
+            internal const string MemoryNormal = "normal";
+            internal const string MemorySoftWarning = "soft_warning";
+            internal const string MemoryHardWarning = "hard_warning";
+        }
+    }
+}
+
index bbb04fe..d155754 100755 (executable)
@@ -14,26 +14,21 @@ internal static partial class Interop
 {
     internal static partial class Application
     {
-        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         internal delegate bool AppCreateCallback(IntPtr userData);
 
-        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         internal delegate void AppPauseCallback(IntPtr userData);
 
-        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         internal delegate void AppResumeCallback(IntPtr userData);
 
-        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         internal delegate void AppTerminateCallback(IntPtr userData);
 
-        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         internal delegate void AppControlCallback(IntPtr appControl, IntPtr userData);
 
-        [DllImport(Libraries.Application, EntryPoint = "ui_app_main", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern int UIAppMain(int argc, string[] argv, ref UIAppLifecycleCallbacks callback, IntPtr userData);
+        [DllImport(Libraries.Application, EntryPoint = "ui_app_main")]
+        internal static extern int Main(int argc, string[] argv, ref UIAppLifecycleCallbacks callback, IntPtr userData);
 
-        [DllImport(Libraries.Application, EntryPoint = "ui_app_exit", CallingConvention = CallingConvention.Cdecl)]
-        internal static extern void UIAppExit();
+        [DllImport(Libraries.Application, EntryPoint = "ui_app_exit")]
+        internal static extern void Exit();
 
         [StructLayoutAttribute(LayoutKind.Sequential)]
         internal struct UIAppLifecycleCallbacks
@@ -46,3 +41,4 @@ internal static partial class Interop
         }
     }
 }
+
diff --git a/Tizen.Applications/Interop/Interop.Aul.cs b/Tizen.Applications/Interop/Interop.Aul.cs
deleted file mode 100755 (executable)
index 0100d72..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/// 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.Runtime.InteropServices;
-using System.Text;
-
-internal static partial class Interop
-{
-    internal static partial class Aul
-    {
-        private const int MaxMimeLength = 128;
-        private const string FileSchemaPrefix = "file://";
-
-        internal static string GetMimeFromUri(string uri)
-        {
-            StringBuilder sb = new StringBuilder(MaxMimeLength);
-            int err = aul_get_mime_from_file(uri.StartsWith(FileSchemaPrefix) ? uri.Substring(FileSchemaPrefix.Length) : uri, sb, MaxMimeLength);
-            if (err == 0)
-            {
-                return sb.ToString();
-            }
-            else
-            {
-                return null;
-            }
-        }
-
-        [DllImport(Libraries.Aul, CallingConvention = CallingConvention.Cdecl)]
-        private static extern int aul_get_mime_from_file(string filename, StringBuilder mimetype, int len);
-    }
-}
old mode 100644 (file)
new mode 100755 (executable)
index f7a4aa0..5ce88c4
@@ -10,11 +10,12 @@ internal static partial class Interop
 {
     internal static partial class Libraries
     {
-        public const string Aul = "libaul.so.0";
         public const string Application = "libcapi-appfw-application.so.0";
+        public const string AppCommon = "libcapi-appfw-app-common.so.0";
+        public const string AppControl = "libcapi-appfw-app-control.so.0";
+        public const string AppEvent = "libcapi-appfw-event.so.0";
+        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 Elementary = "libelementary.so.1";
-        public const string Evas = "libevas.so.1";
     }
 }
diff --git a/Tizen.Applications/Interop/Interop.Service.cs b/Tizen.Applications/Interop/Interop.Service.cs
new file mode 100755 (executable)
index 0000000..2fdacea
--- /dev/null
@@ -0,0 +1,39 @@
+/// 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;
+
+using Tizen.Internals.Errors;
+
+internal static partial class Interop
+{
+    internal static partial class Service
+    {
+        internal delegate bool ServiceAppCreateCallback(IntPtr userData);
+
+        internal delegate void ServiceAppTerminateCallback(IntPtr userData);
+
+        internal delegate void ServiceAppControlCallback(IntPtr appControl, IntPtr userData);
+
+        [DllImport(Libraries.AppcoreAgent, EntryPoint = "service_app_main")]
+        internal static extern int Main(int argc, string[] argv, ref ServiceAppLifecycleCallbacks callback, IntPtr userData);
+
+        [DllImport(Libraries.AppcoreAgent, EntryPoint = "service_app_exit")]
+        internal static extern void Exit();
+
+        [StructLayoutAttribute(LayoutKind.Sequential)]
+        internal struct ServiceAppLifecycleCallbacks
+        {
+            public ServiceAppCreateCallback OnCreate;
+            public ServiceAppTerminateCallback OnTerminate;
+            public ServiceAppControlCallback OnAppControl;
+        }
+    }
+}
diff --git a/Tizen.Applications/Interop/Interop.Window.cs b/Tizen.Applications/Interop/Interop.Window.cs
deleted file mode 100755 (executable)
index 30e8bd9..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-
-internal static partial class Interop
-{
-    internal static partial class Window
-    {
-        [DllImport(Libraries.Elementary, CallingConvention = CallingConvention.Cdecl)]
-        internal static extern IntPtr elm_win_add(IntPtr parent, string name, int type);
-
-        [DllImport(Libraries.Evas, CallingConvention = CallingConvention.Cdecl)]
-        internal static extern void evas_object_show(IntPtr obj);
-
-        [DllImport(Libraries.Evas, CallingConvention = CallingConvention.Cdecl)]
-        internal static extern void evas_object_hide(IntPtr obj);
-
-        [DllImport(Libraries.Evas, CallingConvention = CallingConvention.Cdecl)]
-        internal static extern bool evas_object_visible_get(IntPtr obj);
-
-        [DllImport(Libraries.Evas, CallingConvention = CallingConvention.Cdecl)]
-        internal static extern void evas_object_unref(IntPtr obj);
-
-        [DllImport(Libraries.Elementary, CallingConvention = CallingConvention.Cdecl)]
-        internal static extern void elm_win_activate(IntPtr obj);
-
-        [DllImport(Libraries.Elementary, CallingConvention = CallingConvention.Cdecl)]
-        internal static extern void elm_win_lower(IntPtr obj);
-    }
-}
old mode 100644 (file)
new mode 100755 (executable)
index ffb1e57..3536789
     <Reference Include="System.Net.Http" />
     <Reference Include="System.Xml" />
     <Reference Include="Tizen.Internals">
-      <HintPath>..\..\tizen\Tizen.Internals\bin\Debug\Tizen.Internals.dll</HintPath>
+      <HintPath>..\..\tizen\Tizen.Internals\obj\Debug\Tizen.Internals.dll</HintPath>
     </Reference>
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Interop\Interop.AppCommon.cs" />
     <Compile Include="Interop\Interop.AppControl.cs" />
+    <Compile Include="Interop\Interop.AppEvent.cs" />
     <Compile Include="Interop\Interop.Application.cs" />
-    <Compile Include="Interop\Interop.Aul.cs" />
     <Compile Include="Interop\Interop.Bundle.cs" />
     <Compile Include="Interop\Interop.Glib.cs" />
     <Compile Include="Interop\Interop.Libraries.cs" />
-    <Compile Include="Interop\Interop.Window.cs" />
+    <Compile Include="Interop\Interop.Service.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="Tizen.Applications\Context.cs" />
-    <Compile Include="Tizen.Applications\UIController.cs" />
+    <Compile Include="Tizen.Applications\AppControlEventArgs.cs" />
+    <Compile Include="Tizen.Applications\ApplicationInfo.cs" />
+    <Compile Include="Tizen.Applications\LocaleChangedEventArgs.cs" />
+    <Compile Include="Tizen.Applications\LowMemoryEventArgs.cs" />
+    <Compile Include="Tizen.Applications\LowMemoryStatus.cs" />
+    <Compile Include="Tizen.Applications\ServiceApplication.cs" />
+    <Compile Include="Tizen.Applications\UIApplication.cs" />
     <Compile Include="Tizen.Applications\AppControl.cs" />
-    <Compile Include="Tizen.Applications\AppControlFilter.cs" />
     <Compile Include="Tizen.Applications\Application.cs" />
     <Compile Include="Tizen.Applications\Bundle.cs" />
-    <Compile Include="Tizen.Applications\Controller.cs" />
-    <Compile Include="Tizen.Applications\ServiceController.cs" />
-    <Compile Include="Tizen.UI\IUIContext.cs" />
-    <Compile Include="Tizen.UI\Page.cs" />
-    <Compile Include="Tizen.UI\Window.cs" />
     <Compile Include="Tizen.Applications\TizenSynchronizationContext.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="Tizen.Applications.snk" />
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\tizen\Tizen\Tizen.csproj">
+      <Project>{7659ca59-410d-41a1-9841-586e88bc78c9}</Project>
+      <Name>Tizen</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
        Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/Tizen.Applications/Tizen.Applications/AppControlEventArgs.cs b/Tizen.Applications/Tizen.Applications/AppControlEventArgs.cs
new file mode 100755 (executable)
index 0000000..dd735b1
--- /dev/null
@@ -0,0 +1,13 @@
+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/AppControlFilter.cs b/Tizen.Applications/Tizen.Applications/AppControlFilter.cs
deleted file mode 100755 (executable)
index 01e5c6a..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/// 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.Text.RegularExpressions;
-
-namespace Tizen.Applications
-{
-    /// <summary>
-    /// 
-    /// </summary>
-    [AttributeUsage(AttributeTargets.Class)]
-    public class AppControlFilter : Attribute
-    {
-        private readonly string _operation;
-        private readonly string _mime;
-        private readonly string _uri;
-
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="operation"></param>
-        /// <param name="mime"></param>
-        /// <param name="uri"></param>
-        public AppControlFilter(string operation, string mime = null, string uri = null)
-        {
-            _operation = operation;
-            _mime = mime;
-            _uri = uri;
-        }
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public string Operation { get { return _operation; } }
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public string Mime { get { return _mime; } }
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public string Uri { get { return _uri; } }
-
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="obj"></param>
-        /// <returns></returns>
-        public override bool Equals(object obj)
-        {
-            AppControlFilter f = obj as AppControlFilter;
-            if (f == null) return false;
-            
-            return (_operation == f._operation) & (_mime == f._mime) & (_uri == f._uri);
-        }
-
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <returns></returns>
-        public override int GetHashCode()
-        {
-            int hash = 0;
-            if (_operation != null)
-            {
-                hash ^= _operation.GetHashCode();
-            }
-            if (_mime != null)
-            {
-                hash ^= _mime.GetHashCode();
-            }
-            if (_uri != null)
-            {
-                hash ^= _uri.GetHashCode();
-            }
-            return hash;
-        }
-
-        internal bool IsMatch(AppControl e)
-        {
-            string mime = e.Mime;
-            if (String.IsNullOrEmpty(mime) && !String.IsNullOrEmpty(e.Uri))
-            {
-                mime = Interop.Aul.GetMimeFromUri(e.Uri);
-            }
-            return _operation == e.Operation && IsMimeMatched(mime) && IsUriMatched(e.Uri);
-        }
-
-        private bool IsMimeMatched(string mime)
-        {
-            if (_mime == "*" || _mime == "*/*")
-            {
-                return true;
-            }
-            if (String.IsNullOrEmpty(_mime))
-            {
-                return String.IsNullOrEmpty(mime);
-            }
-            Regex pat = new Regex(_mime.Replace("*", ".*"));
-            return pat.IsMatch(mime);
-        }
-
-        private bool IsUriMatched(string uri)
-        {
-            if (_uri == "*")
-            {
-                return true;
-            }
-            if (String.IsNullOrEmpty(_uri))
-            {
-                return String.IsNullOrEmpty(uri);
-            }
-            string schema = _uri.Split(':')[0];
-            if (schema == _uri || _uri.EndsWith("://") || _uri.EndsWith("://*"))
-            {
-                return schema == uri.Split(':')[0];
-            }
-            if (_uri.EndsWith("*"))
-            {
-                return uri.StartsWith(_uri.Substring(0, _uri.Length - 1));
-            }
-            return _uri == uri;
-        }
-    }
-}
index a926fb3..a35894a 100755 (executable)
 
 
 using System;
-using System.Collections.Generic;
-using System.Linq;
-
-using Tizen.UI;
 
 namespace Tizen.Applications
 {
     /// <summary>
-    /// Provides static methods and properties to manage an application, such as methods to register Actors and Services, 
-    /// to start an application.
+    /// 
     /// </summary>
-    public static class Application
+    public abstract class Application
     {
-        private static readonly Dictionary<AppControlFilter, Type> s_filterMap = new Dictionary<AppControlFilter, Type>();
-        private static readonly List<ServiceController> s_serviceControllerList = new List<ServiceController>();
-        private static readonly UIControllerStack s_uiControllerStack = new UIControllerStack();
-        private static Window s_defaultWindow = null;
+        private static Application s_CurrentApplication = null;
 
-        /// <summary>
-        /// Occurs when the application starts.
-        /// </summary>
-        public static event EventHandler Created = delegate { };
+        private Interop.AppEvent.SafeAppEventHandle _lowMemoryNativeHandle;
+        private Interop.AppEvent.SafeAppEventHandle _localeChangedNativeHandle;
 
         /// <summary>
-        /// Occurs when the application's main loop exits.
+        /// 
         /// </summary>
-        public static event EventHandler Exited = delegate { };
-
-        private static UIController Foreground
-        {
-            get
-            {
-                return s_uiControllerStack.Peek();
-            }
-        }
+        public event EventHandler<LowMemoryEventArgs> LowMemory;
 
         /// <summary>
-        /// Runs the application's main loop.
+        /// 
         /// </summary>
-        /// <param name="args">The command-line arguments</param>
-        public static void Run(string[] args)
-        {
-            Interop.Application.UIAppLifecycleCallbacks ops;
-            ops.OnCreate = (userData) =>
-            {
-                Created(null, EventArgs.Empty);
-                return true;
-            };
-            ops.OnPause = (userData) =>
-            {
-                if (Foreground != null)
-                {
-                    Foreground.SendPause();
-                }
-            };
-            ops.OnResume = (userData) =>
-            {
-                if (Foreground != null)
-                {
-                    Foreground.SendResume();
-                }
-            };
-            ops.OnAppControl = (appControlHandle, userData) =>
-            {
-                AppControl control = new AppControl(appControlHandle);
-                StartController(null, null, control, Controller.ControlFlags.NewInstance);
-            };
-            ops.OnTerminate = (userData) =>
-            {
-                Exit();
-            };
-
-            TizenSynchronizationContext.Initialize();
-
-            // TODO: check ret of UIAppMain and throw exceptions when errors are returned.
-            Interop.Application.UIAppMain(args.Length, args, ref ops, IntPtr.Zero);
-        }
+        public event EventHandler<LocaleChangedEventArgs> LocaleChanged;
 
         /// <summary>
-        /// Exits the main loop of application.
+        /// 
         /// </summary>
-        public static void Exit()
-        {
-            Exited(null, null);
-            // TODO: clear context and group
-            Interop.Application.UIAppExit();
-        }
+        public static Application Current { get { return s_CurrentApplication; } }
 
         /// <summary>
         /// 
         /// </summary>
-        /// <param name="controllerType"></param>
-        public static void RegisterController(Type controllerType)
-        {
-            RegisterController(controllerType, new AppControlFilter[0] { });
-        }
+        public ApplicationInfo ApplicationInfo { get; internal set; }
 
         /// <summary>
         /// 
         /// </summary>
-        /// <param name="controllerType"></param>
-        /// <param name="filter"></param>
-        public static void RegisterController(Type controllerType, AppControlFilter filter)
+        /// <param name="args"></param>
+        public virtual void Run(string[] args)
         {
-            RegisterController(controllerType, new AppControlFilter[] { filter });
+            s_CurrentApplication = this;
+
+            Interop.AppEvent.AddEventHandler(Interop.AppEvent.EventNames.LowMemory, HandleAppEvent, IntPtr.Zero, out _lowMemoryNativeHandle);
+            Interop.AppEvent.AddEventHandler(Interop.AppEvent.EventNames.LowMemory, HandleAppEvent, IntPtr.Zero, out _localeChangedNativeHandle);
         }
 
         /// <summary>
         /// 
         /// </summary>
-        /// <param name="controllerType"></param>
-        /// <param name="filters"></param>
-        public static void RegisterController(Type controllerType, AppControlFilter[] filters)
-        {
-            if (controllerType == null)
-            {
-                throw new ArgumentNullException("controllerType");
-            }
-
-            if (!controllerType.IsSubclassOf(typeof(UIController)) || !controllerType.IsSubclassOf(typeof(ServiceController)))
-            {                
-                throw new ArgumentException(controllerType.FullName + " is not a sub class of UIController or ServiceController.", "controllerType");
-            }
+        public abstract void Exit();
 
-            foreach (var prop in controllerType.GetProperties())
-            {
-                foreach (var attr in prop.GetCustomAttributes(false))
-                {
-                    var filter = attr as AppControlFilter;
-                    if (filter != null)
-                    {
-                        s_filterMap.Add(filter, controllerType);
-                    }
-                }
-            }
-            if (filters != null)
-            {
-                foreach (var filter in filters)
-                {
-                    s_filterMap.Add(filter, controllerType);
-                }
-            }
-        }
-        
-        internal static void StartController(Controller caller, Type controllerType, AppControl control, Controller.ControlFlags flags)
+        protected virtual void OnCreate()
         {
-            if (control == null)
-            {
-                throw new ArgumentNullException("control");
-            }
-
-            if (controllerType == null)
-            {
-                controllerType = FindControllerInFilterMap(control);
-                if (controllerType == null)
-                {
-                    throw new ArgumentException("Could not find any matched controller.", "controllerType");
-                }
-            }
-
-            if (controllerType.IsSubclassOf(typeof(UIController)))
-            {
-                UIController target = null;
-                UIController uiCaller = caller as UIController;
-                if (uiCaller != null && uiCaller != Foreground)
-                {
-                    throw new InvalidOperationException("Starting UIController should be called from the foreground.");
-                }
-                if (uiCaller != null && !IsFlagSet(flags, Controller.ControlFlags.NewInstance))
-                {
-                    target = s_uiControllerStack.FindInForegroundTask(controllerType);
-                }
-
-
-                if (s_defaultWindow == null)
-                {
-                    s_defaultWindow = new Window();
-                }
-
-                if (!s_defaultWindow.Visible)
-                {
-                    s_defaultWindow.Active();
-                    s_defaultWindow.Show();
-                }
-
-                if (target == null)
-                {
-                    target = (UIController)Activator.CreateInstance(controllerType);
-                    target.TaskId = uiCaller == null ? Guid.NewGuid() : uiCaller.TaskId;
-                    target.Window = s_defaultWindow;
-                    target.SendCreate();
-                    s_uiControllerStack.Push(target);
-                }
-                else
-                {
-                    if (IsFlagSet(flags, Controller.ControlFlags.ClearTop))
-                    {
-                        while (target != Foreground)
-                        {
-                            UIController popped = s_uiControllerStack.Pop();
-                            popped.SendPause();
-                            popped.SendDestroy();
-                        }
-                    }
-                    else if (IsFlagSet(flags, Controller.ControlFlags.MoveToTop))
-                    {
-                        if (Foreground != target)
-                        {
-                            Foreground.SendPause();
-                            s_uiControllerStack.MoveToTop(target);
-                        }
-                    }
-                }
-                Foreground.SendStart(control);
-                Foreground.SendResume();
-            }
-            else if (controllerType.IsSubclassOf(typeof(ServiceController)))
-            {
-                ServiceController svc = s_serviceControllerList.Find(s => s.GetType() == controllerType);
-                if (svc == null)
-                {
-                    svc = (ServiceController)Activator.CreateInstance(controllerType);
-                    s_serviceControllerList.Add(svc);
-                    svc.SendCreate();
-                }
-                svc.SendStart(control);
-            }
-            else
-            {
-                throw new ArgumentException("Invalid controller type.", "controllerType");
-            }
         }
 
-        internal static void StopController(UIController target)
+        protected virtual void OnTerminate()
         {
-            if (Foreground == null)
-            {
-                throw new InvalidOperationException("The UIController stack is empty.");
-            }
+        }
 
-            Guid prevForegroundTaskId = Foreground.TaskId;
+        protected virtual void OnStart(AppControl control)
+        {
+        }
 
-            s_uiControllerStack.Remove(target);
-            target.SendPause();
-            target.SendDestroy();
-            if (target.TaskId == prevForegroundTaskId)
+        protected virtual void OnLowMemory(LowMemoryEventArgs e)
+        {
+            EventHandler<LowMemoryEventArgs> eh = LowMemory;
+            if (eh != null)
             {
-                if (Foreground.TaskId == target.TaskId)
-                {
-                    Foreground.SendResume();
-                }
-                else
-                {
-                    if (s_uiControllerStack.Count == 0 && s_serviceControllerList.Count == 0)
-                    {
-                        Exit();
-                    }
-                    else
-                    {
-                        s_defaultWindow.Hide();
-                    }
-                }
+                eh(this, e);
             }
         }
 
-        internal static void StopController(Type controllerType)
+        protected virtual void OnLocaleChanged(LocaleChangedEventArgs e)
         {
-            if (controllerType.IsSubclassOf(typeof(UIController)))
-            {                
-                UIController target = s_uiControllerStack.Find(controllerType);
-                if (target == null)
-                {
-                    throw new InvalidOperationException("Could not find the UIController to stop.");
-                }
-                StopController(target);
-            }
-            else if (controllerType.IsSubclassOf(typeof(ServiceController)))
+            EventHandler<LocaleChangedEventArgs> eh = LocaleChanged;
+            if (eh != null)
             {
-                ServiceController svc = s_serviceControllerList.Find(s => s.GetType() == controllerType);
-                if (svc != null)
-                {
-                    svc.SendDestroy();
-                    s_serviceControllerList.Remove(svc);
-                    if (s_uiControllerStack.Count == 0 && s_serviceControllerList.Count == 0)
-                    {
-                        Exit();
-                    }
-                }
+                eh(this, e);
             }
         }
-        
-        private static Type FindControllerInFilterMap(AppControl control)
-        {            
-            foreach (var item in s_filterMap)
-            {
-                if (item.Key.IsMatch(control))
-                {
-                    return item.Value;
-                }
-            }
-            return null;
-        }
-        
-        private static bool IsFlagSet(Controller.ControlFlags flags, Controller.ControlFlags values)
-        {
-            return (values & flags) == values;
-        }
 
-
-        private class UIControllerStack
+        private void HandleAppEvent(string eventName, IntPtr eventData, IntPtr data)
         {
-            private readonly List<UIController> _uiControllerList;
-
-            public int Count
+            Bundle b = new Bundle(eventData);
+            if (eventName == Interop.AppEvent.EventNames.LowMemory)
             {
-                get
+                string value = b.GetItem<string>(Interop.AppEvent.EventKeys.LowMemory);
+                LowMemoryStatus status = LowMemoryStatus.Normal;
+                if (value == Interop.AppEvent.EventValues.MemorySoftWarning)
                 {
-                    return _uiControllerList.Count;
+                    status = LowMemoryStatus.SoftWarning;
                 }
+                else if (value == Interop.AppEvent.EventValues.MemoryHardWarning)
+                {
+                    status = LowMemoryStatus.HardWarning;
+                }
+                OnLowMemory(new LowMemoryEventArgs { LowMemoryStatus = status });
             }
-
-            public UIControllerStack()
-            {
-                _uiControllerList = new List<UIController>();
-            }
-
-            public UIController Peek()
-            {
-                return _uiControllerList.LastOrDefault(null);
-            }
-
-            public void Push(UIController item)
-            {
-                _uiControllerList.Add(item);
-            }
-
-            public UIController Pop()
-            {
-                UIController last = Peek();
-                _uiControllerList.Remove(last);
-                return last;
-            }
-
-            public void Remove(UIController actor)
-            {
-                _uiControllerList.Remove(actor);
-            }
-
-            public UIController Find(Type controllerType)
-            {
-                return _uiControllerList.Find(s => s.GetType() == controllerType);
-            }
-
-            public UIController FindInForegroundTask(Type controllerType)
-            {
-                return _uiControllerList.Find(s => s.GetType() == controllerType && s.TaskId == Peek().TaskId);
-            }
-
-            public void MoveToTop(UIController actor)
+            else if (eventName == Interop.AppEvent.EventNames.LanguageSet)
             {
-                _uiControllerList.Remove(actor);
-                _uiControllerList.Add(actor);
+                string value = b.GetItem<string>(Interop.AppEvent.EventKeys.LanguageSet);
+                OnLocaleChanged(new LocaleChangedEventArgs { Locale = value });
             }
         }
     }
diff --git a/Tizen.Applications/Tizen.Applications/ApplicationInfo.cs b/Tizen.Applications/Tizen.Applications/ApplicationInfo.cs
new file mode 100755 (executable)
index 0000000..f939bc6
--- /dev/null
@@ -0,0 +1,33 @@
+/// 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.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tizen.Applications
+{
+    /// <summary>
+    /// 
+    /// </summary>
+    public class ApplicationInfo
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        public string Id { get; internal set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string Name { get; internal set; }
+    }
+}
old mode 100644 (file)
new mode 100755 (executable)
index b47d5c1..2d6a71c
@@ -237,30 +237,30 @@ namespace Tizen.Applications
                 switch (type)
                 {
                     case (int)BundleType.String:
-                    // get string
-                    IntPtr stringPtr;
-                    Interop.Bundle.GetString(_handle, key, out stringPtr);
-                    return Marshal.PtrToStringAuto(stringPtr);
+                        // get string
+                        IntPtr stringPtr;
+                        Interop.Bundle.GetString(_handle, key, out stringPtr);
+                        return Marshal.PtrToStringAuto(stringPtr);
 
                     case (int)BundleType.StringArray:
-                    // get string array
-                    int stringArraySize;
-                    IntPtr stringArrayPtr = Interop.Bundle.GetStringArray(_handle, key, out stringArraySize);
-                    string[] stringArray;
-                    IntPtrToStringArray(stringArrayPtr, stringArraySize, out stringArray);
-                    return stringArray;
+                        // get string array
+                        int stringArraySize;
+                        IntPtr stringArrayPtr = Interop.Bundle.GetStringArray(_handle, key, out stringArraySize);
+                        string[] stringArray;
+                        IntPtrToStringArray(stringArrayPtr, stringArraySize, out stringArray);
+                        return stringArray;
 
                     case (int)BundleType.Byte:
-                    // get byte array
-                    IntPtr byteArrayPtr;
-                    int byteArraySize;
-                    Interop.Bundle.GetByte(_handle, key, out byteArrayPtr, out byteArraySize);
-                    byte[] byteArray = new byte[byteArraySize];
-                    Marshal.Copy(byteArrayPtr, byteArray, 0, byteArraySize);
-                    return byteArray;
+                        // get byte array
+                        IntPtr byteArrayPtr;
+                        int byteArraySize;
+                        Interop.Bundle.GetByte(_handle, key, out byteArrayPtr, out byteArraySize);
+                        byte[] byteArray = new byte[byteArraySize];
+                        Marshal.Copy(byteArrayPtr, byteArray, 0, byteArraySize);
+                        return byteArray;
 
                     default:
-                    throw new ArgumentException("Key does not exist in the bundle", "key");
+                        throw new ArgumentException("Key does not exist in the bundle", "key");
                 }
             }
             else
@@ -355,16 +355,16 @@ namespace Tizen.Applications
                 switch (type)
                 {
                     case (int)BundleType.String:
-                    return typeof(string) == typeof(T);
+                        return typeof(string) == typeof(T);
 
                     case (int)BundleType.StringArray:
-                    return typeof(T).IsAssignableFrom(typeof(string[]));
+                        return typeof(T).IsAssignableFrom(typeof(string[]));
 
                     case (int)BundleType.Byte:
-                    return typeof(byte[]) == typeof(T);
+                        return typeof(byte[]) == typeof(T);
 
                     default:
-                    throw new ArgumentException("Key does not exist in the bundle", "key");
+                        throw new ArgumentException("Key does not exist in the bundle", "key");
                 }
             }
             else
diff --git a/Tizen.Applications/Tizen.Applications/Context.cs b/Tizen.Applications/Tizen.Applications/Context.cs
deleted file mode 100755 (executable)
index 2e28752..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.IO;
-
-namespace Tizen.Applications
-{
-    /// <summary>
-    /// 
-    /// </summary>
-    public abstract class Context
-    {
-        /// <summary>
-        /// 
-        /// </summary>
-        public string ApplicationId
-        {
-            get
-            {
-                throw new NotImplementedException();
-            }
-        }
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public string ApplicationName
-        {
-            get
-            {
-                throw new NotImplementedException();
-            }
-        }
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public string ApplicationVersion
-        {
-            get
-            {
-                throw new NotImplementedException();
-            }
-        }
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public IReadOnlyDictionary<string, string> ApplicationPath
-        {
-            get
-            {
-                throw new NotImplementedException();
-            }
-        }
-    }
-}
diff --git a/Tizen.Applications/Tizen.Applications/Controller.cs b/Tizen.Applications/Tizen.Applications/Controller.cs
deleted file mode 100755 (executable)
index 6319dc0..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-/// 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;
-
-namespace Tizen.Applications
-{
-    /// <summary>
-    /// 
-    /// </summary>
-    public abstract class Controller : Context
-    {
-        /// <summary>
-        /// 
-        /// </summary>
-        [Flags]
-        public enum ControlFlags
-        {
-            NewInstance = 1,
-            ClearTop = 2,
-            MoveToTop = 4,
-        }
-
-        /// <summary>
-        /// 
-        /// </summary>
-        protected AppControl AppControl { get; private set; }
-
-        internal virtual void SendCreate()
-        {
-            AppControl = null;
-            OnCreate();
-        }
-
-        internal virtual void SendStart(AppControl control)
-        {
-            AppControl = control;
-            OnStart();
-        }
-
-        internal virtual void SendDestroy()
-        {
-            OnDestroy();
-        }
-
-        /// <summary>
-        /// 
-        /// </summary>
-        protected virtual void OnCreate()
-        {
-        }
-
-        /// <summary>
-        /// 
-        /// </summary>
-        protected virtual void OnStart()
-        {
-        }
-
-        /// <summary>
-        /// 
-        /// </summary>
-        protected virtual void OnDestroy()
-        {
-        }
-
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="control"></param>
-        /// <param name="flags"></param>
-        protected void StartController(AppControl control, ControlFlags flags = ControlFlags.NewInstance)
-        {
-            Application.StartController(this, null, control, flags);
-        }
-
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="controllerType"></param>
-        /// <param name="control"></param>
-        /// <param name="flags"></param>
-        protected void StartController(Type controllerType, AppControl control, ControlFlags flags = ControlFlags.NewInstance)
-        {
-            Application.StartController(this, controllerType, control, flags);
-        }
-
-        protected void StopController(Type controllerType)
-        {
-            Application.StopController(controllerType);
-        }
-
-        /// <summary>
-        /// 
-        /// </summary>
-        protected virtual void Finish()
-        {
-            Application.StopController(GetType());
-        }
-
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="control"></param>
-        /// <param name="destination"></param>
-        protected void SendAppControl(AppControl control, string destination)
-        {
-            throw new NotImplementedException();
-        }
-    }
-}
similarity index 52%
rename from Tizen.UI/Tizen.UI/Window.cs
rename to Tizen.Applications/Tizen.Applications/LocaleChangedEventArgs.cs
index d23339f..19cc970 100755 (executable)
@@ -4,9 +4,10 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace Tizen.UI
+namespace Tizen.Applications
 {
-    public class Window : Tizen.Applications.IWindow
+    public class LocaleChangedEventArgs
     {
+        public string Locale { get; internal set; }
     }
 }
similarity index 76%
rename from Tizen.Applications/Tizen.UI/Page.cs
rename to Tizen.Applications/Tizen.Applications/LowMemoryEventArgs.cs
index bd5e48a..5f172f4 100755 (executable)
@@ -13,12 +13,10 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace Tizen.UI
+namespace Tizen.Applications
 {
-    public class Page
+    public class LowMemoryEventArgs : EventArgs
     {
-        internal void Show()
-        {
-        }
+        public LowMemoryStatus LowMemoryStatus { get; internal set; }
     }
 }
diff --git a/Tizen.Applications/Tizen.Applications/LowMemoryStatus.cs b/Tizen.Applications/Tizen.Applications/LowMemoryStatus.cs
new file mode 100755 (executable)
index 0000000..7ce331c
--- /dev/null
@@ -0,0 +1,38 @@
+/// 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.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tizen.Applications
+{
+    /// <summary>
+    /// Enumeration for low memory status.
+    /// </summary>
+    public enum LowMemoryStatus
+    {
+        /// <summary>
+        /// Normal status
+        /// </summary>
+        Normal = 0x01,
+
+        /// <summary>
+        /// Soft warning status
+        /// </summary>
+        SoftWarning = 0x02,
+
+        /// <summary>
+        /// Hard warning status
+        /// </summary>
+        HardWarning = 0x04,
+    }
+}
diff --git a/Tizen.Applications/Tizen.Applications/ServiceApplication.cs b/Tizen.Applications/Tizen.Applications/ServiceApplication.cs
new file mode 100755 (executable)
index 0000000..6dde93d
--- /dev/null
@@ -0,0 +1,58 @@
+/// 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.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tizen.Applications
+{
+    /// <summary>
+    /// 
+    /// </summary>
+    public class ServiceApplication : Application
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="args"></param>
+        public override void Run(string[] args)
+        {
+            base.Run(args);
+
+            Interop.Service.ServiceAppLifecycleCallbacks ops;
+            ops.OnCreate = (data) =>
+            {
+                OnCreate();
+                return true;
+            };
+            ops.OnTerminate = (data) =>
+            {
+                OnTerminate();
+            };
+            ops.OnAppControl = (appControlHandle, data) =>
+            {
+                OnStart(new AppControl(appControlHandle));
+            };
+
+            TizenSynchronizationContext.Initialize();
+            Interop.Service.Main(args.Length, args, ref ops, IntPtr.Zero);
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public override void Exit()
+        {
+            Interop.Service.Exit();
+        }
+    }
+}
index bb60a20..6f7d0bc 100755 (executable)
@@ -16,7 +16,7 @@ namespace Tizen.Applications
     internal class TizenSynchronizationContext : SynchronizationContext
     {
         private readonly Interop.Glib.GSourceFunc _wrapperHandler;
-        private readonly Object _transactionLock = new Object();        
+        private readonly Object _transactionLock = new Object();
         private readonly Dictionary<int, Action> _handlerMap = new Dictionary<int, Action>();
         private int _transactionId = 0;
 
diff --git a/Tizen.Applications/Tizen.Applications/UIApplication.cs b/Tizen.Applications/Tizen.Applications/UIApplication.cs
new file mode 100755 (executable)
index 0000000..11a17bf
--- /dev/null
@@ -0,0 +1,75 @@
+/// 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.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tizen.Internals.Errors;
+
+namespace Tizen.Applications
+{
+    /// <summary>
+    /// 
+    /// </summary>
+    public class UIApplication : Application
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="args"></param>
+        public override void Run(string[] args)
+        {
+            base.Run(args);
+
+            Interop.Application.UIAppLifecycleCallbacks ops;
+            ops.OnCreate = (data) =>
+            {
+                OnCreate();
+                return true;
+            };
+            ops.OnTerminate = (data) =>
+            {
+                OnTerminate();
+            };
+            ops.OnAppControl = (appControlHandle, data) =>
+            {
+                OnStart(new AppControl(appControlHandle));
+            };
+            ops.OnResume = (data) =>
+            {
+                OnResume();
+            };
+            ops.OnPause = (data) =>
+            {
+                OnPause();
+            };
+
+            TizenSynchronizationContext.Initialize();
+            Interop.Application.Main(args.Length, args, ref ops, IntPtr.Zero);
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public override void Exit()
+        {
+            Interop.Application.Exit();
+        }
+
+        protected virtual void OnResume()
+        {
+        }
+
+        protected virtual void OnPause()
+        {
+        }
+    }
+}
diff --git a/Tizen.Applications/Tizen.Applications/UIController.cs b/Tizen.Applications/Tizen.Applications/UIController.cs
deleted file mode 100755 (executable)
index a7f56c3..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/// 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 Tizen.UI;
-
-namespace Tizen.Applications
-{
-    /// <summary>
-    /// 
-    /// </summary>
-    public abstract class UIController : Controller, IUIContext
-    {
-        private bool _isResumed = false;
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public event EventHandler Resumed;
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public event EventHandler Paused;
-
-        /// <summary>
-        /// 
-        /// </summary>
-        public Window Window { get; internal set; }
-
-        internal Guid TaskId { get; set; }
-
-        /// <summary>
-        /// 
-        /// </summary>
-        protected internal Page MainPage { get; set; }
-
-        public string ResolveResourcePath(string res)
-        {
-            throw new NotImplementedException();
-        }
-
-        internal override void SendCreate()
-        {
-            Window = OnPrepareWindow();
-            base.SendCreate();
-        }
-
-        internal void SendPause()
-        {
-            if (_isResumed)
-            {
-                if (Paused != null)
-                {
-                    OnPause();
-                    Paused(this, EventArgs.Empty);
-                }
-                _isResumed = false;
-            }
-        }
-
-        internal void SendResume()
-        {
-            if (!_isResumed)
-            {
-                if (Resumed != null)
-                {
-                    OnResume();
-                    Resumed(this, EventArgs.Empty);
-                }
-                _isResumed = true;
-                MainPage.Show();
-            }
-        }
-
-        protected virtual Window OnPrepareWindow()
-        {
-            return Window;
-        }
-
-        protected virtual void OnResume()
-        {
-        }
-
-        protected virtual void OnPause()
-        {
-        }
-
-        protected override void Finish()
-        {
-            Application.StopController(this);
-        }
-    }
-}
-
diff --git a/Tizen.Applications/Tizen.UI/IUIContext.cs b/Tizen.Applications/Tizen.UI/IUIContext.cs
deleted file mode 100755 (executable)
index c676f6a..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tizen.UI
-{
-    /// <summary>
-    /// 
-    /// </summary>
-    interface IUIContext
-    {
-        /// <summary>
-        /// 
-        /// </summary>
-        Window Window { get; }
-
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="res"></param>
-        /// <returns></returns>
-        string ResolveResourcePath(string res);
-    }
-}
diff --git a/Tizen.Applications/Tizen.UI/Window.cs b/Tizen.Applications/Tizen.UI/Window.cs
deleted file mode 100755 (executable)
index 3fd9a20..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/// 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;
-
-namespace Tizen.UI
-{
-    public class Window : IDisposable
-    {
-        private IntPtr _native_window = IntPtr.Zero;
-
-        public bool Visible
-        {
-            get
-            {
-                return _native_window != IntPtr.Zero ? Interop.Window.evas_object_visible_get(_native_window) : false;
-            }
-        }
-        public Window()
-        {
-            _native_window = Interop.Window.elm_win_add(IntPtr.Zero, "Window", 0);
-        }
-
-        ~Window()
-        {
-            Dispose();
-        }
-
-        public void Show()
-        {
-            Interop.Window.evas_object_show(_native_window);
-        }
-
-        public void Hide()
-        {
-            Interop.Window.evas_object_hide(_native_window);
-        }
-
-        public void Active()
-        {
-            Interop.Window.elm_win_activate(_native_window);
-        }
-
-        public void InActive()
-        {
-            Interop.Window.elm_win_lower(_native_window);
-        }
-
-        public void Dispose()
-        {
-            if (_native_window != IntPtr.Zero)
-            {
-                Interop.Window.evas_object_unref(_native_window);
-                _native_window = IntPtr.Zero;
-            }
-        }
-    }
-}
diff --git a/Tizen.UI/Properties/AssemblyInfo.cs b/Tizen.UI/Properties/AssemblyInfo.cs
deleted file mode 100755 (executable)
index 5c1dc2b..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해 
-// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
-// 이러한 특성 값을 변경하세요.
-[assembly: AssemblyTitle("Tizen.UI")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("Tizen.UI")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2016")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에 
-// 표시되지 않습니다.  COM에서 이 어셈블리의 형식에 액세스하려면 
-// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
-[assembly: ComVisible(false)]
-
-// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
-[assembly: Guid("729a2031-f2bd-4784-9ba1-ebd057add72c")]
-
-// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
-//
-//      주 버전
-//      부 버전 
-//      빌드 번호
-//      수정 버전
-//
-// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로 
-// 지정되도록 할 수 있습니다.
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Tizen.UI/Tizen.UI.csproj b/Tizen.UI/Tizen.UI.csproj
deleted file mode 100755 (executable)
index 3f0415a..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProjectGuid>{729A2031-F2BD-4784-9BA1-EBD057ADD72C}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>Tizen.UI</RootNamespace>
-    <AssemblyName>Tizen.UI</AssemblyName>
-    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="Microsoft.CSharp" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Net.Http" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="Tizen.UI\Window.cs" />
-  </ItemGroup>
-  <ItemGroup />
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
-       Other similar extension points exist, see Microsoft.Common.targets.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-</Project>
\ No newline at end of file
index 0f5f59d..ce5de3a 100644 (file)
@@ -19,10 +19,11 @@ BuildRequires: mono-devel
 BuildRequires: pkgconfig(csapi-tizen)
 BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(appcore-agent)
 
 Requires: glib-2.0
 Requires: capi-appfw-application
-Requires: evas
+Requires: appcore-agent
 
 Requires(post): mono-core
 Requires(postun): mono-core