/* * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an AS IS BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using Tizen.Applications.CoreBackend; namespace Tizen.Applications { /// /// Represents an application that have UI screen. The events for resuming and pausing are provided. /// public class CoreUIApplication : CoreApplication { /// /// Initializes the CoreUIApplication class. /// /// /// Default backend for UI application will be used. /// public CoreUIApplication() : base(new UICoreBackend()) { } /// /// Initializes the CoreUIApplication class. /// /// /// If want to change the backend, use this constructor. /// /// The backend instance implementing ICoreBacked interface. public CoreUIApplication(ICoreBackend backend) : base(backend) { } /// /// Occurs whenever the application is resumed. /// public event EventHandler Resumed; /// /// Occurs whenever the application is paused. /// public event EventHandler Paused; /// /// Runs the UI application's main loop. /// /// Arguments from commandline. public override void Run(string[] args) { Backend.AddEventHandler(EventType.PreCreated, OnPreCreate); Backend.AddEventHandler(EventType.Resumed, OnResume); Backend.AddEventHandler(EventType.Paused, OnPause); base.Run(args); } /// /// Overrides this method if want to handle behavior before calling OnCreate(). /// protected virtual void OnPreCreate() { } /// /// Overrides this method if want to handle behavior when the application is resumed. /// If base.OnResume() is not called, the event 'Resumed' will not be emitted. /// protected virtual void OnResume() { Resumed?.Invoke(this, EventArgs.Empty); } /// /// Overrides this method if want to handle behavior when the application is paused. /// If base.OnPause() is not called, the event 'Paused' will not be emitted. /// protected virtual void OnPause() { Paused?.Invoke(this, EventArgs.Empty); } } }