From: WonYoung Choi Date: Mon, 28 Mar 2016 12:23:00 +0000 (+0900) Subject: Add events for lifecycles X-Git-Tag: submit/trunk/20170823.075128~121^2~201 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b70079e0f6bcfe7f139b0154a0666929460080ce;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git Add events for lifecycles Change-Id: I650178e78b26ed330fbb26ddef1b4b82587fa712 --- diff --git a/Tizen.Applications/Tizen.Applications/AppControlReceivedEventArgs.cs b/Tizen.Applications/Tizen.Applications/AppControlReceivedEventArgs.cs new file mode 100755 index 0000000..a84264c --- /dev/null +++ b/Tizen.Applications/Tizen.Applications/AppControlReceivedEventArgs.cs @@ -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; } + } +} diff --git a/Tizen.Applications/Tizen.Applications/Application.cs b/Tizen.Applications/Tizen.Applications/Application.cs index a9ff61a..82a20a3 100755 --- a/Tizen.Applications/Tizen.Applications/Application.cs +++ b/Tizen.Applications/Tizen.Applications/Application.cs @@ -22,6 +22,21 @@ namespace Tizen.Applications private Interop.AppEvent.SafeAppEventHandle _localeChangedNativeHandle; /// + /// + /// + public event EventHandler Created; + + /// + /// + /// + public event EventHandler Terminated; + + /// + /// + /// + public event EventHandler AppControlReceived; + + /// /// The low memory event. /// public event EventHandler LowMemory; @@ -61,23 +76,40 @@ namespace Tizen.Applications /// /// /// - protected virtual void OnCreate() + /// + protected virtual void OnCreate(EventArgs e) { + var eh = Created as EventHandler; + if (eh != null) + { + eh(this, e); + } } /// /// /// - protected virtual void OnTerminate() + /// + protected virtual void OnTerminate(EventArgs e) { + var eh = Terminated as EventHandler; + if (eh != null) + { + eh(this, e); + } } - + /// /// /// - /// - protected virtual void OnAppControlReceived(ReceivedAppControl control) + /// + protected virtual void OnAppControlReceived(AppControlReceivedEventArgs e) { + var eh = AppControlReceived as EventHandler; + if (eh != null) + { + eh(this, e); + } } /// @@ -86,7 +118,7 @@ namespace Tizen.Applications /// protected virtual void OnLowMemory(LowMemoryEventArgs e) { - EventHandler eh = LowMemory; + var eh = LowMemory as EventHandler; if (eh != null) { eh(this, e); @@ -99,7 +131,7 @@ namespace Tizen.Applications /// protected virtual void OnLocaleChanged(LocaleChangedEventArgs e) { - EventHandler eh = LocaleChanged; + var eh = LocaleChanged as EventHandler; 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) diff --git a/Tizen.Applications/Tizen.Applications/ApplicationInfo.cs b/Tizen.Applications/Tizen.Applications/ApplicationInfo.cs index f30f1db..afbe7be 100755 --- a/Tizen.Applications/Tizen.Applications/ApplicationInfo.cs +++ b/Tizen.Applications/Tizen.Applications/ApplicationInfo.cs @@ -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 { /// diff --git a/Tizen.Applications/Tizen.Applications/Bundle.cs b/Tizen.Applications/Tizen.Applications/Bundle.cs old mode 100644 new mode 100755 index aba2505..0add613 --- a/Tizen.Applications/Tizen.Applications/Bundle.cs +++ b/Tizen.Applications/Tizen.Applications/Bundle.cs @@ -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; diff --git a/Tizen.Applications/Tizen.Applications/LocaleChangedEventArgs.cs b/Tizen.Applications/Tizen.Applications/LocaleChangedEventArgs.cs index c044398..7454507 100755 --- a/Tizen.Applications/Tizen.Applications/LocaleChangedEventArgs.cs +++ b/Tizen.Applications/Tizen.Applications/LocaleChangedEventArgs.cs @@ -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 { diff --git a/Tizen.Applications/Tizen.Applications/LowMemoryEventArgs.cs b/Tizen.Applications/Tizen.Applications/LowMemoryEventArgs.cs index 44c222e..349c00c 100755 --- a/Tizen.Applications/Tizen.Applications/LowMemoryEventArgs.cs +++ b/Tizen.Applications/Tizen.Applications/LowMemoryEventArgs.cs @@ -8,10 +8,6 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Tizen.Applications { diff --git a/Tizen.Applications/Tizen.Applications/LowMemoryStatus.cs b/Tizen.Applications/Tizen.Applications/LowMemoryStatus.cs index 7ce331c..1a6b66b 100755 --- a/Tizen.Applications/Tizen.Applications/LowMemoryStatus.cs +++ b/Tizen.Applications/Tizen.Applications/LowMemoryStatus.cs @@ -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 { /// diff --git a/Tizen.Applications/Tizen.Applications/ReceivedAppControl.cs b/Tizen.Applications/Tizen.Applications/ReceivedAppControl.cs index a4d7c4d..1d719c6 100755 --- a/Tizen.Applications/Tizen.Applications/ReceivedAppControl.cs +++ b/Tizen.Applications/Tizen.Applications/ReceivedAppControl.cs @@ -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; diff --git a/Tizen.Applications/Tizen.Applications/ServiceApplication.cs b/Tizen.Applications/Tizen.Applications/ServiceApplication.cs index b86b130..25436f9 100755 --- a/Tizen.Applications/Tizen.Applications/ServiceApplication.cs +++ b/Tizen.Applications/Tizen.Applications/ServiceApplication.cs @@ -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(); diff --git a/Tizen.Applications/Tizen.Applications/UIApplication.cs b/Tizen.Applications/Tizen.Applications/UIApplication.cs index b7deade..262d3fe 100755 --- a/Tizen.Applications/Tizen.Applications/UIApplication.cs +++ b/Tizen.Applications/Tizen.Applications/UIApplication.cs @@ -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 /// /// /// + public event EventHandler Resumed; + + /// + /// + /// + public event EventHandler Paused; + + /// + /// + /// /// 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 /// /// /// - protected virtual void OnResume() + protected virtual void OnResume(EventArgs e) { + var eh = Resumed as EventHandler; + if (eh != null) + { + eh(this, e); + } } /// /// /// - protected virtual void OnPause() + protected virtual void OnPause(EventArgs e) { + var eh = Paused as EventHandler; + if (eh != null) + { + eh(this, e); + } } } }