2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
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;
25 public class NUIApplication : CoreUIApplication
27 private void LOG(string _str)
29 Tizen.Log.Debug("NUI", _str);
30 //Console.WriteLine("[NUI]" + _str);
33 private Application _application;
34 private ApplicationExtensions _applicationExt;
35 private string _stylesheet;
36 private Application.WindowMode _windowMode;
37 private AppMode _appMode;
40 public NUIApplication() : base()
42 _appMode = AppMode.Default;
45 public NUIApplication(string stylesheet) : base()
47 //handle the stylesheet
48 _appMode = AppMode.StyleSheetOnly;
49 _stylesheet = stylesheet;
52 public NUIApplication(string stylesheet, Application.WindowMode windowMode) : base()
54 //handle the stylesheet and windowMode
55 _appMode = AppMode.StyleSheetWithWindowMode;
56 _stylesheet = stylesheet;
57 _windowMode = windowMode;
61 protected override void OnPause()
64 _applicationExt.Pause();
65 LOG("OnPause() is called!");
68 protected override void OnPreCreate()
73 _application = Tizen.NUI.Application.NewApplication();
75 case AppMode.StyleSheetOnly:
76 _application = Tizen.NUI.Application.NewApplication(_stylesheet);
78 case AppMode.StyleSheetWithWindowMode:
79 _application = Tizen.NUI.Application.NewApplication(_stylesheet, _windowMode);
84 _applicationExt = new ApplicationExtensions(_application);
85 _applicationExt.Init();
87 _stage = Stage.Instance;
88 _stage.SetBackgroundColor(Color.White);
89 LOG("OnPreCreate() is called!");
92 protected override void OnResume()
95 _applicationExt.Resume();
96 LOG("OnResume() is called!");
99 protected override void OnAppControlReceived(AppControlReceivedEventArgs e)
101 base.OnAppControlReceived(e);
102 LOG("OnAppControlReceived() is called!");
105 LOG("OnAppControlReceived() is called! ApplicationId=" + e.ReceivedAppControl.ApplicationId);
106 LOG("CallerApplicationId=" + e.ReceivedAppControl.CallerApplicationId + " IsReplyRequest=" + e.ReceivedAppControl.IsReplyRequest);
110 protected override void OnCreate()
113 LOG("OnCreate() is called!");
116 protected override void OnLocaleChanged(LocaleChangedEventArgs e)
118 base.OnLocaleChanged(e);
119 _applicationExt.LanguageChange();
120 LOG("OnLocaleChanged() is called!");
123 protected override void OnLowBattery(LowBatteryEventArgs e)
125 base.OnLowBattery(e);
126 LOG("OnLowBattery() is called!");
129 protected override void OnLowMemory(LowMemoryEventArgs e)
132 LOG("OnLowMemory() is called!");
135 protected override void OnRegionFormatChanged(RegionFormatChangedEventArgs e)
137 base.OnRegionFormatChanged(e);
138 LOG("OnRegionFormatChanged() is called!");
141 protected override void OnTerminate()
144 _applicationExt.Terminate();
145 LOG("OnTerminate() is called!");
152 StyleSheetWithWindowMode = 2