2d23bdd2a2aaf584edbc15a4c4e5e7ea731a5568
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / internal / Application.cs
1 /*
2  * Copyright(c) 2018 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 System.Threading;
24 using System.Threading.Tasks;
25 using Tizen.NUI.Binding;
26 using Tizen.NUI.Binding.Internals;
27
28 namespace Tizen.NUI
29 {
30     /**
31       * @brief Event arguments that passed via NUIApplicationInit signal
32       *
33       */
34     internal class NUIApplicationInitEventArgs : EventArgs
35     {
36         private Application _application;
37
38         /**
39           * @brief Application - is the application that is being initialized
40           *
41           */
42         public Application Application
43         {
44             get
45             {
46                 return _application;
47             }
48             set
49             {
50                 _application = value;
51             }
52         }
53     }
54
55     /**
56       * @brief Event arguments that passed via NUIApplicationTerminate signal
57       *
58       */
59     internal class NUIApplicationTerminatingEventArgs : EventArgs
60     {
61         private Application _application;
62         /**
63           * @brief Application - is the application that is being Terminated
64           *
65           */
66         public Application Application
67         {
68             get
69             {
70                 return _application;
71             }
72             set
73             {
74                 _application = value;
75             }
76         }
77     }
78
79     /**
80       * @brief Event arguments that passed via NUIApplicationPause signal
81       *
82       */
83     internal class NUIApplicationPausedEventArgs : EventArgs
84     {
85         private Application _application;
86         /**
87           * @brief Application - is the application that is being Paused
88           *
89           */
90         public Application Application
91         {
92             get
93             {
94                 return _application;
95             }
96             set
97             {
98                 _application = value;
99             }
100         }
101     }
102
103     /**
104       * @brief Event arguments that passed via NUIApplicationResume signal
105       *
106       */
107     internal class NUIApplicationResumedEventArgs : EventArgs
108     {
109         private Application _application;
110         /**
111           * @brief Application - is the application that is being Resumed
112           *
113           */
114         public Application Application
115         {
116             get
117             {
118                 return _application;
119             }
120             set
121             {
122                 _application = value;
123             }
124         }
125     }
126
127     /**
128       * @brief Event arguments that passed via NUIApplicationReset signal
129       *
130       */
131     internal class NUIApplicationResetEventArgs : EventArgs
132     {
133         private Application _application;
134         /**
135           * @brief Application - is the application that is being Reset
136           *
137           */
138         public Application Application
139         {
140             get
141             {
142                 return _application;
143             }
144             set
145             {
146                 _application = value;
147             }
148         }
149     }
150
151     /**
152       * @brief Event arguments that passed via NUIApplicationLanguageChanged signal
153       *
154       */
155     internal class NUIApplicationLanguageChangedEventArgs : EventArgs
156     {
157         private Application _application;
158         /**
159           * @brief Application - is the application that is being affected with Device's language change
160           *
161           */
162         public Application Application
163         {
164             get
165             {
166                 return _application;
167             }
168             set
169             {
170                 _application = value;
171             }
172         }
173     }
174
175     /**
176       * @brief Event arguments that passed via NUIApplicationRegionChanged signal
177       *
178       */
179     internal class NUIApplicationRegionChangedEventArgs : EventArgs
180     {
181         private Application _application;
182         /**
183           * @brief Application - is the application that is being affected with Device's region change
184           *
185           */
186         public Application Application
187         {
188             get
189             {
190                 return _application;
191             }
192             set
193             {
194                 _application = value;
195             }
196         }
197     }
198
199     /**
200       * @brief Event arguments that passed via NUIApplicationBatteryLow signal
201       *
202       */
203     internal class NUIApplicationBatteryLowEventArgs : EventArgs
204     {
205         private Application.BatteryStatus _status;
206         /**
207           * @brief Application - is the application that is being affected when the battery level of the device is low
208           *
209           */
210         public Application.BatteryStatus BatteryStatus
211         {
212             get
213             {
214                 return _status;
215             }
216             set
217             {
218                 _status = value;
219             }
220         }
221     }
222
223     /**
224       * @brief Event arguments that passed via NUIApplicationMemoryLow signal
225       *
226       */
227     internal class NUIApplicationMemoryLowEventArgs : EventArgs
228     {
229         private Application.MemoryStatus _status;
230         /**
231           * @brief Application - is the application that is being affected when the memory level of the device is low
232           *
233           */
234         public Application.MemoryStatus MemoryStatus
235         {
236             get
237             {
238                 return _status;
239             }
240             set
241             {
242                 _status = value;
243             }
244         }
245     }
246
247     /**
248       * @brief Event arguments that passed via NUIApplicationAppControl  signal
249       *
250       */
251     internal class NUIApplicationAppControlEventArgs : EventArgs
252     {
253         private Application _application;
254         private IntPtr _voidp;
255         /**
256           * @brief Application - is the application that is receiving the launch request from another application
257           *
258           */
259         public Application Application
260         {
261             get
262             {
263                 return _application;
264             }
265             set
266             {
267                 _application = value;
268             }
269         }
270         /**
271           * @brief VoidP - contains the information about why the application is launched
272           *
273           */
274         public IntPtr VoidP
275         {
276             get
277             {
278                 return _voidp;
279             }
280             set
281             {
282                 _voidp = value;
283             }
284         }
285     }
286
287     /// <summary>
288     /// A class to get resources in current application.
289     /// </summary>
290     public sealed class GetResourcesProvider
291     {
292         /// <summary>
293         /// Get resources in current application.
294         /// </summary>
295         static public IResourcesProvider Get()
296         {
297             return Tizen.NUI.Application.Current;
298         }
299     }
300
301     internal class Application : BaseHandle, IResourcesProvider, IElementConfiguration<Application>
302     {
303
304         static Application s_current;
305
306         ReadOnlyCollection<Element> _logicalChildren;
307
308         [EditorBrowsable(EditorBrowsableState.Never)]
309         public static void SetCurrentApplication(Application value) => Current = value;
310
311         public static Application Current
312         {
313             get { return s_current; }
314             set
315             {
316                 if (s_current == value)
317                     return;
318                 if (value == null)
319                     s_current = null; //Allow to reset current for unittesting
320                 s_current = value;
321             }
322         }
323
324         internal override ReadOnlyCollection<Element> LogicalChildrenInternal
325         {
326             get { return _logicalChildren ?? (_logicalChildren = new ReadOnlyCollection<Element>(InternalChildren)); }
327         }
328
329         internal IResourceDictionary SystemResources { get; }
330
331         ObservableCollection<Element> InternalChildren { get; } = new ObservableCollection<Element>();
332
333         ResourceDictionary _resources;
334         public bool IsResourcesCreated => _resources != null;
335
336         public delegate void resChangeCb(object sender, ResourcesChangedEventArgs e);
337
338         static private Dictionary<object, Dictionary<resChangeCb, int>> resourceChangeCallbackDict = new Dictionary<object, Dictionary<resChangeCb, int>>();
339         static public void AddResourceChangedCallback(object handle, resChangeCb cb)
340         {
341             Dictionary<resChangeCb, int> cbDict;
342             resourceChangeCallbackDict.TryGetValue(handle, out cbDict);
343
344             if (null == cbDict)
345             {
346                 cbDict = new Dictionary<resChangeCb, int>();
347                 resourceChangeCallbackDict.Add(handle, cbDict);
348             }
349
350             if (false == cbDict.ContainsKey(cb))
351             {
352                 cbDict.Add(cb, 0);
353             }
354         }
355
356         internal override void OnResourcesChanged(object sender, ResourcesChangedEventArgs e)
357         {
358             base.OnResourcesChanged(sender, e);
359
360             foreach (KeyValuePair<object, Dictionary<resChangeCb, int>> resourcePair in resourceChangeCallbackDict)
361             {
362                 foreach (KeyValuePair<resChangeCb, int> cbPair in resourcePair.Value)
363                 {
364                     cbPair.Key(sender, e);
365                 }
366             }
367         }
368
369         public ResourceDictionary XamlResources
370         {
371             get
372             {
373                 if (_resources != null)
374                     return _resources;
375
376                 _resources = new ResourceDictionary();
377                 int hashCode = _resources.GetHashCode();
378                 ((IResourceDictionary)_resources).ValuesChanged += OnResourcesChanged;
379                 return _resources;
380             }
381             set
382             {
383                 if (_resources == value)
384                     return;
385                 OnPropertyChanging();
386
387                 if (_resources != null)
388                     ((IResourceDictionary)_resources).ValuesChanged -= OnResourcesChanged;
389                 _resources = value;
390                 OnResourcesChanged(value);
391                 if (_resources != null)
392                     ((IResourceDictionary)_resources).ValuesChanged += OnResourcesChanged;
393
394                 OnPropertyChanged();
395             }
396         }
397
398         protected override void OnParentSet()
399         {
400             throw new InvalidOperationException("Setting a Parent on Application is invalid.");
401         }
402
403         [EditorBrowsable(EditorBrowsableState.Never)]
404         public static bool IsApplicationOrNull(Element element)
405         {
406             return element == null || element is Application;
407         }
408
409         internal override void OnParentResourcesChanged(IEnumerable<KeyValuePair<string, object>> values)
410         {
411             if (!((IResourcesProvider)this).IsResourcesCreated || XamlResources.Count == 0)
412             {
413                 base.OnParentResourcesChanged(values);
414                 return;
415             }
416
417             var innerKeys = new HashSet<string>();
418             var changedResources = new List<KeyValuePair<string, object>>();
419             foreach (KeyValuePair<string, object> c in XamlResources)
420                 innerKeys.Add(c.Key);
421             foreach (KeyValuePair<string, object> value in values)
422             {
423                 if (innerKeys.Add(value.Key))
424                     changedResources.Add(value);
425             }
426             OnResourcesChanged(changedResources);
427         }
428
429
430         internal Application(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ApplicationUpcast(cPtr), cMemoryOwn)
431         {
432             SetCurrentApplication(this);
433
434
435             s_current = this;
436         }
437
438         internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Application obj)
439         {
440             return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
441         }
442
443         protected override void Dispose(DisposeTypes type)
444         {
445             if (disposed)
446             {
447                 return;
448             }
449
450             //Release your own unmanaged resources here.
451             //You should not access any managed member here except static instance.
452             //because the execution order of Finalizes is non-deterministic.
453
454             if (_applicationInitEventCallbackDelegate != null)
455             {
456                 initSignal?.Disconnect(_applicationInitEventCallbackDelegate);
457                 initSignal?.Dispose();
458                 initSignal = null;
459             }
460
461             if (_applicationTerminateEventCallbackDelegate != null)
462             {
463                 terminateSignal?.Disconnect(_applicationTerminateEventCallbackDelegate);
464                 terminateSignal?.Dispose();
465                 terminateSignal = null;
466             }
467
468             if (_applicationPauseEventCallbackDelegate != null)
469             {
470                 pauseSignal?.Disconnect(_applicationPauseEventCallbackDelegate);
471                 pauseSignal?.Dispose();
472                 pauseSignal = null;
473             }
474
475             if (_applicationResumeEventCallbackDelegate != null)
476             {
477                 resumeSignal?.Disconnect(_applicationResumeEventCallbackDelegate);
478                 resumeSignal?.Dispose();
479                 resumeSignal = null;
480             }
481
482             if (_applicationResetEventCallbackDelegate != null)
483             {
484                 resetSignal?.Disconnect(_applicationResetEventCallbackDelegate);
485                 resetSignal?.Dispose();
486                 resetSignal = null;
487             }
488
489             if (_applicationLanguageChangedEventCallbackDelegate != null)
490             {
491                 languageChangedSignal?.Disconnect(_applicationLanguageChangedEventCallbackDelegate);
492                 languageChangedSignal?.Dispose();
493                 languageChangedSignal = null;
494             }
495
496             if (_applicationRegionChangedEventCallbackDelegate != null)
497             {
498                 regionChangedSignal?.Disconnect(_applicationRegionChangedEventCallbackDelegate);
499                 regionChangedSignal?.Dispose();
500                 regionChangedSignal = null;
501             }
502
503             if (_applicationBatteryLowEventCallbackDelegate != null)
504             {
505                 batteryLowSignal?.Disconnect(_applicationBatteryLowEventCallbackDelegate);
506                 batteryLowSignal?.Dispose();
507                 batteryLowSignal = null;
508             }
509
510             if (_applicationMemoryLowEventCallbackDelegate != null)
511             {
512                 memoryLowSignal?.Disconnect(_applicationMemoryLowEventCallbackDelegate);
513                 memoryLowSignal?.Dispose();
514                 memoryLowSignal = null;
515             }
516
517             if (_applicationAppControlEventCallbackDelegate != null)
518             {
519                 appControlSignal?.Disconnect(_applicationAppControlEventCallbackDelegate);
520                 appControlSignal?.Dispose();
521                 appControlSignal = null;
522             }
523
524             win?.Dispose();
525             win = null;
526
527             base.Dispose(type);
528         }
529         protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
530         {
531             Interop.Application.DeleteApplication(swigCPtr);
532         }
533
534         /// <since_tizen> 4 </since_tizen>
535         public enum BatteryStatus
536         {
537             Normal,
538             CriticallyLow,
539             PowerOff
540         };
541
542         /// <since_tizen> 4 </since_tizen>
543         public enum MemoryStatus
544         {
545             Normal,
546             Low,
547             CriticallyLow
548         };
549
550         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
551         private delegate void NUIApplicationInitEventCallbackDelegate(IntPtr application);
552         private DaliEventHandler<object, NUIApplicationInitEventArgs> _applicationInitEventHandler;
553         private NUIApplicationInitEventCallbackDelegate _applicationInitEventCallbackDelegate;
554         private ApplicationSignal initSignal;
555
556
557         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
558         private delegate void NUIApplicationTerminateEventCallbackDelegate(IntPtr application);
559         private DaliEventHandler<object, NUIApplicationTerminatingEventArgs> _applicationTerminateEventHandler;
560         private NUIApplicationTerminateEventCallbackDelegate _applicationTerminateEventCallbackDelegate;
561         private ApplicationSignal terminateSignal;
562
563
564         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
565         private delegate void NUIApplicationPauseEventCallbackDelegate(IntPtr application);
566         private DaliEventHandler<object, NUIApplicationPausedEventArgs> _applicationPauseEventHandler;
567         private NUIApplicationPauseEventCallbackDelegate _applicationPauseEventCallbackDelegate;
568         private ApplicationSignal pauseSignal;
569
570         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
571         private delegate void NUIApplicationResumeEventCallbackDelegate(IntPtr application);
572         private DaliEventHandler<object, NUIApplicationResumedEventArgs> _applicationResumeEventHandler;
573         private NUIApplicationResumeEventCallbackDelegate _applicationResumeEventCallbackDelegate;
574         private ApplicationSignal resumeSignal;
575
576         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
577         private delegate void NUIApplicationResetEventCallbackDelegate(IntPtr application);
578         private DaliEventHandler<object, NUIApplicationResetEventArgs> _applicationResetEventHandler;
579         private NUIApplicationResetEventCallbackDelegate _applicationResetEventCallbackDelegate;
580         private ApplicationSignal resetSignal;
581
582         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
583         private delegate void NUIApplicationLanguageChangedEventCallbackDelegate(IntPtr application);
584         private DaliEventHandler<object, NUIApplicationLanguageChangedEventArgs> _applicationLanguageChangedEventHandler;
585         private NUIApplicationLanguageChangedEventCallbackDelegate _applicationLanguageChangedEventCallbackDelegate;
586         private ApplicationSignal languageChangedSignal;
587
588
589         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
590         private delegate void NUIApplicationRegionChangedEventCallbackDelegate(IntPtr application);
591         private DaliEventHandler<object, NUIApplicationRegionChangedEventArgs> _applicationRegionChangedEventHandler;
592         private NUIApplicationRegionChangedEventCallbackDelegate _applicationRegionChangedEventCallbackDelegate;
593         private ApplicationSignal regionChangedSignal;
594
595         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
596         private delegate void NUIApplicationBatteryLowEventCallbackDelegate(BatteryStatus status);
597         private DaliEventHandler<object, NUIApplicationBatteryLowEventArgs> _applicationBatteryLowEventHandler;
598         private NUIApplicationBatteryLowEventCallbackDelegate _applicationBatteryLowEventCallbackDelegate;
599         private LowBatterySignalType batteryLowSignal;
600
601         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
602         private delegate void NUIApplicationMemoryLowEventCallbackDelegate(MemoryStatus status);
603         private DaliEventHandler<object, NUIApplicationMemoryLowEventArgs> _applicationMemoryLowEventHandler;
604         private NUIApplicationMemoryLowEventCallbackDelegate _applicationMemoryLowEventCallbackDelegate;
605         private LowMemorySignalType memoryLowSignal;
606
607         [UnmanagedFunctionPointer(CallingConvention.StdCall)]
608         private delegate void NUIApplicationAppControlEventCallbackDelegate(IntPtr application, IntPtr voidp);
609         private DaliEventHandler<object, NUIApplicationAppControlEventArgs> _applicationAppControlEventHandler;
610         private NUIApplicationAppControlEventCallbackDelegate _applicationAppControlEventCallbackDelegate;
611         private ApplicationControlSignal appControlSignal;
612
613         private Window win;
614
615         /**
616           * @brief Event for Initialized signal which can be used to subscribe/unsubscribe the event handler
617           *  provided by the user. Initialized signal is emitted when application is initialised
618           */
619         public event DaliEventHandler<object, NUIApplicationInitEventArgs> Initialized
620         {
621             add
622             {
623                 lock (this)
624                 {
625                     // Restricted to only one listener
626                     if (_applicationInitEventHandler == null)
627                     {
628                         _applicationInitEventHandler += value;
629                         _applicationInitEventCallbackDelegate = new NUIApplicationInitEventCallbackDelegate(OnApplicationInit);
630                         initSignal = this.InitSignal();
631                         initSignal?.Connect(_applicationInitEventCallbackDelegate);
632                     }
633                 }
634             }
635
636             remove
637             {
638                 lock (this)
639                 {
640                     if (_applicationInitEventHandler != null)
641                     {
642                         initSignal?.Disconnect(_applicationInitEventCallbackDelegate);
643                         initSignal?.Dispose();
644                         initSignal = null;
645                     }
646
647                     _applicationInitEventHandler -= value;
648                 }
649             }
650         }
651
652         // Callback for Application InitSignal
653         private void OnApplicationInit(IntPtr data)
654         {
655             // Initialize DisposeQueue Singleton class. This is also required to create DisposeQueue on main thread.
656             DisposeQueue.Instance.Initialize();
657
658             // Notify that the window is displayed to the app core.
659             if (NUIApplication.IsPreLoad)
660             {
661                 Window.Instance.Show();
662             }
663
664             if (_applicationInitEventHandler != null)
665             {
666                 NUIApplicationInitEventArgs e = new NUIApplicationInitEventArgs();
667                 e.Application = this;
668                 _applicationInitEventHandler.Invoke(this, e);
669             }
670
671         }
672
673         /**
674           * @brief Event for Terminated signal which can be used to subscribe/unsubscribe the event handler
675           *  provided by the user. Terminated signal is emitted when application is terminating
676           */
677         public event DaliEventHandler<object, NUIApplicationTerminatingEventArgs> Terminating
678         {
679             add
680             {
681                 lock (this)
682                 {
683                     // Restricted to only one listener
684                     if (_applicationTerminateEventHandler == null)
685                     {
686                         _applicationTerminateEventHandler += value;
687
688                         _applicationTerminateEventCallbackDelegate = new NUIApplicationTerminateEventCallbackDelegate(OnNUIApplicationTerminate);
689                         terminateSignal = this.TerminateSignal();
690                         terminateSignal?.Connect(_applicationTerminateEventCallbackDelegate);
691                     }
692                 }
693             }
694
695             remove
696             {
697                 lock (this)
698                 {
699                     if (_applicationTerminateEventHandler != null)
700                     {
701                         terminateSignal?.Disconnect(_applicationTerminateEventCallbackDelegate);
702                         terminateSignal?.Dispose();
703                         terminateSignal = null;
704                     }
705
706                     _applicationTerminateEventHandler -= value;
707                 }
708             }
709         }
710
711         // Callback for Application TerminateSignal
712         private void OnNUIApplicationTerminate(IntPtr data)
713         {
714             if (_applicationTerminateEventHandler != null)
715             {
716                 NUIApplicationTerminatingEventArgs e = new NUIApplicationTerminatingEventArgs();
717                 e.Application = this;
718                 _applicationTerminateEventHandler.Invoke(this, e);
719             }
720
721             List<Window> windows = GetWindowList();
722             foreach (Window window in windows)
723             {
724                 window?.DisconnectNativeSignals();
725             }
726         }
727
728         /**
729           * @brief Event for Paused signal which can be used to subscribe/unsubscribe the event handler
730           * provided by the user. Paused signal is emitted when application is paused
731           */
732         public event DaliEventHandler<object, NUIApplicationPausedEventArgs> Paused
733         {
734             add
735             {
736                 lock (this)
737                 {
738                     // Restricted to only one listener
739                     if (_applicationPauseEventHandler == null)
740                     {
741                         _applicationPauseEventHandler += value;
742
743                         _applicationPauseEventCallbackDelegate = new NUIApplicationPauseEventCallbackDelegate(OnNUIApplicationPause);
744                         pauseSignal = this.PauseSignal();
745                         pauseSignal?.Connect(_applicationPauseEventCallbackDelegate);
746                     }
747                 }
748             }
749
750             remove
751             {
752                 lock (this)
753                 {
754                     if (_applicationPauseEventHandler != null)
755                     {
756                         pauseSignal?.Disconnect(_applicationPauseEventCallbackDelegate);
757                         pauseSignal?.Dispose();
758                         pauseSignal = null;
759                     }
760
761                     _applicationPauseEventHandler -= value;
762                 }
763             }
764         }
765
766         // Callback for Application PauseSignal
767         private void OnNUIApplicationPause(IntPtr data)
768         {
769             if (_applicationPauseEventHandler != null)
770             {
771                 NUIApplicationPausedEventArgs e = new NUIApplicationPausedEventArgs();
772                 e.Application = this;
773                 _applicationPauseEventHandler.Invoke(this, e);
774             }
775         }
776
777         /**
778           * @brief Event for Resumed signal which can be used to subscribe/unsubscribe the event handler
779           *  provided by the user. Resumed signal is emitted when application is resumed
780           */
781         public event DaliEventHandler<object, NUIApplicationResumedEventArgs> Resumed
782         {
783             add
784             {
785                 lock (this)
786                 {
787                     // Restricted to only one listener
788                     if (_applicationResumeEventHandler == null)
789                     {
790                         _applicationResumeEventHandler += value;
791
792                         _applicationResumeEventCallbackDelegate = new NUIApplicationResumeEventCallbackDelegate(OnNUIApplicationResume);
793                         resumeSignal = this.ResumeSignal();
794                         resumeSignal?.Connect(_applicationResumeEventCallbackDelegate);
795                     }
796                 }
797             }
798
799             remove
800             {
801                 lock (this)
802                 {
803                     if (_applicationResumeEventHandler != null)
804                     {
805                         resumeSignal?.Disconnect(_applicationResumeEventCallbackDelegate);
806                         resumeSignal?.Dispose();
807                         resumeSignal = null;
808                     }
809
810                     _applicationResumeEventHandler -= value;
811                 }
812             }
813         }
814
815         // Callback for Application ResumeSignal
816         private void OnNUIApplicationResume(IntPtr data)
817         {
818             if (_applicationResumeEventHandler != null)
819             {
820                 NUIApplicationResumedEventArgs e = new NUIApplicationResumedEventArgs();
821                 e.Application = this;
822                 _applicationResumeEventHandler.Invoke(this, e);
823             }
824         }
825
826         /**
827           * @brief Event for Reset signal which can be used to subscribe/unsubscribe the event handler
828           *  provided by the user. Reset signal is emitted when application is reset
829           */
830         public new event DaliEventHandler<object, NUIApplicationResetEventArgs> Reset
831         {
832             add
833             {
834                 lock (this)
835                 {
836                     // Restricted to only one listener
837                     if (_applicationResetEventHandler == null)
838                     {
839                         _applicationResetEventHandler += value;
840
841                         _applicationResetEventCallbackDelegate = new NUIApplicationResetEventCallbackDelegate(OnNUIApplicationReset);
842                         resetSignal = this.ResetSignal();
843                         resetSignal?.Connect(_applicationResetEventCallbackDelegate);
844                     }
845                 }
846             }
847
848             remove
849             {
850                 lock (this)
851                 {
852                     if (_applicationResetEventHandler != null)
853                     {
854                         resetSignal?.Disconnect(_applicationResetEventCallbackDelegate);
855                         resetSignal?.Dispose();
856                         resetSignal = null;
857                     }
858
859                     _applicationResetEventHandler -= value;
860                 }
861             }
862         }
863
864         // Callback for Application ResetSignal
865         private void OnNUIApplicationReset(IntPtr data)
866         {
867             if (_applicationResetEventHandler != null)
868             {
869                 NUIApplicationResetEventArgs e = new NUIApplicationResetEventArgs();
870                 e.Application = this;
871                 _applicationResetEventHandler.Invoke(this, e);
872             }
873         }
874
875         /**
876           * @brief Event for LanguageChanged signal which can be used to subscribe/unsubscribe the event handler
877           *  provided by the user. LanguageChanged signal is emitted when the region of the device is changed.
878           */
879         public event DaliEventHandler<object, NUIApplicationLanguageChangedEventArgs> LanguageChanged
880         {
881             add
882             {
883                 lock (this)
884                 {
885                     // Restricted to only one listener
886                     if (_applicationLanguageChangedEventHandler == null)
887                     {
888                         _applicationLanguageChangedEventHandler += value;
889
890                         _applicationLanguageChangedEventCallbackDelegate = new NUIApplicationLanguageChangedEventCallbackDelegate(OnNUIApplicationLanguageChanged);
891                         languageChangedSignal = this.LanguageChangedSignal();
892                         languageChangedSignal?.Connect(_applicationLanguageChangedEventCallbackDelegate);
893                     }
894                 }
895             }
896
897             remove
898             {
899                 lock (this)
900                 {
901                     if (_applicationLanguageChangedEventHandler != null)
902                     {
903                         languageChangedSignal?.Disconnect(_applicationLanguageChangedEventCallbackDelegate);
904                         languageChangedSignal?.Dispose();
905                         languageChangedSignal = null;
906                     }
907
908                     _applicationLanguageChangedEventHandler -= value;
909                 }
910             }
911         }
912
913         // Callback for Application LanguageChangedSignal
914         private void OnNUIApplicationLanguageChanged(IntPtr data)
915         {
916             if (_applicationLanguageChangedEventHandler != null)
917             {
918                 NUIApplicationLanguageChangedEventArgs e = new NUIApplicationLanguageChangedEventArgs();
919                 e.Application = this;
920                 _applicationLanguageChangedEventHandler.Invoke(this, e);
921             }
922         }
923
924         /**
925           * @brief Event for RegionChanged signal which can be used to subscribe/unsubscribe the event handler
926           *  provided by the user. RegionChanged signal is emitted when the region of the device is changed.
927           */
928         public event DaliEventHandler<object, NUIApplicationRegionChangedEventArgs> RegionChanged
929         {
930             add
931             {
932                 lock (this)
933                 {
934                     // Restricted to only one listener
935                     if (_applicationRegionChangedEventHandler == null)
936                     {
937                         _applicationRegionChangedEventHandler += value;
938
939                         _applicationRegionChangedEventCallbackDelegate = new NUIApplicationRegionChangedEventCallbackDelegate(OnNUIApplicationRegionChanged);
940                         regionChangedSignal = this.RegionChangedSignal();
941                         regionChangedSignal?.Connect(_applicationRegionChangedEventCallbackDelegate);
942                     }
943                 }
944             }
945
946             remove
947             {
948                 lock (this)
949                 {
950                     if (_applicationRegionChangedEventHandler != null)
951                     {
952                         regionChangedSignal?.Disconnect(_applicationRegionChangedEventCallbackDelegate);
953                         regionChangedSignal?.Dispose();
954                         regionChangedSignal = null;
955                     }
956
957                     _applicationRegionChangedEventHandler -= value;
958                 }
959             }
960         }
961
962         // Callback for Application RegionChangedSignal
963         private void OnNUIApplicationRegionChanged(IntPtr data)
964         {
965             if (_applicationRegionChangedEventHandler != null)
966             {
967                 NUIApplicationRegionChangedEventArgs e = new NUIApplicationRegionChangedEventArgs();
968                 e.Application = this;
969                 _applicationRegionChangedEventHandler.Invoke(this, e);
970             }
971         }
972
973         /**
974           * @brief Event for BatteryLow signal which can be used to subscribe/unsubscribe the event handler
975           * provided by the user. BatteryLow signal is emitted when the battery level of the device is low.
976           */
977         public event DaliEventHandler<object, NUIApplicationBatteryLowEventArgs> BatteryLow
978         {
979             add
980             {
981                 lock (this)
982                 {
983                     // Restricted to only one listener
984                     if (_applicationBatteryLowEventHandler == null)
985                     {
986                         _applicationBatteryLowEventHandler += value;
987
988                         _applicationBatteryLowEventCallbackDelegate = new NUIApplicationBatteryLowEventCallbackDelegate(OnNUIApplicationBatteryLow);
989                         batteryLowSignal = this.BatteryLowSignal();
990                         batteryLowSignal?.Connect(_applicationBatteryLowEventCallbackDelegate);
991                     }
992                 }
993             }
994
995             remove
996             {
997                 lock (this)
998                 {
999                     if (_applicationBatteryLowEventHandler != null)
1000                     {
1001                         batteryLowSignal?.Disconnect(_applicationBatteryLowEventCallbackDelegate);
1002                         batteryLowSignal?.Dispose();
1003                         batteryLowSignal = null;
1004                     }
1005
1006                     _applicationBatteryLowEventHandler -= value;
1007                 }
1008             }
1009         }
1010
1011         // Callback for Application BatteryLowSignal
1012         private void OnNUIApplicationBatteryLow(BatteryStatus status)
1013         {
1014             lock (this)
1015             {
1016                 NUIApplicationBatteryLowEventArgs e = new NUIApplicationBatteryLowEventArgs();
1017
1018                 // Populate all members of "e" (NUIApplicationBatteryLowEventArgs) with real data
1019                 e.BatteryStatus = status;
1020                 _applicationBatteryLowEventHandler?.Invoke(this, e);
1021             }
1022         }
1023
1024         /**
1025           * @brief Event for MemoryLow signal which can be used to subscribe/unsubscribe the event handler
1026           *  provided by the user. MemoryLow signal is emitted when the memory level of the device is low.
1027           */
1028         public event DaliEventHandler<object, NUIApplicationMemoryLowEventArgs> MemoryLow
1029         {
1030             add
1031             {
1032                 lock (this)
1033                 {
1034                     // Restricted to only one listener
1035                     if (_applicationMemoryLowEventHandler == null)
1036                     {
1037                         _applicationMemoryLowEventHandler += value;
1038
1039                         _applicationMemoryLowEventCallbackDelegate = new NUIApplicationMemoryLowEventCallbackDelegate(OnNUIApplicationMemoryLow);
1040                         memoryLowSignal = this.MemoryLowSignal();
1041                         memoryLowSignal?.Connect(_applicationMemoryLowEventCallbackDelegate);
1042                     }
1043                 }
1044             }
1045
1046             remove
1047             {
1048                 lock (this)
1049                 {
1050                     if (_applicationMemoryLowEventHandler != null)
1051                     {
1052                         memoryLowSignal?.Disconnect(_applicationMemoryLowEventCallbackDelegate);
1053                         memoryLowSignal?.Dispose();
1054                         memoryLowSignal = null;
1055                     }
1056
1057                     _applicationMemoryLowEventHandler -= value;
1058                 }
1059             }
1060         }
1061
1062         // Callback for Application MemoryLowSignal
1063         private void OnNUIApplicationMemoryLow(MemoryStatus status)
1064         {
1065             lock (this)
1066             {
1067                 NUIApplicationMemoryLowEventArgs e = new NUIApplicationMemoryLowEventArgs();
1068
1069                 // Populate all members of "e" (NUIApplicationMemoryLowEventArgs) with real data
1070                 e.MemoryStatus = status;
1071                 _applicationMemoryLowEventHandler?.Invoke(this, e);
1072             }
1073         }
1074
1075         /**
1076           * @brief Event for AppControl signal which can be used to subscribe/unsubscribe the event handler
1077           *  provided by the user. AppControl signal is emitted when another application sends a launch request to the application.
1078           */
1079         public event DaliEventHandler<object, NUIApplicationAppControlEventArgs> AppControl
1080         {
1081             add
1082             {
1083                 lock (this)
1084                 {
1085                     // Restricted to only one listener
1086                     if (_applicationAppControlEventHandler == null)
1087                     {
1088                         _applicationAppControlEventHandler += value;
1089
1090                         _applicationAppControlEventCallbackDelegate = new NUIApplicationAppControlEventCallbackDelegate(OnNUIApplicationAppControl);
1091                         appControlSignal = this.AppControlSignal();
1092                         appControlSignal?.Connect(_applicationAppControlEventCallbackDelegate);
1093                     }
1094                 }
1095             }
1096
1097             remove
1098             {
1099                 lock (this)
1100                 {
1101                     if (_applicationAppControlEventHandler != null)
1102                     {
1103                         appControlSignal?.Disconnect(_applicationAppControlEventCallbackDelegate);
1104                         appControlSignal?.Dispose();
1105                         appControlSignal = null;
1106                     }
1107
1108                     _applicationAppControlEventHandler -= value;
1109                 }
1110             }
1111         }
1112
1113         // Callback for Application AppControlSignal
1114         private void OnNUIApplicationAppControl(IntPtr application, IntPtr voidp)
1115         {
1116             if (_applicationAppControlEventHandler != null)
1117             {
1118                 NUIApplicationAppControlEventArgs e = new NUIApplicationAppControlEventArgs();
1119                 e.VoidP = voidp;
1120                 e.Application = this;
1121                 _applicationAppControlEventHandler.Invoke(this, e);
1122             }
1123         }
1124
1125         protected static Application _instance; // singleton
1126
1127         public static Application Instance
1128         {
1129             get
1130             {
1131                 return _instance;
1132             }
1133         }
1134
1135         public static Application GetApplicationFromPtr(global::System.IntPtr cPtr)
1136         {
1137             if (cPtr == global::System.IntPtr.Zero)
1138             {
1139                 return null;
1140             }
1141
1142             Application ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Application;
1143             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1144             return ret;
1145         }
1146
1147         public static Application NewApplication()
1148         {
1149             return NewApplication("", Application.WindowMode.Opaque);
1150         }
1151
1152         public static Application NewApplication(string stylesheet)
1153         {
1154             return NewApplication(stylesheet, Application.WindowMode.Opaque);
1155         }
1156
1157         public static Application NewApplication(string stylesheet, Application.WindowMode windowMode)
1158         {
1159             // register all Views with the type registry, so that can be created / styled via JSON
1160             //ViewRegistryHelper.Initialize(); //moved to Application side.
1161             if (_instance)
1162             {
1163                 return _instance;
1164             }
1165
1166             Application ret = New(1, stylesheet, windowMode);
1167             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1168
1169             // set the singleton
1170             _instance = ret;
1171             return ret;
1172         }
1173
1174         public static Application NewApplication(string stylesheet, Application.WindowMode windowMode, Rectangle positionSize)
1175         {
1176             if (_instance)
1177             {
1178                 return _instance;
1179             }
1180             Application ret = New(1, stylesheet, windowMode, positionSize);
1181             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1182
1183             // set the singleton
1184             _instance = ret;
1185             return ret;
1186         }
1187
1188         public static Application NewApplication(string[] args, string stylesheet, Application.WindowMode windowMode)
1189         {
1190             if (_instance)
1191             {
1192                 return _instance;
1193             }
1194             Application ret = New(args, stylesheet, (Application.WindowMode)windowMode);
1195             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1196
1197             // set the singleton
1198             _instance = ret;
1199             return _instance;
1200         }
1201
1202         public static Application NewApplication(string[] args, string stylesheet, Application.WindowMode windowMode, Rectangle positionSize)
1203         {
1204             if (_instance)
1205             {
1206                 return _instance;
1207             }
1208             Application ret = New(args, stylesheet, (Application.WindowMode)windowMode, positionSize);
1209             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1210
1211             // set the singleton
1212             _instance = ret;
1213             return _instance;
1214         }
1215
1216         /// <summary>
1217         /// Ensures that the function passed in is called from the main loop when it is idle.
1218         /// </summary>
1219         /// <param name="func">The function to call</param>
1220         /// <returns>true if added successfully, false otherwise</returns>
1221         public bool AddIdle(System.Delegate func)
1222         {
1223             System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
1224             System.IntPtr ip2 = Interop.Application.MakeCallback(new System.Runtime.InteropServices.HandleRef(this, ip));
1225
1226             bool ret = Interop.Application.AddIdle(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip2));
1227
1228             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1229             return ret;
1230         }
1231
1232         /**
1233         * Outer::outer_method(int)
1234         */
1235         public static Application New()
1236         {
1237             Application ret = new Application(Interop.Application.New(), true);
1238             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1239             return ret;
1240         }
1241
1242         public static Application New(int argc)
1243         {
1244             Application ret = new Application(Interop.Application.New(argc), true);
1245             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1246             return ret;
1247         }
1248
1249         public static Application New(int argc, string stylesheet)
1250         {
1251             Application ret = new Application(Interop.Application.New(argc, stylesheet), true);
1252             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1253             return ret;
1254         }
1255
1256         public static Application New(int argc, string stylesheet, Application.WindowMode windowMode)
1257         {
1258             Application ret = new Application(Interop.Application.New(argc, stylesheet, (int)windowMode), true);
1259             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1260             s_current = ret;
1261             return ret;
1262         }
1263
1264         public static Application New(string[] args, string stylesheet, Application.WindowMode windowMode)
1265         {
1266             Application ret = null;
1267             int argc = 0;
1268             string argvStr = "";
1269             try
1270             {
1271                 argc = args.Length;
1272                 argvStr = string.Join(" ", args);
1273             }
1274             catch (Exception exception)
1275             {
1276                 Tizen.Log.Fatal("NUI", "[Error] got exception during Application New(), this should not occur, msg : " + exception.Message);
1277                 Tizen.Log.Fatal("NUI", "[Error] error line number : " + new StackTrace(exception, true).GetFrame(0).GetFileLineNumber());
1278                 Tizen.Log.Fatal("NUI", "[Error] Stack Trace : " + exception.StackTrace);
1279                 throw;
1280             }
1281
1282             ret = new Application(NDalicPINVOKE.ApplicationNewManual4(argc, argvStr, stylesheet, (int)windowMode), true);
1283             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1284
1285             return ret;
1286         }
1287
1288         public static Application New(int argc, string stylesheet, Application.WindowMode windowMode, Rectangle positionSize)
1289         {
1290             Application ret = new Application(Interop.Application.New(argc, stylesheet, (int)windowMode, Rectangle.getCPtr(positionSize)), true);
1291             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1292             return ret;
1293         }
1294
1295         public static Application New(string[] args, string stylesheet, Application.WindowMode windowMode, Rectangle positionSize)
1296         {
1297             Application ret = null;
1298             int argc = 0;
1299             string argvStr = "";
1300             try
1301             {
1302                 argc = args.Length;
1303                 argvStr = string.Join(" ", args);
1304             }
1305             catch (Exception exception)
1306             {
1307                 Tizen.Log.Fatal("NUI", "[Error] got exception during Application New(), this should not occur, msg : " + exception.Message);
1308                 Tizen.Log.Fatal("NUI", "[Error] error line number : " + new StackTrace(exception, true).GetFrame(0).GetFileLineNumber());
1309                 Tizen.Log.Fatal("NUI", "[Error] Stack Trace : " + exception.StackTrace);
1310                 throw;
1311             }
1312
1313             ret = new Application(NDalicPINVOKE.ApplicationNewWithWindowSizePosition(argc, argvStr, stylesheet, (int)windowMode, Rectangle.getCPtr(positionSize)), true);
1314             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1315
1316             return ret;
1317         }
1318
1319         public Application() : this(Interop.Application.NewApplication(), true)
1320         {
1321             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1322         }
1323
1324         public Application(Application application) : this(Interop.Application.NewApplication(Application.getCPtr(application)), true)
1325         {
1326             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1327         }
1328
1329         public Application Assign(Application application)
1330         {
1331             Application ret = new Application(Interop.Application.Assign(SwigCPtr, Application.getCPtr(application)), false);
1332             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1333             return ret;
1334         }
1335
1336         public void MainLoop()
1337         {
1338             NDalicPINVOKE.ApplicationMainLoop(SwigCPtr);
1339             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1340         }
1341
1342         public void Lower()
1343         {
1344             Interop.Application.Lower(SwigCPtr);
1345             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1346         }
1347
1348         public void Quit()
1349         {
1350             Interop.Application.Quit(SwigCPtr);
1351             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1352         }
1353
1354         internal bool AddIdle(SWIGTYPE_p_Dali__CallbackBase callback)
1355         {
1356             bool ret = Interop.Application.AddIdle(SwigCPtr, SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback));
1357             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1358             return ret;
1359         }
1360
1361         public Window GetWindow()
1362         {
1363             win = Registry.GetManagedBaseHandleFromNativePtr(Interop.Application.GetWindow(SwigCPtr)) as Window;
1364             if (win == null)
1365             {
1366                 win = new Window(Interop.Application.GetWindow(SwigCPtr), true);
1367             }
1368
1369             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1370             return win;
1371         }
1372
1373         public static string GetResourcePath()
1374         {
1375             string ret = Interop.Application.GetResourcePath();
1376             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1377             return ret;
1378         }
1379
1380         public string GetLanguage()
1381         {
1382             string ret = Interop.Application.GetLanguage(SwigCPtr);
1383             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1384             return ret;
1385         }
1386
1387         public string GetRegion()
1388         {
1389             string ret = Interop.Application.GetRegion(SwigCPtr);
1390             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1391             return ret;
1392         }
1393
1394         [EditorBrowsable(EditorBrowsableState.Never)]
1395         public static List<Window> GetWindowList()
1396         {
1397             uint ListSize = Interop.Application.GetWindowsListSize();
1398             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1399
1400             List<Window> WindowList = new List<Window>();
1401             for (uint i = 0; i < ListSize; ++i)
1402             {
1403                 Window currWin = Registry.GetManagedBaseHandleFromNativePtr(Interop.Application.GetWindowsFromList(i)) as Window;
1404                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1405                 if (currWin)
1406                 {
1407                     WindowList.Add(currWin);
1408                 }
1409             }
1410             return WindowList;
1411         }
1412
1413         internal ApplicationSignal InitSignal()
1414         {
1415             ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationInitSignal(SwigCPtr), false);
1416             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1417             return ret;
1418         }
1419
1420         internal ApplicationSignal TerminateSignal()
1421         {
1422             ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationTerminateSignal(SwigCPtr), false);
1423             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1424             return ret;
1425         }
1426
1427         internal ApplicationSignal PauseSignal()
1428         {
1429             ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationPauseSignal(SwigCPtr), false);
1430             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1431             return ret;
1432         }
1433
1434         internal ApplicationSignal ResumeSignal()
1435         {
1436             ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationResumeSignal(SwigCPtr), false);
1437             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1438             return ret;
1439         }
1440
1441         internal ApplicationSignal ResetSignal()
1442         {
1443             ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationResetSignal(SwigCPtr), false);
1444             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1445             return ret;
1446         }
1447
1448         internal ApplicationControlSignal AppControlSignal()
1449         {
1450             ApplicationControlSignal ret = new ApplicationControlSignal(NDalicPINVOKE.ApplicationAppControlSignal(SwigCPtr), false);
1451             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1452             return ret;
1453         }
1454
1455         internal ApplicationSignal LanguageChangedSignal()
1456         {
1457             ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationLanguageChangedSignal(SwigCPtr), false);
1458             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1459             return ret;
1460         }
1461
1462         internal ApplicationSignal RegionChangedSignal()
1463         {
1464             ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationRegionChangedSignal(SwigCPtr), false);
1465             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1466             return ret;
1467         }
1468
1469         internal LowBatterySignalType BatteryLowSignal()
1470         {
1471             LowBatterySignalType ret = new LowBatterySignalType(NDalicPINVOKE.ApplicationLowBatterySignal(SwigCPtr), false);
1472             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1473             return ret;
1474         }
1475
1476         internal LowMemorySignalType MemoryLowSignal()
1477         {
1478             LowMemorySignalType ret = new LowMemorySignalType(NDalicPINVOKE.ApplicationLowMemorySignal(SwigCPtr), false);
1479             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1480             return ret;
1481         }
1482
1483         /// <since_tizen> 3 </since_tizen>
1484         public enum WindowMode
1485         {
1486             Opaque = 0,
1487             Transparent = 1
1488         }
1489     }
1490 }