Add events for lifecycles
authorWonYoung Choi <wy80.choi@samsung.com>
Mon, 28 Mar 2016 12:23:00 +0000 (21:23 +0900)
committerWonYoung Choi <wy80.choi@samsung.com>
Mon, 28 Mar 2016 12:23:00 +0000 (21:23 +0900)
Change-Id: I650178e78b26ed330fbb26ddef1b4b82587fa712

Tizen.Applications/Tizen.Applications/AppControlReceivedEventArgs.cs [new file with mode: 0755]
Tizen.Applications/Tizen.Applications/Application.cs
Tizen.Applications/Tizen.Applications/ApplicationInfo.cs
Tizen.Applications/Tizen.Applications/Bundle.cs [changed mode: 0644->0755]
Tizen.Applications/Tizen.Applications/LocaleChangedEventArgs.cs
Tizen.Applications/Tizen.Applications/LowMemoryEventArgs.cs
Tizen.Applications/Tizen.Applications/LowMemoryStatus.cs
Tizen.Applications/Tizen.Applications/ReceivedAppControl.cs
Tizen.Applications/Tizen.Applications/ServiceApplication.cs
Tizen.Applications/Tizen.Applications/UIApplication.cs

diff --git a/Tizen.Applications/Tizen.Applications/AppControlReceivedEventArgs.cs b/Tizen.Applications/Tizen.Applications/AppControlReceivedEventArgs.cs
new file mode 100755 (executable)
index 0000000..a84264c
--- /dev/null
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tizen.Applications
+{
+    public class AppControlReceivedEventArgs
+    {
+        public AppControlReceivedEventArgs(ReceivedAppControl control)
+        {
+            ReceivedAppControl = control;
+        }
+
+        public ReceivedAppControl ReceivedAppControl { get; private set; }
+    }
+}
index a9ff61a..82a20a3 100755 (executable)
@@ -22,6 +22,21 @@ namespace Tizen.Applications
         private Interop.AppEvent.SafeAppEventHandle _localeChangedNativeHandle;
 
         /// <summary>
+        /// 
+        /// </summary>
+        public event EventHandler<EventArgs> Created;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public event EventHandler<EventArgs> Terminated;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public event EventHandler<AppControlReceivedEventArgs> AppControlReceived;
+
+        /// <summary>
         /// The low memory event.
         /// </summary>
         public event EventHandler<LowMemoryEventArgs> LowMemory;
@@ -61,23 +76,40 @@ namespace Tizen.Applications
         /// <summary>
         /// 
         /// </summary>
-        protected virtual void OnCreate()
+        /// <param name="e"></param>
+        protected virtual void OnCreate(EventArgs e)
         {
+            var eh = Created as EventHandler<EventArgs>;
+            if (eh != null)
+            {
+                eh(this, e);
+            }
         }
 
         /// <summary>
         /// 
         /// </summary>
-        protected virtual void OnTerminate()
+        /// <param name="e"></param>
+        protected virtual void OnTerminate(EventArgs e)
         {
+            var eh = Terminated as EventHandler<EventArgs>;
+            if (eh != null)
+            {
+                eh(this, e);
+            }
         }
-
+        
         /// <summary>
         /// 
         /// </summary>
-        /// <param name="control"></param>
-        protected virtual void OnAppControlReceived(ReceivedAppControl control)
+        /// <param name="e"></param>
+        protected virtual void OnAppControlReceived(AppControlReceivedEventArgs e)
         {
+            var eh = AppControlReceived as EventHandler<AppControlReceivedEventArgs>;
+            if (eh != null)
+            {
+                eh(this, e);
+            }
         }
 
         /// <summary>
