// 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 Dali; //------------------------------------------------------------------------------ // // // This file can only run on Tizen target. You should compile it with hello-test.cs, and // add tizen c# application related library as reference. //------------------------------------------------------------------------------ namespace Tizen.Applications { /// /// Represents an application that have UI screen. The DaliApplication class has a default stage. /// public class DaliApplication : CoreUIApplication { /// /// The instance of the Dali Application. /// /// /// This application is created before OnCreate() or created event. And the DaliApplication will be terminated when this application is closed. /// protected Dali.Application application; /// /// The instance of the Dali Application extension. /// protected Dali.ApplicationExtensions applicationExt; /// /// Store the stylesheet value. /// protected string m_stylesheet; /// /// Store the window mode value. /// protected Dali.Application.WINDOW_MODE m_windowMode; /// /// Store the app mode value. /// protected APP_MODE appMode; /// /// The instance of the Dali Stage. /// public Stage stage { get; private set; } /// /// The default constructor. /// public DaliApplication():base() { appMode = APP_MODE.DEFAULT; } /// /// The constructor with stylesheet. /// public DaliApplication(string stylesheet):base() { //handle the stylesheet appMode = APP_MODE.STYLESHEETONLY; m_stylesheet = stylesheet; } /// /// The constructor with stylesheet and window mode. /// public DaliApplication(string stylesheet, Dali.Application.WINDOW_MODE windowMode) : base() { //handle the stylesheet and windowMode appMode = APP_MODE.STYLESHEETWITHWINDOWMODE; m_stylesheet = stylesheet; m_windowMode = windowMode; } /// /// Overrides this method if want to handle behavior before calling OnCreate(). /// stage property is initialized in this overrided method. /// protected override void OnPreCreate() { switch(appMode) { case APP_MODE.DEFAULT: application = Dali.Application.NewApplication(); break; case APP_MODE.STYLESHEETONLY: application = Dali.Application.NewApplication(m_stylesheet); break; case APP_MODE.STYLESHEETWITHWINDOWMODE: application = Dali.Application.NewApplication(m_stylesheet, m_windowMode); break; default: break; } applicationExt = new Dali.ApplicationExtensions(application); applicationExt.Init(); stage = Stage.GetCurrent(); stage.SetBackgroundColor( NDalic.WHITE ); } /// /// Overrides this method if want to handle behavior. /// protected override void OnTerminate() { base.OnTerminate(); applicationExt.Terminate(); } /// /// Overrides this method if want to handle behavior. /// protected override void OnPause() { base.OnPause(); applicationExt.Pause(); } /// /// Overrides this method if want to handle behavior. /// protected override void OnResume() { base.OnResume(); applicationExt.Resume(); } /// /// Overrides this method if want to handle behavior. /// protected override void OnLocaleChanged(LocaleChangedEventArgs e) { base.OnLocaleChanged(e); applicationExt.LanguageChange(); } /// /// The mode of creating Dali application. /// protected enum APP_MODE { DEFAULT = 0, STYLESHEETONLY = 1, STYLESHEETWITHWINDOWMODE = 2 } } }