7d56960bba28bba1af93141584c5b1e4245badfc
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Application / Application.cs
1 /*
2  * Copyright(c) 2022 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17 using System;
18 using System.Collections.Generic;
19 using System.Collections.ObjectModel;
20 using System.ComponentModel;
21 using System.Diagnostics;
22 using System.Runtime.InteropServices;
23 using Tizen.NUI.Binding;
24
25 namespace Tizen.NUI
26 {
27     // Event arguments that passed via NUIApplicationInit signal
28     internal class NUIApplicationInitEventArgs : EventArgs
29     {
30         private Application application;
31
32         // Application - is the application that is being initialized
33         public Application Application
34         {
35             get
36             {
37                 return application;
38             }
39             set
40             {
41                 application = value;
42             }
43         }
44     }
45
46     // Event arguments that passed via NUIApplicationTerminate signal
47     internal class NUIApplicationTerminatingEventArgs : EventArgs
48     {
49         private Application application;
50
51         // Application - is the application that is being Terminated
52         public Application Application
53         {
54             get
55             {
56                 return application;
57             }
58             set
59             {
60                 application = value;
61             }
62         }
63     }
64
65     // Event arguments that passed via NUIApplicationPause signal
66     internal class NUIApplicationPausedEventArgs : EventArgs
67     {
68         private Application application;
69
70         // Application - is the application that is being Paused
71         public Application Application
72         {
73             get
74             {
75                 return application;
76             }
77             set
78             {
79                 application = value;
80             }
81         }
82     }
83
84     // Event arguments that passed via NUIApplicationResume signal
85     internal class NUIApplicationResumedEventArgs : EventArgs
86     {
87         private Application application;
88         // Application - is the application that is being Resumed
89         public Application Application
90         {
91             get
92             {
93                 return application;
94             }
95             set
96             {
97                 application = value;
98             }
99         }
100     }
101
102     // Event arguments that passed via NUIApplicationReset signal
103     internal class NUIApplicationResetEventArgs : EventArgs
104     {
105         private Application application;
106
107         // Application - is the application that is being Reset
108         public Application Application
109         {
110             get
111             {
112                 return application;
113             }
114             set
115             {
116                 application = value;
117             }
118         }
119     }
120
121     // Event arguments that passed via NUIApplicationLanguageChanged signal
122     internal class NUIApplicationLanguageChangedEventArgs : EventArgs
123     {
124         private Application application;
125
126         // Application - is the application that is being affected with Device's language change
127         public Application Application
128         {
129             get
130             {
131                 return application;
132             }
133             set
134             {
135                 application = value;
136             }
137         }
138     }
139
140     // Event arguments that passed via NUIApplicationRegionChanged signal
141     internal class NUIApplicationRegionChangedEventArgs : EventArgs
142     {
143         private Application application;
144
145         // Application - is the application that is being affected with Device's region change
146         public Application Application
147         {
148             get
149             {
150                 return application;
151             }
152             set
153             {
154                 application = value;
155             }
156         }
157     }
158
159     // Event arguments that passed via NUIApplicationBatteryLow signal
160     internal class NUIApplicationBatteryLowEventArgs : EventArgs
161     {
162         private Application.BatteryStatus status;
163
164         // Application - is the application that is being affected when the battery level of the device is low
165         public Application.BatteryStatus BatteryStatus
166         {
167             get
168             {
169                 return status;
170             }
171             set
172             {
173                 status = value;
174             }
175         }
176     }
177
178     // Event arguments that passed via NUIApplicationMemoryLow signal
179     internal class NUIApplicationMemoryLowEventArgs : EventArgs
180     {
181         private Application.MemoryStatus status;
182
183         // Application - is the application that is being affected when the memory level of the device is low
184         public Application.MemoryStatus MemoryStatus
185         {
186             get
187             {
188                 return status;
189             }
190             set
191             {
192                 status = value;
193             }
194         }
195     }
196
197     // Event arguments that passed via NUIApplicationDeviceOrientationChanged signal
198     internal class NUIApplicationDeviceOrientationChangedEventArgs : EventArgs
199     {
200         private Application.DeviceOrientationStatus status;
201
202         // Application - is the application that is being affected when the device orientation is changed.
203         public Application.DeviceOrientationStatus DeviceOrientationStatus
204         {
205             get
206             {
207                 return status;
208             }
209             set
210             {
211                 status = value;
212             }
213         }
214     }
215
216     // Event arguments that passed via NUIApplicationAppControl  signal
217     internal class NUIApplicationAppControlEventArgs : EventArgs
218     {
219         private Application application;
220         private IntPtr voidp;
221
222         // Application - is the application that is receiving the launch request from another application
223         public Application Application
224         {
225             get
226             {
227                 return application;
228             }
229             set
230             {
231                 application = value;
232             }
233         }
234
235         // VoidP - contains the information about why the application is launched
236         public IntPtr VoidP
237         {
238             get
239             {
240                 return voidp;
241             }
242             set
243             {
244                 voidp = value;
245             }
246         }
247     }
248
249     /// <summary>
250     /// A class to get resources in current application.
251     /// </summary>
252     public sealed class GetResourcesProvider
253     {
254         /// <summary>
255         /// Get resources in current application.
256         /// </summary>
257         static public IResourcesProvider Get()
258         {
259             return Tizen.NUI.Application.Current;
260         }
261     }
262
263     internal class Application : BaseHandle, IResourcesProvider, IElementConfiguration<Application>
264     {
265         static Application s_current;
266
267         ReadOnlyCollection<Element> logicalChildren;
268
269         [EditorBrowsable(EditorBrowsableState.Never)]
270         public static void SetCurrentApplication(Application value) => Current = value;
271
272         public static Application Current
273         {
274             get { return s_current; }
275             set
276             {
277                 if (s_current == value)
278                     return;
279                 s_current = value;
280             }
281         }
282
283         internal override ReadOnlyCollection<Element> LogicalChildrenInternal
284         {
285             get { return logicalChildren ?? (logicalChildren = new ReadOnlyCollection<Element>(InternalChildren)); }
286         }
287
288         internal IResourceDictionary SystemResources { get; }
289
290         ObservableCollection<Element> InternalChildren { get; } = new ObservableCollection<Element>();
291
292         ResourceDictionary resources;
293         public bool IsResourcesCreated => resources != null;
294
295         public delegate void resChangeCb(object sender, ResourcesChangedEventArgs e);
296
297         internal override void OnResourcesChanged(object sender, ResourcesChangedEventArgs e)
298         {
299             base.OnResourcesChanged(sender, e);
300         }
301
302         public ResourceDictionary XamlResources
303         {
304             get
305             {
306                 if (resources == null)
307                 {
308                     resources = new ResourceDictionary();
309                     int hashCode = resources.GetHashCode();
310                     ((IResourceDictionary)resources).ValuesChanged += OnResourcesChanged;
311                 }
312                 return resources;
313             }
314             set
315             {
316                 if (resources == value)
317                     return;
318                 OnPropertyChanging();
319
320                 if (resources != null)
321                     ((IResourceDictionary)resources).ValuesChanged -= OnResourcesChanged;
322                 resources = value;
323                 OnResourcesChanged(value);
324                 if (resources != null)
325                     ((IResourceDictionary)resources).ValuesChanged += OnResourcesChanged;
326
327                 OnPropertyChanged();
328             }
329         }
330
331         protected override void OnParentSet()
332         {
333             throw new InvalidOperationException("Setting a Parent on Application is invalid.");
334         }
335
336         [EditorBrowsable(EditorBrowsableState.Never)]
337         public static bool IsApplicationOrNull(Element element)
338         {
339             return element == null || element is Application;
340         }
341
342         internal override void OnParentResourcesChanged(IEnumerable<KeyValuePair<string, object>> values)
343         {
344             if (values == null)
345                 return;
346
347             if (!((IResourcesProvider)this).IsResourcesCreated || XamlResources.Count == 0)
348             {
349                 base.OnParentResourcesChanged(values);
350                 return;
351             }
352
353             var innerKeys = new HashSet<string>();
354             var changedResources = new List<KeyValuePair<string, object>>();
355             foreach (KeyValuePair<string, object> c in XamlResources)
356                 innerKeys.Add(c.Key);
357             foreach (KeyValuePair<string, object> value in values)
358             {
359                 if (innerKeys.Add(value.Key))
360                     changedResources.Add(value);
361             }
362             if (changedResources.Count != 0)
363                 OnResourcesChanged(changedResources);
364         }
365
366         internal Application(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
367         {
368             SetCurrentApplication(this);
369             s_current = this;
370         }
371
372         protected override void Dispose(DisposeTypes type)
373         {
374             if (disposed)
375             {
376                 return;
377             }
378
379             //Release your own unmanaged resources here.
380             //You should not access any managed member here except static instance.
381             //because the execution order of Finalizes is non-deterministic.
382             if (applicationInitEventCallbackDelegate != null)
383             {
384                 initSignal?.Disconnect(applicationInitEventCallbackDelegate);
385                 initSignal?.Dispose();
386                 initSignal = null;
387             }
388
389             if (applicationTerminateEventCallbackDelegate != null)
390             {
391                 terminateSignal?.Disconnect(applicationTerminateEventCallbackDelegate);
392                 terminateSignal?.Dispose();
393                 terminateSignal = null;
394             }
395
396             if (applicationPauseEventCallbackDelegate != null)
397             {
398                 pauseSignal?.Disconnect(applicationPauseEventCallbackDelegate);
399                 pauseSignal?.Dispose();
400                 pauseSignal = null;
401             }
402
403             if (applicationResumeEventCallbackDelegate != null)
404             {
405                 resumeSignal?.Disconnect(applicationResumeEventCallbackDelegate);
406                 resumeSignal?.Dispose();
407                 resumeSignal = null;
408             }
409
410             if (applicationResetEventCallbackDelegate != null)
411             {
412                 resetSignal?.Disconnect(applicationResetEventCallbackDelegate);
413                 resetSignal?.Dispose();
414                 resetSignal = null;
415             }
416
417             if (applicationLanguageChangedEventCallbackDelegate != null)
418             {
419                 languageChangedSignal?.Disconnect(applicationLanguageChangedEventCallbackDelegate);
420                 languageChangedSignal?.Dispose();
421                 languageChangedSignal = null;
422             }
423
424             if (applicationRegionChangedEventCallbackDelegate != null)
425             {
426                 regionChangedSignal?.Disconnect(applicationRegionChangedEventCallbackDelegate);
427                 regionChangedSignal?.Dispose();
428                 regionChangedSignal = null;
429             }
430
431             if (applicationBatteryLowEventCallbackDelegate != null)
432             {
433                 batteryLowSignal?.Disconnect(applicationBatteryLowEventCallbackDelegate);
434                 batteryLowSignal?.Dispose();
435                 batteryLowSignal = null;
436             }
437
438             if (applicationMemoryLowEventCallbackDelegate != null)
439             {
440                 memoryLowSignal?.Disconnect(applicationMemoryLowEventCallbackDelegate);
441                 memoryLowSignal?.Dispose();
442                 memoryLowSignal = null;
443             }
444
445             if (applicationDeviceOrientationChangedEventCallback != null)
446             {
447                 deviceOrientationChangedSignal?.Disconnect(applicationDeviceOrientationChangedEventCallback);
448                 deviceOrientationChangedSignal?.Dispose();
449                 deviceOrientationChangedSignal = null;
450             }
451
452             if (applicationAppControlEventCallbackDelegate != null)
453             {
454                 appControlSignal?.Disconnect(applicationAppControlEventCallbackDelegate);
455                 appControlSignal?.Dispose();
456                 appControlSignal = null;
457             }
458
459             //Task
460             if (applicationTaskInitEventCallbackDelegate != null)
461             {
462                 taskInitSignal?.Disconnect(applicationTaskInitEventCallbackDelegate);
463                 taskInitSignal?.Dispose();
464                 taskInitSignal = null;
465             }
466
467             if (applicationTaskTerminateEventCallbackDelegate != null)
468             {
469                 taskTerminateSignal?.Disconnect(applicationTaskTerminateEventCallbackDelegate);
470                 taskTerminateSignal?.Dispose();
471                 taskTerminateSignal = null;
472             }
473
474             if (applicationTaskLanguageChangedEventCallbackDelegate != null)
475             {
476                 taskLanguageChangedSignal?.Disconnect(applicationTaskLanguageChangedEventCallbackDelegate);
477                 taskLanguageChangedSignal?.Dispose();
478                 taskLanguageChangedSignal = null;
479             }
480
481             if (applicationTaskRegionChangedEventCallbackDelegate != null)
482             {
483                 taskRegionChangedSignal?.Disconnect(applicationTaskRegionChangedEventCallbackDelegate);
484                 taskRegionChangedSignal?.Dispose();
485                 taskRegionChangedSignal = null;
486             }
487
488             if (applicationTaskBatteryLowEventCallbackDelegate != null)
489             {
490                 taskBatteryLowSignal?.Disconnect(applicationTaskBatteryLowEventCallbackDelegate);
491                 taskBatteryLowSignal?.Dispose();
492                 taskBatteryLowSignal = null;
493             }
494
495             if (applicationTaskMemoryLowEventCallbackDelegate != null)
496             {
497                 taskMemoryLowSignal?.Disconnect(applicationTaskMemoryLowEventCallbackDelegate);
498                 taskMemoryLowSignal?.Dispose();
499                 taskMemoryLowSignal = null;
500             }
501
502             if (applicationTaskDeviceOrientationChangedEventCallback != null)
503             {
504                 taskDeviceOrientationChangedSignal?.Disconnect(applicationTaskDeviceOrientationChangedEventCallback);
505                 taskDeviceOrientationChangedSignal?.Dispose();
506                 taskDeviceOrientationChangedSignal = null;
507             }
508
509             if (applicationTaskAppControlEventCallbackDelegate != null)
510             {
511                 taskAppControlSignal?.Disconnect(applicationTaskAppControlEventCallbackDelegate);
512                 taskAppControlSignal?.Dispose();
513                 taskAppControlSignal = null;
514             }
515
516             window?.Dispose();
517             window = null;
518
519             base.Dispose(type);
520         }
521         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
522         {
523             Interop.Application.DeleteApplication(swigCPtr);
524         }
525
526         public enum BatteryStatus
527         {
528             Normal,
529             CriticallyLow,
530             PowerOff
531         };
532
533         public enum MemoryStatus
534         {
535             Normal,
536             Low,
537             CriticallyLow
538         };
539
540         public enum DeviceOrientationStatus
541         {
542             Orientation_0 = 0,
543             Orientation_90 = 90,
544             Orientation_180 = 180,
545             Orientation_270 = 270
546         };
547
548         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
549         private delegate void NUIApplicationInitEventCallbackDelegate(IntPtr application);
550         private DaliEventHandler<object, NUIApplicationInitEventArgs> applicationInitEventHandler;
551         private NUIApplicationInitEventCallbackDelegate applicationInitEventCallbackDelegate;
552         private ApplicationSignal initSignal;
553
554         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
555         private delegate void NUIApplicationTerminateEventCallbackDelegate(IntPtr application);
556         private DaliEventHandler<object, NUIApplicationTerminatingEventArgs> applicationTerminateEventHandler;
557         private NUIApplicationTerminateEventCallbackDelegate applicationTerminateEventCallbackDelegate;
558         private ApplicationSignal terminateSignal;
559
560         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
561         private delegate void NUIApplicationPauseEventCallbackDelegate(IntPtr application);
562         private DaliEventHandler<object, NUIApplicationPausedEventArgs> applicationPauseEventHandler;
563         private NUIApplicationPauseEventCallbackDelegate applicationPauseEventCallbackDelegate;
564         private ApplicationSignal pauseSignal;
565
566         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
567         private delegate void NUIApplicationResumeEventCallbackDelegate(IntPtr application);
568         private DaliEventHandler<object, NUIApplicationResumedEventArgs> applicationResumeEventHandler;
569         private NUIApplicationResumeEventCallbackDelegate applicationResumeEventCallbackDelegate;
570         private ApplicationSignal resumeSignal;
571
572         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
573         private delegate void NUIApplicationResetEventCallbackDelegate(IntPtr application);
574         private DaliEventHandler<object, NUIApplicationResetEventArgs> applicationResetEventHandler;
575         private NUIApplicationResetEventCallbackDelegate applicationResetEventCallbackDelegate;
576         private ApplicationSignal resetSignal;
577
578         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
579         private delegate void NUIApplicationLanguageChangedEventCallbackDelegate(IntPtr application);
580         private DaliEventHandler<object, NUIApplicationLanguageChangedEventArgs> applicationLanguageChangedEventHandler;
581         private NUIApplicationLanguageChangedEventCallbackDelegate applicationLanguageChangedEventCallbackDelegate;
582         private ApplicationSignal languageChangedSignal;
583
584
585         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
586         private delegate void NUIApplicationRegionChangedEventCallbackDelegate(IntPtr application);
587         private DaliEventHandler<object, NUIApplicationRegionChangedEventArgs> applicationRegionChangedEventHandler;
588         private NUIApplicationRegionChangedEventCallbackDelegate applicationRegionChangedEventCallbackDelegate;
589         private ApplicationSignal regionChangedSignal;
590
591         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
592         private delegate void NUIApplicationBatteryLowEventCallbackDelegate(BatteryStatus status);
593         private DaliEventHandler<object, NUIApplicationBatteryLowEventArgs> applicationBatteryLowEventHandler;
594         private NUIApplicationBatteryLowEventCallbackDelegate applicationBatteryLowEventCallbackDelegate;
595         private LowBatterySignalType batteryLowSignal;
596
597         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
598         private delegate void NUIApplicationMemoryLowEventCallbackDelegate(MemoryStatus status);
599         private DaliEventHandler<object, NUIApplicationMemoryLowEventArgs> applicationMemoryLowEventHandler;
600         private NUIApplicationMemoryLowEventCallbackDelegate applicationMemoryLowEventCallbackDelegate;
601         private LowMemorySignalType memoryLowSignal;
602
603         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
604         private delegate void NUIApplicationDeviceOrientationChangedEventCallback(DeviceOrientationStatus status);
605         private DaliEventHandler<object, NUIApplicationDeviceOrientationChangedEventArgs> applicationDeviceOrientationChangedEventHandler;
606         private NUIApplicationDeviceOrientationChangedEventCallback applicationDeviceOrientationChangedEventCallback;
607         private DeviceOrientationChangedSignalType deviceOrientationChangedSignal;
608
609         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
610         private delegate void NUIApplicationAppControlEventCallbackDelegate(IntPtr application, IntPtr voidp);
611         private DaliEventHandler<object, NUIApplicationAppControlEventArgs> applicationAppControlEventHandler;
612         private NUIApplicationAppControlEventCallbackDelegate applicationAppControlEventCallbackDelegate;
613         private ApplicationControlSignal appControlSignal;
614
615         private DaliEventHandler<object, NUIApplicationInitEventArgs> applicationTaskInitEventHandler;
616         private NUIApplicationInitEventCallbackDelegate applicationTaskInitEventCallbackDelegate;
617         private ApplicationSignal taskInitSignal;
618
619         private DaliEventHandler<object, NUIApplicationTerminatingEventArgs> applicationTaskTerminateEventHandler;
620         private NUIApplicationTerminateEventCallbackDelegate applicationTaskTerminateEventCallbackDelegate;
621         private ApplicationSignal taskTerminateSignal;
622
623         private DaliEventHandler<object, NUIApplicationLanguageChangedEventArgs> applicationTaskLanguageChangedEventHandler;
624         private NUIApplicationLanguageChangedEventCallbackDelegate applicationTaskLanguageChangedEventCallbackDelegate;
625         private ApplicationSignal taskLanguageChangedSignal;
626
627         private DaliEventHandler<object, NUIApplicationRegionChangedEventArgs> applicationTaskRegionChangedEventHandler;
628         private NUIApplicationRegionChangedEventCallbackDelegate applicationTaskRegionChangedEventCallbackDelegate;
629         private ApplicationSignal taskRegionChangedSignal;
630
631         private DaliEventHandler<object, NUIApplicationBatteryLowEventArgs> applicationTaskBatteryLowEventHandler;
632         private NUIApplicationBatteryLowEventCallbackDelegate applicationTaskBatteryLowEventCallbackDelegate;
633         private LowBatterySignalType taskBatteryLowSignal;
634
635         private DaliEventHandler<object, NUIApplicationMemoryLowEventArgs> applicationTaskMemoryLowEventHandler;
636         private NUIApplicationMemoryLowEventCallbackDelegate applicationTaskMemoryLowEventCallbackDelegate;
637         private LowMemorySignalType taskMemoryLowSignal;
638
639         private DaliEventHandler<object, NUIApplicationDeviceOrientationChangedEventArgs> applicationTaskDeviceOrientationChangedEventHandler;
640         private NUIApplicationDeviceOrientationChangedEventCallback applicationTaskDeviceOrientationChangedEventCallback;
641         private DeviceOrientationChangedSignalType taskDeviceOrientationChangedSignal;
642
643         private DaliEventHandler<object, NUIApplicationAppControlEventArgs> applicationTaskAppControlEventHandler;
644         private NUIApplicationAppControlEventCallbackDelegate applicationTaskAppControlEventCallbackDelegate;
645         private ApplicationControlSignal taskAppControlSignal;
646
647         private Window window;
648
649         // Event for Initialized signal which can be used to subscribe/unsubscribe the event handler
650         // provided by the user. Initialized signal is emitted when application is initialized
651         public event DaliEventHandler<object, NUIApplicationInitEventArgs> Initialized
652         {
653             add
654             {
655                 // Restricted to only one listener
656                 if (applicationInitEventHandler == null)
657                 {
658                     applicationInitEventHandler += value;
659                     applicationInitEventCallbackDelegate = new NUIApplicationInitEventCallbackDelegate(OnApplicationInit);
660                     initSignal = this.InitSignal();
661                     initSignal?.Connect(applicationInitEventCallbackDelegate);
662                 }
663             }
664
665             remove
666             {
667                 if (applicationInitEventHandler != null)
668                 {
669                     initSignal?.Disconnect(applicationInitEventCallbackDelegate);
670                     initSignal?.Dispose();
671                     initSignal = null;
672                 }
673
674                 applicationInitEventHandler -= value;
675             }
676         }
677
678         // Callback for Application InitSignal
679         private void OnApplicationInit(IntPtr data)
680         {
681             Log.Info("NUI", "[NUI] OnApplicationInit: DisposeQueue Initialize");
682             Tizen.Tracer.Begin("[NUI] OnApplicationInit: DisposeQueue Initialize");
683             // Initialize DisposeQueue Singleton class. This is also required to create DisposeQueue on main thread.
684             DisposeQueue.Instance.Initialize();
685             Tizen.Tracer.End();
686
687             Log.Info("NUI", "[NUI] OnApplicationInit: GetWindow");
688             Tizen.Tracer.Begin("[NUI] OnApplicationInit: GetWindow");
689             Window.Instance = GetWindow();
690 #if !PROFILE_TV
691             //tv profile never use default focus indicator, so this is not needed!
692             _ = FocusManager.Instance;
693 #endif
694             Tizen.Tracer.End();
695
696             Log.Info("NUI", "[NUI] OnApplicationInit: Window Show");
697             Tizen.Tracer.Begin("[NUI] OnApplicationInit: Window Show");
698             // Notify that the window is displayed to the app core.
699             if (NUIApplication.IsPreload)
700             {
701                 Window.Instance.Show();
702             }
703             Tizen.Tracer.End();
704
705             Log.Info("NUI", "[NUI] OnApplicationInit: applicationInitEventHandler Invoke");
706             Tizen.Tracer.Begin("[NUI] OnApplicationInit: applicationInitEventHandler Invoke");
707             if (applicationInitEventHandler != null)
708             {
709                 NUIApplicationInitEventArgs e = new NUIApplicationInitEventArgs();
710                 e.Application = this;
711                 applicationInitEventHandler.Invoke(this, e);
712             }
713             Tizen.Tracer.End();
714         }
715
716         // Event for Terminated signal which can be used to subscribe/unsubscribe the event handler
717         //  provided by the user. Terminated signal is emitted when application is terminating
718         public event DaliEventHandler<object, NUIApplicationTerminatingEventArgs> Terminating
719         {
720             add
721             {
722                 // Restricted to only one listener
723                 if (applicationTerminateEventHandler == null)
724                 {
725                     applicationTerminateEventHandler += value;
726
727                     applicationTerminateEventCallbackDelegate = new NUIApplicationTerminateEventCallbackDelegate(OnNUIApplicationTerminate);
728                     terminateSignal = this.TerminateSignal();
729                     terminateSignal?.Connect(applicationTerminateEventCallbackDelegate);
730                 }
731             }
732
733             remove
734             {
735                 if (applicationTerminateEventHandler != null)
736                 {
737                     terminateSignal?.Disconnect(applicationTerminateEventCallbackDelegate);
738                     terminateSignal?.Dispose();
739                     terminateSignal = null;
740                 }
741
742                 applicationTerminateEventHandler -= value;
743             }
744         }
745
746         // Callback for Application TerminateSignal
747         private void OnNUIApplicationTerminate(IntPtr data)
748         {
749             if (applicationTerminateEventHandler != null)
750             {
751                 NUIApplicationTerminatingEventArgs e = new NUIApplicationTerminatingEventArgs();
752                 e.Application = this;
753                 applicationTerminateEventHandler.Invoke(this, e);
754             }
755
756             List<Window> windows = GetWindowList();
757             foreach (Window window in windows)
758             {
759                 window?.DisconnectNativeSignals();
760             }
761         }
762
763         // Event for Paused signal which can be used to subscribe/unsubscribe the event handler
764         // provided by the user. Paused signal is emitted when application is paused
765         public event DaliEventHandler<object, NUIApplicationPausedEventArgs> Paused
766         {
767             add
768             {
769                 // Restricted to only one listener
770                 if (applicationPauseEventHandler == null)
771                 {
772                     applicationPauseEventHandler += value;
773
774                     applicationPauseEventCallbackDelegate = new NUIApplicationPauseEventCallbackDelegate(OnNUIApplicationPause);
775                     pauseSignal = this.PauseSignal();
776                     pauseSignal?.Connect(applicationPauseEventCallbackDelegate);
777                 }
778             }
779
780             remove
781             {
782                 if (applicationPauseEventHandler != null)
783                 {
784                     pauseSignal?.Disconnect(applicationPauseEventCallbackDelegate);
785                     pauseSignal?.Dispose();
786                     pauseSignal = null;
787                 }
788
789                 applicationPauseEventHandler -= value;
790             }
791         }
792
793         // Callback for Application PauseSignal
794         private void OnNUIApplicationPause(IntPtr data)
795         {
796             if (applicationPauseEventHandler != null)
797             {
798                 NUIApplicationPausedEventArgs e = new NUIApplicationPausedEventArgs();
799                 e.Application = this;
800                 applicationPauseEventHandler.Invoke(this, e);
801             }
802         }
803
804         // Event for Resumed signal which can be used to subscribe/unsubscribe the event handler
805         //  provided by the user. Resumed signal is emitted when application is resumed
806         public event DaliEventHandler<object, NUIApplicationResumedEventArgs> Resumed
807         {
808             add
809             {
810                 // Restricted to only one listener
811                 if (applicationResumeEventHandler == null)
812                 {
813                     applicationResumeEventHandler += value;
814
815                     applicationResumeEventCallbackDelegate = new NUIApplicationResumeEventCallbackDelegate(OnNUIApplicationResume);
816                     resumeSignal = this.ResumeSignal();
817                     resumeSignal?.Connect(applicationResumeEventCallbackDelegate);
818                 }
819             }
820
821             remove
822             {
823                 if (applicationResumeEventHandler != null)
824                 {
825                     resumeSignal?.Disconnect(applicationResumeEventCallbackDelegate);
826                     resumeSignal?.Dispose();
827                     resumeSignal = null;
828                 }
829
830                 applicationResumeEventHandler -= value;
831             }
832         }
833
834         // Callback for Application ResumeSignal
835         private void OnNUIApplicationResume(IntPtr data)
836         {
837             if (applicationResumeEventHandler != null)
838             {
839                 NUIApplicationResumedEventArgs e = new NUIApplicationResumedEventArgs();
840                 e.Application = this;
841                 applicationResumeEventHandler.Invoke(this, e);
842             }
843         }
844
845         // Event for Reset signal which can be used to subscribe/unsubscribe the event handler
846         //  provided by the user. Reset signal is emitted when application is reset
847         public new event DaliEventHandler<object, NUIApplicationResetEventArgs> Reset
848         {
849             add
850             {
851                 // Restricted to only one listener
852                 if (applicationResetEventHandler == null)
853                 {
854                     applicationResetEventHandler += value;
855
856                     applicationResetEventCallbackDelegate = new NUIApplicationResetEventCallbackDelegate(OnNUIApplicationReset);
857                     resetSignal = this.ResetSignal();
858                     resetSignal?.Connect(applicationResetEventCallbackDelegate);
859                 }
860             }
861
862             remove
863             {
864                 if (applicationResetEventHandler != null)
865                 {
866                     resetSignal?.Disconnect(applicationResetEventCallbackDelegate);
867                     resetSignal?.Dispose();
868                     resetSignal = null;
869                 }
870
871                 applicationResetEventHandler -= value;
872             }
873         }
874
875         // Callback for Application ResetSignal
876         private void OnNUIApplicationReset(IntPtr data)
877         {
878             if (applicationResetEventHandler != null)
879             {
880                 NUIApplicationResetEventArgs e = new NUIApplicationResetEventArgs();
881                 e.Application = this;
882                 applicationResetEventHandler.Invoke(this, e);
883             }
884         }
885
886         // Event for LanguageChanged signal which can be used to subscribe/unsubscribe the event handler
887         //  provided by the user. LanguageChanged signal is emitted when the region of the device is changed.
888         public event DaliEventHandler<object, NUIApplicationLanguageChangedEventArgs> LanguageChanged
889         {
890             add
891             {
892                 // Restricted to only one listener
893                 if (applicationLanguageChangedEventHandler == null)
894                 {
895                     applicationLanguageChangedEventHandler += value;
896
897                     applicationLanguageChangedEventCallbackDelegate = new NUIApplicationLanguageChangedEventCallbackDelegate(OnNUIApplicationLanguageChanged);
898                     languageChangedSignal = this.LanguageChangedSignal();
899                     languageChangedSignal?.Connect(applicationLanguageChangedEventCallbackDelegate);
900                 }
901             }
902
903             remove
904             {
905                 if (applicationLanguageChangedEventHandler != null)
906                 {
907                     languageChangedSignal?.Disconnect(applicationLanguageChangedEventCallbackDelegate);
908                     languageChangedSignal?.Dispose();
909                     languageChangedSignal = null;
910                 }
911
912                 applicationLanguageChangedEventHandler -= value;
913             }
914         }
915
916         // Callback for Application LanguageChangedSignal
917         private void OnNUIApplicationLanguageChanged(IntPtr data)
918         {
919             if (applicationLanguageChangedEventHandler != null)
920             {
921                 NUIApplicationLanguageChangedEventArgs e = new NUIApplicationLanguageChangedEventArgs();
922                 e.Application = this;
923                 applicationLanguageChangedEventHandler.Invoke(this, e);
924             }
925         }
926
927         // Event for RegionChanged signal which can be used to subscribe/unsubscribe the event handler
928         //  provided by the user. RegionChanged signal is emitted when the region of the device is changed.
929         public event DaliEventHandler<object, NUIApplicationRegionChangedEventArgs> RegionChanged
930         {
931             add
932             {
933                 // Restricted to only one listener
934                 if (applicationRegionChangedEventHandler == null)
935                 {
936                     applicationRegionChangedEventHandler += value;
937
938                     applicationRegionChangedEventCallbackDelegate = new NUIApplicationRegionChangedEventCallbackDelegate(OnNUIApplicationRegionChanged);
939                     regionChangedSignal = this.RegionChangedSignal();
940                     regionChangedSignal?.Connect(applicationRegionChangedEventCallbackDelegate);
941                 }
942             }
943
944             remove
945             {
946                 if (applicationRegionChangedEventHandler != null)
947                 {
948                     regionChangedSignal?.Disconnect(applicationRegionChangedEventCallbackDelegate);
949                     regionChangedSignal?.Dispose();
950                     regionChangedSignal = null;
951                 }
952
953                 applicationRegionChangedEventHandler -= value;
954             }
955         }
956
957         // Callback for Application RegionChangedSignal
958         private void OnNUIApplicationRegionChanged(IntPtr data)
959         {
960             if (applicationRegionChangedEventHandler != null)
961             {
962                 NUIApplicationRegionChangedEventArgs e = new NUIApplicationRegionChangedEventArgs();
963                 e.Application = this;
964                 applicationRegionChangedEventHandler.Invoke(this, e);
965             }
966         }
967
968         // Event for BatteryLow signal which can be used to subscribe/unsubscribe the event handler
969         // provided by the user. BatteryLow signal is emitted when the battery level of the device is low.
970         public event DaliEventHandler<object, NUIApplicationBatteryLowEventArgs> BatteryLow
971         {
972             add
973             {
974                 // Restricted to only one listener
975                 if (applicationBatteryLowEventHandler == null)
976                 {
977                     applicationBatteryLowEventHandler += value;
978
979                     applicationBatteryLowEventCallbackDelegate = new NUIApplicationBatteryLowEventCallbackDelegate(OnNUIApplicationBatteryLow);
980                     batteryLowSignal = this.BatteryLowSignal();
981                     batteryLowSignal?.Connect(applicationBatteryLowEventCallbackDelegate);
982                 }
983             }
984
985             remove
986             {
987                 if (applicationBatteryLowEventHandler != null)
988                 {
989                     batteryLowSignal?.Disconnect(applicationBatteryLowEventCallbackDelegate);
990                     batteryLowSignal?.Dispose();
991                     batteryLowSignal = null;
992                 }
993
994                 applicationBatteryLowEventHandler -= value;
995             }
996         }
997
998         // Callback for Application BatteryLowSignal
999         private void OnNUIApplicationBatteryLow(BatteryStatus status)
1000         {
1001             NUIApplicationBatteryLowEventArgs e = new NUIApplicationBatteryLowEventArgs();
1002
1003             // Populate all members of "e" (NUIApplicationBatteryLowEventArgs) with real data
1004             e.BatteryStatus = status;
1005             applicationBatteryLowEventHandler?.Invoke(this, e);
1006         }
1007
1008         // Event for MemoryLow signal which can be used to subscribe/unsubscribe the event handler
1009         //  provided by the user. MemoryLow signal is emitted when the memory level of the device is low.
1010         public event DaliEventHandler<object, NUIApplicationMemoryLowEventArgs> MemoryLow
1011         {
1012             add
1013             {
1014                 // Restricted to only one listener
1015                 if (applicationMemoryLowEventHandler == null)
1016                 {
1017                     applicationMemoryLowEventHandler += value;
1018
1019                     applicationMemoryLowEventCallbackDelegate = new NUIApplicationMemoryLowEventCallbackDelegate(OnNUIApplicationMemoryLow);
1020                     memoryLowSignal = this.MemoryLowSignal();
1021                     memoryLowSignal?.Connect(applicationMemoryLowEventCallbackDelegate);
1022                 }
1023             }
1024
1025             remove
1026             {
1027                 if (applicationMemoryLowEventHandler != null)
1028                 {
1029                     memoryLowSignal?.Disconnect(applicationMemoryLowEventCallbackDelegate);
1030                     memoryLowSignal?.Dispose();
1031                     memoryLowSignal = null;
1032                 }
1033
1034                 applicationMemoryLowEventHandler -= value;
1035             }
1036         }
1037
1038         // Callback for Application MemoryLowSignal
1039         private void OnNUIApplicationMemoryLow(MemoryStatus status)
1040         {
1041             NUIApplicationMemoryLowEventArgs e = new NUIApplicationMemoryLowEventArgs();
1042
1043             // Populate all members of "e" (NUIApplicationMemoryLowEventArgs) with real data
1044             e.MemoryStatus = status;
1045             applicationMemoryLowEventHandler?.Invoke(this, e);
1046         }
1047
1048         // Event for changing Device orientation signal which can be used to subscribe/unsubscribe the event handler
1049         //  provided by the user. DeviceOrientationChanged signal is emitted when the device orientation is changed.
1050         public event DaliEventHandler<object, NUIApplicationDeviceOrientationChangedEventArgs> DeviceOrientationChanged
1051         {
1052             add
1053             {
1054                 // Restricted to only one listener
1055                 if (applicationDeviceOrientationChangedEventHandler == null)
1056                 {
1057                     applicationDeviceOrientationChangedEventHandler += value;
1058
1059                     applicationDeviceOrientationChangedEventCallback = new NUIApplicationDeviceOrientationChangedEventCallback(OnNUIApplicationDeviceOrientationChanged);
1060                     deviceOrientationChangedSignal = this.DeviceOrientationChangedSignal();
1061                     deviceOrientationChangedSignal?.Connect(applicationDeviceOrientationChangedEventCallback);
1062                 }
1063             }
1064
1065             remove
1066             {
1067                 if (applicationDeviceOrientationChangedEventHandler != null)
1068                 {
1069                     deviceOrientationChangedSignal?.Disconnect(applicationDeviceOrientationChangedEventCallback);
1070                     deviceOrientationChangedSignal?.Dispose();
1071                     deviceOrientationChangedSignal = null;
1072                 }
1073
1074                 applicationDeviceOrientationChangedEventHandler -= value;
1075             }
1076         }
1077
1078         // Callback for Application DeviceOrientationChangedSignal
1079         private void OnNUIApplicationDeviceOrientationChanged(DeviceOrientationStatus status)
1080         {
1081             NUIApplicationDeviceOrientationChangedEventArgs e = new NUIApplicationDeviceOrientationChangedEventArgs();
1082
1083             e.DeviceOrientationStatus = status;
1084             applicationDeviceOrientationChangedEventHandler?.Invoke(this, e);
1085         }
1086
1087         // Event for AppControl signal which can be used to subscribe/unsubscribe the event handler
1088         //  provided by the user. AppControl signal is emitted when another application sends a launch request to the application.
1089         public event DaliEventHandler<object, NUIApplicationAppControlEventArgs> AppControl
1090         {
1091             add
1092             {
1093                 // Restricted to only one listener
1094                 if (applicationAppControlEventHandler == null)
1095                 {
1096                     applicationAppControlEventHandler += value;
1097
1098                     applicationAppControlEventCallbackDelegate = new NUIApplicationAppControlEventCallbackDelegate(OnNUIApplicationAppControl);
1099                     appControlSignal = this.AppControlSignal();
1100                     appControlSignal?.Connect(applicationAppControlEventCallbackDelegate);
1101                 }
1102             }
1103
1104             remove
1105             {
1106                 if (applicationAppControlEventHandler != null)
1107                 {
1108                     appControlSignal?.Disconnect(applicationAppControlEventCallbackDelegate);
1109                     appControlSignal?.Dispose();
1110                     appControlSignal = null;
1111                 }
1112
1113                 applicationAppControlEventHandler -= value;
1114             }
1115         }
1116
1117         // Callback for Application AppControlSignal
1118         private void OnNUIApplicationAppControl(IntPtr application, IntPtr voidp)
1119         {
1120             if (applicationAppControlEventHandler != null)
1121             {
1122                 NUIApplicationAppControlEventArgs e = new NUIApplicationAppControlEventArgs();
1123                 e.VoidP = voidp;
1124                 e.Application = this;
1125                 applicationAppControlEventHandler.Invoke(this, e);
1126             }
1127         }
1128
1129         /// <summary>
1130         /// Event for Initialized signal which can be used to subscribe/unsubscribe the event handler
1131         ///  provided by the user. Initialized signal is emitted when application is initialized
1132         /// </summary>
1133         public event DaliEventHandler<object, NUIApplicationInitEventArgs> TaskInitialized
1134         {
1135             add
1136             {
1137                 // Restricted to only one listener
1138                 if (applicationTaskInitEventHandler == null)
1139                 {
1140                     Tizen.Log.Fatal("NUI", "TaskInitialized Property adding");
1141                     applicationTaskInitEventHandler += value;
1142                     applicationTaskInitEventCallbackDelegate = new NUIApplicationInitEventCallbackDelegate(OnApplicationTaskInit);
1143                     taskInitSignal = this.TaskInitSignal();
1144                     taskInitSignal?.Connect(applicationTaskInitEventCallbackDelegate);
1145                 }
1146             }
1147
1148             remove
1149             {
1150                 if (applicationTaskInitEventHandler != null)
1151                 {
1152                     taskInitSignal?.Disconnect(applicationTaskInitEventCallbackDelegate);
1153                     taskInitSignal?.Dispose();
1154                     taskInitSignal = null;
1155                 }
1156
1157                 applicationTaskInitEventHandler -= value;
1158             }
1159         }
1160
1161         private void OnApplicationTaskInit(IntPtr data)
1162         {
1163             if (applicationTaskInitEventHandler != null)
1164             {
1165                 NUIApplicationInitEventArgs e = new NUIApplicationInitEventArgs();
1166                 e.Application = this;
1167                 applicationTaskInitEventHandler.Invoke(this, e);
1168             }
1169
1170         }
1171
1172         /// <summary>
1173         /// Event for Terminated signal which can be used to subscribe/unsubscribe the event handler
1174         ///  provided by the user. Terminated signal is emitted when application is terminating
1175         /// </summary>
1176         public event DaliEventHandler<object, NUIApplicationTerminatingEventArgs> TaskTerminating
1177         {
1178             add
1179             {
1180                 // Restricted to only one listener
1181                 if (applicationTaskTerminateEventHandler == null)
1182                 {
1183                     applicationTaskTerminateEventHandler += value;
1184
1185                     applicationTaskTerminateEventCallbackDelegate = new NUIApplicationTerminateEventCallbackDelegate(OnNUIApplicationTaskTerminate);
1186                     taskTerminateSignal = this.TaskTerminateSignal();
1187                     taskTerminateSignal?.Connect(applicationTaskTerminateEventCallbackDelegate);
1188                 }
1189             }
1190
1191             remove
1192             {
1193                 if (applicationTaskTerminateEventHandler != null)
1194                 {
1195                     taskTerminateSignal?.Disconnect(applicationTaskTerminateEventCallbackDelegate);
1196                     taskTerminateSignal?.Dispose();
1197                     taskTerminateSignal = null;
1198                 }
1199
1200                 applicationTaskTerminateEventHandler -= value;
1201             }
1202         }
1203
1204         private void OnNUIApplicationTaskTerminate(IntPtr data)
1205         {
1206             if (applicationTaskTerminateEventHandler != null)
1207             {
1208                 NUIApplicationTerminatingEventArgs e = new NUIApplicationTerminatingEventArgs();
1209                 e.Application = this;
1210                 applicationTaskTerminateEventHandler.Invoke(this, e);
1211             }
1212         }
1213
1214         /// <summary>
1215         /// Event for TaskLanguageChanged signal which can be used to subscribe/unsubscribe the event handler
1216         ///  provided by the user. TaskLanguageChanged signal is emitted when the region of the device is changed.
1217         /// </summary>
1218         public event DaliEventHandler<object, NUIApplicationLanguageChangedEventArgs> TaskLanguageChanged
1219         {
1220             add
1221             {
1222                 // Restricted to only one listener
1223                 if (applicationTaskLanguageChangedEventHandler == null)
1224                 {
1225                     applicationTaskLanguageChangedEventHandler += value;
1226
1227                     applicationTaskLanguageChangedEventCallbackDelegate = new NUIApplicationLanguageChangedEventCallbackDelegate(OnNUIApplicationTaskLanguageChanged);
1228                     taskLanguageChangedSignal = this.TaskLanguageChangedSignal();
1229                     taskLanguageChangedSignal?.Connect(applicationTaskLanguageChangedEventCallbackDelegate);
1230                 }
1231             }
1232
1233             remove
1234             {
1235                 if (applicationTaskLanguageChangedEventHandler != null)
1236                 {
1237                     taskLanguageChangedSignal?.Disconnect(applicationTaskLanguageChangedEventCallbackDelegate);
1238                     taskLanguageChangedSignal?.Dispose();
1239                     taskLanguageChangedSignal = null;
1240                 }
1241
1242                 applicationTaskLanguageChangedEventHandler -= value;
1243             }
1244         }
1245
1246         private void OnNUIApplicationTaskLanguageChanged(IntPtr data)
1247         {
1248             if (applicationTaskLanguageChangedEventHandler != null)
1249             {
1250                 NUIApplicationLanguageChangedEventArgs e = new NUIApplicationLanguageChangedEventArgs();
1251                 e.Application = this;
1252                 applicationTaskLanguageChangedEventHandler.Invoke(this, e);
1253             }
1254         }
1255
1256         /// <summary>
1257         /// Event for TaskRegionChanged signal which can be used to subscribe/unsubscribe the event handler
1258         ///  provided by the user. TaskRegionChanged signal is emitted when the region of the device is changed.
1259         /// </summary>
1260         public event DaliEventHandler<object, NUIApplicationRegionChangedEventArgs> TaskRegionChanged
1261         {
1262             add
1263             {
1264                 // Restricted to only one listener
1265                 if (applicationTaskRegionChangedEventHandler == null)
1266                 {
1267                     applicationTaskRegionChangedEventHandler += value;
1268
1269                     applicationTaskRegionChangedEventCallbackDelegate = new NUIApplicationRegionChangedEventCallbackDelegate(OnNUIApplicationTaskRegionChanged);
1270                     taskRegionChangedSignal = this.TaskRegionChangedSignal();
1271                     taskRegionChangedSignal?.Connect(applicationTaskRegionChangedEventCallbackDelegate);
1272                 }
1273             }
1274
1275             remove
1276             {
1277                 if (applicationTaskRegionChangedEventHandler != null)
1278                 {
1279                     taskRegionChangedSignal?.Disconnect(applicationTaskRegionChangedEventCallbackDelegate);
1280                     taskRegionChangedSignal?.Dispose();
1281                     taskRegionChangedSignal = null;
1282                 }
1283
1284                 applicationTaskRegionChangedEventHandler -= value;
1285             }
1286         }
1287
1288         private void OnNUIApplicationTaskRegionChanged(IntPtr data)
1289         {
1290             if (applicationTaskRegionChangedEventHandler != null)
1291             {
1292                 NUIApplicationRegionChangedEventArgs e = new NUIApplicationRegionChangedEventArgs();
1293                 e.Application = this;
1294                 applicationTaskRegionChangedEventHandler.Invoke(this, e);
1295             }
1296         }
1297
1298         /// <summary>
1299         /// Event for TaskBatteryLow signal which can be used to subscribe/unsubscribe the event handler
1300         /// provided by the user. TaskBatteryLow signal is emitted when the battery level of the device is low.
1301         /// </summary>
1302         public event DaliEventHandler<object, NUIApplicationBatteryLowEventArgs> TaskBatteryLow
1303         {
1304             add
1305             {
1306                 // Restricted to only one listener
1307                 if (applicationTaskBatteryLowEventHandler == null)
1308                 {
1309                     applicationTaskBatteryLowEventHandler += value;
1310
1311                     applicationTaskBatteryLowEventCallbackDelegate = new NUIApplicationBatteryLowEventCallbackDelegate(OnNUIApplicationTaskBatteryLow);
1312                     taskBatteryLowSignal = this.TaskBatteryLowSignal();
1313                     taskBatteryLowSignal?.Connect(applicationTaskBatteryLowEventCallbackDelegate);
1314                 }
1315             }
1316
1317             remove
1318             {
1319                 if (applicationTaskBatteryLowEventHandler != null)
1320                 {
1321                     taskBatteryLowSignal?.Disconnect(applicationTaskBatteryLowEventCallbackDelegate);
1322                     taskBatteryLowSignal?.Dispose();
1323                     taskBatteryLowSignal = null;
1324                 }
1325
1326                 applicationTaskBatteryLowEventHandler -= value;
1327             }
1328         }
1329
1330         private void OnNUIApplicationTaskBatteryLow(BatteryStatus status)
1331         {
1332             NUIApplicationBatteryLowEventArgs e = new NUIApplicationBatteryLowEventArgs();
1333
1334             // Populate all members of "e" (NUIApplicationBatteryLowEventArgs) with real data
1335             e.BatteryStatus = status;
1336             applicationTaskBatteryLowEventHandler?.Invoke(this, e);
1337         }
1338
1339         /// <summary>
1340         /// Event for TaskMemoryLow signal which can be used to subscribe/unsubscribe the event handler
1341         /// provided by the user. TaskMemoryLow signal is emitted when the memory level of the device is low.
1342         /// </summary>
1343         public event DaliEventHandler<object, NUIApplicationMemoryLowEventArgs> TaskMemoryLow
1344         {
1345             add
1346             {
1347                 // Restricted to only one listener
1348                 if (applicationTaskMemoryLowEventHandler == null)
1349                 {
1350                     applicationTaskMemoryLowEventHandler += value;
1351
1352                     applicationTaskMemoryLowEventCallbackDelegate = new NUIApplicationMemoryLowEventCallbackDelegate(OnNUIApplicationTaskMemoryLow);
1353                     taskMemoryLowSignal = this.TaskMemoryLowSignal();
1354                     taskMemoryLowSignal?.Connect(applicationTaskMemoryLowEventCallbackDelegate);
1355                 }
1356             }
1357
1358             remove
1359             {
1360                 if (applicationTaskMemoryLowEventHandler != null)
1361                 {
1362                     taskMemoryLowSignal?.Disconnect(applicationTaskMemoryLowEventCallbackDelegate);
1363                     taskMemoryLowSignal?.Dispose();
1364                     taskMemoryLowSignal = null;
1365                 }
1366
1367                 applicationTaskMemoryLowEventHandler -= value;
1368             }
1369         }
1370
1371         private void OnNUIApplicationTaskMemoryLow(MemoryStatus status)
1372         {
1373             NUIApplicationMemoryLowEventArgs e = new NUIApplicationMemoryLowEventArgs();
1374
1375             // Populate all members of "e" (NUIApplicationMemoryLowEventArgs) with real data
1376             e.MemoryStatus = status;
1377             applicationTaskMemoryLowEventHandler?.Invoke(this, e);
1378         }
1379
1380         /// <summary>
1381         /// Event for TaskDeviceOrientationChanged signal which can be used to subscribe/unsubscribe the event handler
1382         /// provided by the user. TaskDeviceOrientationChanged signal is emitted when the device orientation is changed.
1383         /// </summary>
1384         public event DaliEventHandler<object, NUIApplicationDeviceOrientationChangedEventArgs> TaskDeviceOrientationChanged
1385         {
1386             add
1387             {
1388                 if (applicationTaskDeviceOrientationChangedEventHandler == null)
1389                 {
1390                     applicationTaskDeviceOrientationChangedEventHandler += value;
1391
1392                     applicationTaskDeviceOrientationChangedEventCallback = new NUIApplicationDeviceOrientationChangedEventCallback(OnNUIApplicationTaskDeviceOrientationChanged);
1393                     taskDeviceOrientationChangedSignal = this.TaskDeviceOrientationChangedSignal();
1394                     taskDeviceOrientationChangedSignal?.Connect(applicationTaskDeviceOrientationChangedEventCallback);
1395                 }
1396             }
1397
1398             remove
1399             {
1400                 if (applicationTaskDeviceOrientationChangedEventHandler != null)
1401                 {
1402                     taskDeviceOrientationChangedSignal?.Disconnect(applicationTaskDeviceOrientationChangedEventCallback);
1403                     taskDeviceOrientationChangedSignal?.Dispose();
1404                     taskDeviceOrientationChangedSignal = null;
1405                 }
1406
1407                 applicationTaskDeviceOrientationChangedEventHandler -= value;
1408             }
1409         }
1410
1411         private void OnNUIApplicationTaskDeviceOrientationChanged(DeviceOrientationStatus status)
1412         {
1413             NUIApplicationDeviceOrientationChangedEventArgs e = new NUIApplicationDeviceOrientationChangedEventArgs();
1414
1415             e.DeviceOrientationStatus = status;
1416             applicationTaskDeviceOrientationChangedEventHandler?.Invoke(this, e);
1417         }
1418
1419         /// <summary>
1420         /// Event for TaskAppControl signal which can be used to subscribe/unsubscribe the event handler
1421         /// provided by the user. TaskAppControl signal is emitted when another application sends a launch request to the application.
1422         /// </summary>
1423         public event DaliEventHandler<object, NUIApplicationAppControlEventArgs> TaskAppControl
1424         {
1425             add
1426             {
1427                 // Restricted to only one listener
1428                 if (applicationTaskAppControlEventHandler == null)
1429                 {
1430                     applicationTaskAppControlEventHandler += value;
1431
1432                     applicationTaskAppControlEventCallbackDelegate = new NUIApplicationAppControlEventCallbackDelegate(OnNUIApplicationTaskAppControl);
1433                     taskAppControlSignal = this.TaskAppControlSignal();
1434                     taskAppControlSignal?.Connect(applicationTaskAppControlEventCallbackDelegate);
1435                 }
1436             }
1437
1438             remove
1439             {
1440                 if (applicationTaskAppControlEventHandler != null)
1441                 {
1442                     taskAppControlSignal?.Disconnect(applicationTaskAppControlEventCallbackDelegate);
1443                     taskAppControlSignal?.Dispose();
1444                     taskAppControlSignal = null;
1445                 }
1446
1447                 applicationTaskAppControlEventHandler -= value;
1448             }
1449         }
1450
1451         private void OnNUIApplicationTaskAppControl(IntPtr application, IntPtr voidp)
1452         {
1453             if (applicationTaskAppControlEventHandler != null)
1454             {
1455                 NUIApplicationAppControlEventArgs e = new NUIApplicationAppControlEventArgs();
1456                 e.VoidP = voidp;
1457                 e.Application = this;
1458                 applicationTaskAppControlEventHandler.Invoke(this, e);
1459             }
1460         }
1461
1462         protected static Application instance; // singleton
1463
1464         public static Application Instance
1465         {
1466             get
1467             {
1468                 return instance;
1469             }
1470         }
1471
1472         public static Application GetApplicationFromPtr(global::System.IntPtr cPtr)
1473         {
1474             if (cPtr == global::System.IntPtr.Zero)
1475             {
1476                 return null;
1477             }
1478
1479             Application ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Application;
1480             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1481             return ret;
1482         }
1483
1484         public static Application NewApplication()
1485         {
1486             return NewApplication("", NUIApplication.WindowMode.Opaque);
1487         }
1488
1489         public static Application NewApplication(string stylesheet)
1490         {
1491             return NewApplication(stylesheet, NUIApplication.WindowMode.Opaque);
1492         }
1493
1494         public static Application NewApplication(string stylesheet, NUIApplication.WindowMode windowMode)
1495         {
1496             // register all Views with the type registry, so that can be created / styled via JSON
1497             //ViewRegistryHelper.Initialize(); //moved to Application side.
1498             if (instance != null)
1499             {
1500                 return instance;
1501             }
1502
1503             Application ret = New(1, stylesheet, windowMode);
1504             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1505
1506             // set the singleton
1507             instance = ret;
1508             return ret;
1509         }
1510
1511         public static Application NewApplication(string stylesheet, NUIApplication.WindowMode windowMode, Rectangle positionSize)
1512         {
1513             if (instance != null)
1514             {
1515                 return instance;
1516             }
1517             Application ret = New(1, stylesheet, windowMode, positionSize);
1518             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1519
1520             // set the singleton
1521             instance = ret;
1522             return ret;
1523         }
1524
1525         public static Application NewApplication(string[] args, string stylesheet, NUIApplication.WindowMode windowMode)
1526         {
1527             if (instance != null)
1528             {
1529                 return instance;
1530             }
1531             Application ret = New(args, stylesheet, windowMode);
1532             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1533
1534             // set the singleton
1535             instance = ret;
1536             return instance;
1537         }
1538
1539         public static Application NewApplication(string[] args, string stylesheet, NUIApplication.WindowMode windowMode, Rectangle positionSize)
1540         {
1541             if (instance != null)
1542             {
1543                 return instance;
1544             }
1545             Application ret = New(args, stylesheet, windowMode, positionSize);
1546             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1547
1548             // set the singleton
1549             instance = ret;
1550             return instance;
1551         }
1552
1553         public static Application NewApplication(string stylesheet, NUIApplication.WindowMode windowMode, WindowType type)
1554         {
1555             if (instance != null)
1556             {
1557                 return instance;
1558             }
1559             Application ret = New(1, stylesheet, windowMode, type);
1560             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1561
1562             instance = ret;
1563             return instance;
1564         }
1565
1566         public static Application NewApplication(string[] args, string stylesheet, NUIApplication.WindowMode windowMode, Rectangle positionSize, bool useUIThread)
1567         {
1568             if (instance != null)
1569             {
1570                 return instance;
1571             }
1572             Application ret = New(args, stylesheet, windowMode, positionSize, useUIThread);
1573             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1574
1575             instance = ret;
1576             return instance;
1577         }
1578
1579         public static Application NewApplication(string[] args, string stylesheet, bool useUIThread, WindowData windowData)
1580         {
1581             if (instance != null)
1582             {
1583                 return instance;
1584             }
1585             Application ret = New(args, stylesheet, useUIThread, windowData);
1586             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1587
1588             instance = ret;
1589             return instance;
1590         }
1591
1592         /// <summary>
1593         /// Ensures that the function passed in is called from the main loop when it is idle.
1594         /// </summary>
1595         /// <param name="func">The function to call</param>
1596         /// <returns>true if added successfully, false otherwise</returns>
1597         /// <remarks>
1598         /// It will return false when one of the following conditions is met.
1599         /// 1) the <see cref="Window"/> is hidden.
1600         /// 2) the <see cref="Window"/> is iconified.
1601         /// </remarks>
1602         public bool AddIdle(System.Delegate func)
1603         {
1604             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
1605             System.IntPtr ip2 = Interop.Application.MakeCallback(new System.Runtime.InteropServices.HandleRef(this, ip));
1606
1607             bool ret = Interop.Application.AddIdle(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip2));
1608
1609             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1610             return ret;
1611         }
1612
1613         /**
1614         * Outer::outer_method(int)
1615         */
1616         public static Application New()
1617         {
1618             Application ret = new Application(Interop.Application.New(), true);
1619             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1620             return ret;
1621         }
1622
1623         public static Application New(int argc)
1624         {
1625             Application ret = new Application(Interop.Application.New(argc), true);
1626             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1627             return ret;
1628         }
1629
1630         public static Application New(int argc, string stylesheet)
1631         {
1632             Application ret = new Application(Interop.Application.New(argc, stylesheet), true);
1633             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1634             return ret;
1635         }
1636
1637         public static Application New(int argc, string stylesheet, NUIApplication.WindowMode windowMode)
1638         {
1639             Application ret = new Application(Interop.Application.New(argc, stylesheet, (int)windowMode), true);
1640             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1641             s_current = ret;
1642             return ret;
1643         }
1644
1645         public static Application New(string[] args, string stylesheet, NUIApplication.WindowMode windowMode)
1646         {
1647             Application ret = null;
1648             int argc = 0;
1649             string argvStr = "";
1650             try
1651             {
1652                 argc = args.Length;
1653                 argvStr = string.Join(" ", args);
1654             }
1655             catch (Exception exception)
1656             {
1657                 Tizen.Log.Fatal("NUI", "[Error] got exception during Application New(), this should not occur, message : " + exception.Message);
1658                 Tizen.Log.Fatal("NUI", "[Error] error line number : " + new StackTrace(exception, true).GetFrame(0).GetFileLineNumber());
1659                 Tizen.Log.Fatal("NUI", "[Error] Stack Trace : " + exception.StackTrace);
1660                 throw;
1661             }
1662
1663             ret = new Application(NDalicPINVOKE.ApplicationNewManual4(argc, argvStr, stylesheet, (int)windowMode), true);
1664             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1665
1666             return ret;
1667         }
1668
1669         public static Application New(int argc, string stylesheet, NUIApplication.WindowMode windowMode, Rectangle positionSize)
1670         {
1671             Application ret = new Application(Interop.Application.New(argc, stylesheet, (int)windowMode, Rectangle.getCPtr(positionSize)), true);
1672             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1673             return ret;
1674         }
1675
1676         public static Application New(string[] args, string stylesheet, NUIApplication.WindowMode windowMode, Rectangle positionSize)
1677         {
1678             Application ret = null;
1679             int argc = 0;
1680             string argvStr = "";
1681             try
1682             {
1683                 argc = args.Length;
1684                 argvStr = string.Join(" ", args);
1685             }
1686             catch (Exception exception)
1687             {
1688                 Tizen.Log.Fatal("NUI", "[Error] got exception during Application New(), this should not occur, message : " + exception.Message);
1689                 Tizen.Log.Fatal("NUI", "[Error] error line number : " + new StackTrace(exception, true).GetFrame(0).GetFileLineNumber());
1690                 Tizen.Log.Fatal("NUI", "[Error] Stack Trace : " + exception.StackTrace);
1691                 throw;
1692             }
1693
1694             ret = new Application(NDalicPINVOKE.ApplicationNewWithWindowSizePosition(argc, argvStr, stylesheet, (int)windowMode, Rectangle.getCPtr(positionSize)), true);
1695             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1696
1697             return ret;
1698         }
1699
1700         public static Application New(int argc, string stylesheet, NUIApplication.WindowMode windowMode, WindowType type)
1701         {
1702             // It will be removed until dali APIs are prepared.
1703             Rectangle initRectangle = new Rectangle(0, 0, 0, 0);
1704
1705             Application ret = new Application(Interop.Application.New(argc, stylesheet, (int)windowMode, Rectangle.getCPtr(initRectangle), (int)type), true);
1706             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1707             return ret;
1708         }
1709
1710         public static Application New(string[] args, string stylesheet, NUIApplication.WindowMode windowMode, Rectangle positionSize, bool useUIThread)
1711         {
1712             Application ret = null;
1713             int argc = 0;
1714             string argvStr = "";
1715             try
1716             {
1717                 argc = args.Length;
1718                 argvStr = string.Join(" ", args);
1719
1720                 ret = new Application(Interop.Application.New(argc, argvStr, stylesheet, (int)windowMode, Rectangle.getCPtr(positionSize), useUIThread), true);
1721                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1722             }
1723             catch (Exception exception)
1724             {
1725                 Tizen.Log.Fatal("NUI", "[Error] got exception during Application New(), this should not occur, message : " + exception.Message);
1726                 Tizen.Log.Fatal("NUI", "[Error] error line number : " + new StackTrace(exception, true).GetFrame(0).GetFileLineNumber());
1727                 Tizen.Log.Fatal("NUI", "[Error] Stack Trace : " + exception.StackTrace);
1728                 throw;
1729             }
1730
1731             return ret;
1732         }
1733
1734         public static Application New(string[] args, string stylesheet, bool useUIThread, WindowData windowData)
1735         {
1736             Application ret = null;
1737             int argc = 0;
1738             string argvStr = "";
1739             try
1740             {
1741                 argc = args.Length;
1742                 argvStr = string.Join(" ", args);
1743
1744                 ret = new Application(Interop.Application.New(argc, argvStr, stylesheet, useUIThread, WindowData.getCPtr(windowData)), true);
1745                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1746             }
1747             catch (Exception exception)
1748             {
1749                 Tizen.Log.Fatal("NUI", "[Error] got exception during Application New(), this should not occur, message : " + exception.Message);
1750                 Tizen.Log.Fatal("NUI", "[Error] error line number : " + new StackTrace(exception, true).GetFrame(0).GetFileLineNumber());
1751                 Tizen.Log.Fatal("NUI", "[Error] Stack Trace : " + exception.StackTrace);
1752                 throw;
1753             }
1754
1755             return ret;
1756         }
1757
1758         public Application() : this(Interop.Application.NewApplication(), true)
1759         {
1760             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1761         }
1762
1763         public Application(Application application) : this(Interop.Application.NewApplication(Application.getCPtr(application)), true)
1764         {
1765             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1766         }
1767
1768         public Application Assign(Application application)
1769         {
1770             Application ret = new Application(Interop.Application.Assign(SwigCPtr, Application.getCPtr(application)), false);
1771             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1772             return ret;
1773         }
1774
1775         public void MainLoop()
1776         {
1777             NDalicPINVOKE.ApplicationMainLoop(SwigCPtr);
1778             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1779         }
1780
1781         public void Lower()
1782         {
1783             Interop.Application.Lower(SwigCPtr);
1784             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1785         }
1786
1787         public void Quit()
1788         {
1789             Interop.Application.Quit(SwigCPtr);
1790             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1791         }
1792
1793         internal bool AddIdle(SWIGTYPE_p_Dali__CallbackBase callback)
1794         {
1795             bool ret = Interop.Application.AddIdle(SwigCPtr, SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback));
1796             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1797             return ret;
1798         }
1799
1800         public Window GetWindow()
1801         {
1802             if (window != null)
1803             {
1804                 return window;
1805             }
1806
1807             var nativeWindow = Interop.Application.GetWindow(SwigCPtr);
1808             window = Registry.GetManagedBaseHandleFromNativePtr(nativeWindow) as Window;
1809             if (window != null)
1810             {
1811                 HandleRef CPtr = new HandleRef(this, nativeWindow);
1812                 Interop.BaseHandle.DeleteBaseHandle(CPtr);
1813                 CPtr = new HandleRef(null, IntPtr.Zero);
1814             }
1815             else
1816             {
1817                 window = new Window(nativeWindow, true);
1818             }
1819
1820             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1821             return window;
1822         }
1823
1824         public static string GetResourcePath()
1825         {
1826             string ret = Interop.Application.GetResourcePath();
1827             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1828             return ret;
1829         }
1830
1831         public string GetLanguage()
1832         {
1833             string ret = Interop.Application.GetLanguage(SwigCPtr);
1834             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1835             return ret;
1836         }
1837
1838         public string GetRegion()
1839         {
1840             string ret = Interop.Application.GetRegion(SwigCPtr);
1841             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1842             return ret;
1843         }
1844
1845         [EditorBrowsable(EditorBrowsableState.Never)]
1846         public static List<Window> GetWindowList()
1847         {
1848             if (Interop.Stage.IsInstalled() == false)
1849             {
1850                 NUILog.ErrorBacktrace($"[ERROR] dali adaptor and dali window is not ready. just return NULL here");
1851                 return null;
1852             }
1853
1854             uint ListSize = Interop.Application.GetWindowsListSize();
1855             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1856
1857             List<Window> WindowList = new List<Window>();
1858             for (uint i = 0; i < ListSize; ++i)
1859             {
1860                 Window currWin = WindowList.GetInstanceSafely<Window>(Interop.Application.GetWindowsFromList(i));
1861                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1862                 if (currWin != null)
1863                 {
1864                     WindowList.Add(currWin);
1865                 }
1866             }
1867             return WindowList;
1868         }
1869
1870         internal ApplicationSignal InitSignal()
1871         {
1872             ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationInitSignal(SwigCPtr), false);
1873             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1874             return ret;
1875         }
1876
1877         internal ApplicationSignal TerminateSignal()
1878         {
1879             ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationTerminateSignal(SwigCPtr), false);
1880             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1881             return ret;
1882         }
1883
1884         internal ApplicationSignal PauseSignal()
1885         {
1886             ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationPauseSignal(SwigCPtr), false);
1887             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1888             return ret;
1889         }
1890
1891         internal ApplicationSignal ResumeSignal()
1892         {
1893             ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationResumeSignal(SwigCPtr), false);
1894             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1895             return ret;
1896         }
1897
1898         internal ApplicationSignal ResetSignal()
1899         {
1900             ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationResetSignal(SwigCPtr), false);
1901             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1902             return ret;
1903         }
1904
1905         internal ApplicationControlSignal AppControlSignal()
1906         {
1907             ApplicationControlSignal ret = new ApplicationControlSignal(NDalicPINVOKE.ApplicationAppControlSignal(SwigCPtr), false);
1908             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1909             return ret;
1910         }
1911
1912         internal ApplicationSignal LanguageChangedSignal()
1913         {
1914             ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationLanguageChangedSignal(SwigCPtr), false);
1915             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1916             return ret;
1917         }
1918
1919         internal ApplicationSignal RegionChangedSignal()
1920         {
1921             ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationRegionChangedSignal(SwigCPtr), false);
1922             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1923             return ret;
1924         }
1925
1926         internal LowBatterySignalType BatteryLowSignal()
1927         {
1928             LowBatterySignalType ret = new LowBatterySignalType(NDalicPINVOKE.ApplicationLowBatterySignal(SwigCPtr), false);
1929             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1930             return ret;
1931         }
1932
1933         internal LowMemorySignalType MemoryLowSignal()
1934         {
1935             LowMemorySignalType ret = new LowMemorySignalType(NDalicPINVOKE.ApplicationLowMemorySignal(SwigCPtr), false);
1936             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1937             return ret;
1938         }
1939
1940         internal DeviceOrientationChangedSignalType DeviceOrientationChangedSignal()
1941         {
1942             DeviceOrientationChangedSignalType ret = new DeviceOrientationChangedSignalType(NDalicPINVOKE.ApplicationDeviceOrientationChangedSignal(SwigCPtr), false);
1943             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1944             return ret;
1945         }
1946
1947         //Task
1948         internal ApplicationSignal TaskInitSignal()
1949         {
1950             ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationTaskInitSignal(SwigCPtr), false);
1951             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1952             return ret;
1953         }
1954
1955         internal ApplicationSignal TaskTerminateSignal()
1956         {
1957             ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationTaskTerminateSignal(SwigCPtr), false);
1958             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1959             return ret;
1960         }
1961
1962         internal ApplicationControlSignal TaskAppControlSignal()
1963         {
1964             ApplicationControlSignal ret = new ApplicationControlSignal(NDalicPINVOKE.ApplicationTaskAppControlSignal(SwigCPtr), false);
1965             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1966             return ret;
1967         }
1968
1969         internal ApplicationSignal TaskLanguageChangedSignal()
1970         {
1971             ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationTaskLanguageChangedSignal(SwigCPtr), false);
1972             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1973             return ret;
1974         }
1975
1976         internal ApplicationSignal TaskRegionChangedSignal()
1977         {
1978             ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationTaskRegionChangedSignal(SwigCPtr), false);
1979             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1980             return ret;
1981         }
1982
1983         internal LowBatterySignalType TaskBatteryLowSignal()
1984         {
1985             LowBatterySignalType ret = new LowBatterySignalType(NDalicPINVOKE.ApplicationTaskLowBatterySignal(SwigCPtr), false);
1986             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1987             return ret;
1988         }
1989
1990         internal LowMemorySignalType TaskMemoryLowSignal()
1991         {
1992             LowMemorySignalType ret = new LowMemorySignalType(NDalicPINVOKE.ApplicationTaskLowMemorySignal(SwigCPtr), false);
1993             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1994             return ret;
1995         }
1996
1997         internal DeviceOrientationChangedSignalType TaskDeviceOrientationChangedSignal()
1998         {
1999             DeviceOrientationChangedSignalType ret = new DeviceOrientationChangedSignalType(NDalicPINVOKE.ApplicationTaskDeviceOrientationChangedSignal(SwigCPtr), false);
2000             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2001             return ret;
2002         }
2003     }
2004 }