2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 using Tizen.Applications.CoreBackend;
21 namespace Tizen.Applications
24 /// Represents an application that has an UI screen. The events for resuming and pausing are provided.
26 /// <since_tizen> 3 </since_tizen>
27 public class CoreUIApplication : CoreApplication
30 /// Initializes the CoreUIApplication class.
33 /// The default backend for the UI application will be used.
35 /// <since_tizen> 3 </since_tizen>
36 public CoreUIApplication() : base(new UICoreBackend())
41 /// Initializes the CoreUIApplication class.
44 /// If you want to change the backend, use this constructor.
46 /// <param name="backend">The backend instance implementing the ICoreBacked interface.</param>
47 /// <since_tizen> 3 </since_tizen>
48 public CoreUIApplication(ICoreBackend backend) : base(backend)
53 /// Occurs whenever the application is resumed.
55 /// <since_tizen> 3 </since_tizen>
56 public event EventHandler Resumed;
59 /// Occurs whenever the application is paused.
61 /// <since_tizen> 3 </since_tizen>
62 public event EventHandler Paused;
65 /// Runs the UI application's main loop.
67 /// <param name="args">Arguments from the commandline.</param>
68 /// <since_tizen> 3 </since_tizen>
69 public override void Run(string[] args)
71 Backend.AddEventHandler(EventType.PreCreated, OnPreCreate);
72 Backend.AddEventHandler(EventType.Resumed, OnResume);
73 Backend.AddEventHandler(EventType.Paused, OnPause);
78 /// Overrides this method if you want to handle the behavior before calling OnCreate().
80 /// <since_tizen> 3 </since_tizen>
81 protected virtual void OnPreCreate()
86 /// Overrides this method if you want to handle the behavior when the application is resumed.
87 /// If base.OnResume() is not called, the event 'Resumed' will not be emitted.
89 /// <since_tizen> 3 </since_tizen>
90 protected virtual void OnResume()
92 Resumed?.Invoke(this, EventArgs.Empty);
96 /// Overrides this method if you want to handle the behavior when the application is paused.
97 /// If base.OnPause() is not called, the event 'Paused' will not be emitted.
99 /// <since_tizen> 3 </since_tizen>
100 protected virtual void OnPause()
102 Paused?.Invoke(this, EventArgs.Empty);