@@ -86,7 +118,7 @@ namespace Tizen.Applications
         /// <param name="e"></param>
         protected virtual void OnLowMemory(LowMemoryEventArgs e)
         {
-            EventHandler<LowMemoryEventArgs> eh = LowMemory;
+            var eh = LowMemory as EventHandler<LowMemoryEventArgs>;
             if (eh != null)
             {
                 eh(this, e);
@@ -99,7 +131,7 @@ namespace Tizen.Applications
         /// <param name="e"></param>
         protected virtual void OnLocaleChanged(LocaleChangedEventArgs e)
         {
-            EventHandler<LocaleChangedEventArgs> eh = LocaleChanged;
+            var eh = LocaleChanged as EventHandler<LocaleChangedEventArgs>;
             if (eh != null)
             {
                 eh(this, e);
@@ -109,7 +141,7 @@ namespace Tizen.Applications
         internal void SendCreate()
         {
             ApplicationInfo = new ApplicationInfo();
-            OnCreate();
+            OnCreate(EventArgs.Empty);
         }
 
         private void HandleAppEvent(string eventName, IntPtr eventData, IntPtr data)
index f30f1db..afbe7be 100755 (executable)
@@ -7,12 +7,6 @@
 /// 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>
old mode 100644 (file)
new mode 100755 (executable)
index aba2505..0add613
@@ -1,3 +1,11 @@
+/// 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;
index c044398..7454507 100755 (executable)
@@ -1,8 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+/// 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.
 
 namespace Tizen.Applications
 {
index 44c222e..349c00c 100755 (executable)
@@ -8,10 +8,6 @@
 
 
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace Tizen.Applications
 {
index 7ce331c..1a6b66b 100755 (executable)
@@ -7,12 +7,6 @@
 /// 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>
index a4d7c4d..1d719c6 100755 (executable)
@@ -1,8 +1,12 @@
+/// 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;
 
index b86b130..25436f9 100755 (executable)
@@ -8,10 +8,6 @@
 
 
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace Tizen.Applications
 {
@@ -36,11 +32,11 @@ namespace Tizen.Applications
             };
             ops.OnTerminate = (data) =>
             {
-                OnTerminate();
+                OnTerminate(EventArgs.Empty);
             };
             ops.OnAppControl = (appControlHandle, data) =>
             {
-                OnAppControlReceived(new ReceivedAppControl(appControlHandle));
+                OnAppControlReceived(new AppControlReceivedEventArgs(new ReceivedAppControl(appControlHandle)));
             };
 
             TizenSynchronizationContext.Initialize();
index b7deade..262d3fe 100755 (executable)
@@ -8,11 +8,6 @@
 
 
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Tizen.Internals.Errors;
 
 namespace Tizen.Applications
 {
@@ -24,6 +19,16 @@ namespace Tizen.Applications
         /// <summary>
         /// 
         /// </summary>
+        public event EventHandler<EventArgs> Resumed;
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public event EventHandler<EventArgs> Paused;
+
+        /// <summary>
+        /// 
+        /// </summary>
         /// <param name="args"></param>
         public override void Run(string[] args)
         {
@@ -37,19 +42,19 @@ namespace Tizen.Applications
             };
             ops.OnTerminate = (data) =>
             {
-                OnTerminate();
+                OnTerminate(EventArgs.Empty);
             };
             ops.OnAppControl = (appControlHandle, data) =>
             {
-                OnAppControlReceived(new ReceivedAppControl(appControlHandle));
+                OnAppControlReceived(new AppControlReceivedEventArgs(new ReceivedAppControl(appControlHandle)));
             };
             ops.OnResume = (data) =>
             {
-                OnResume();
+                OnResume(EventArgs.Empty);
             };
             ops.OnPause = (data) =>
             {
-                OnPause();
+                OnPause(EventArgs.Empty);
             };
 
             TizenSynchronizationContext.Initialize();
@@ -67,15 +72,25 @@ namespace Tizen.Applications
         /// <summary>
         /// 
         /// </summary>
-        protected virtual void OnResume()
+        protected virtual void OnResume(EventArgs e)
         {
+            var eh = Resumed as EventHandler<EventArgs>;
+            if (eh != null)
+            {
+                eh(this, e);
+            }
         }
 
         /// <summary>
         /// 
         /// </summary>
-        protected virtual void OnPause()
+        protected virtual void OnPause(EventArgs e)
         {
+            var eh = Paused as EventHandler<EventArgs>;
+            if (eh != null)
+            {
+                eh(this, e);
+            }
         }
     }
 }