2 * Copyright(c) 2022 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
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;
27 // Event arguments that passed via NUIApplicationInit signal
28 internal class NUIApplicationInitEventArgs : EventArgs
30 private Application application;
32 // Application - is the application that is being initialized
33 public Application Application
46 // Event arguments that passed via NUIApplicationTerminate signal
47 internal class NUIApplicationTerminatingEventArgs : EventArgs
49 private Application application;
51 // Application - is the application that is being Terminated
52 public Application Application
65 // Event arguments that passed via NUIApplicationPause signal
66 internal class NUIApplicationPausedEventArgs : EventArgs
68 private Application application;
70 // Application - is the application that is being Paused
71 public Application Application
84 // Event arguments that passed via NUIApplicationResume signal
85 internal class NUIApplicationResumedEventArgs : EventArgs
87 private Application application;
88 // Application - is the application that is being Resumed
89 public Application Application
102 // Event arguments that passed via NUIApplicationReset signal
103 internal class NUIApplicationResetEventArgs : EventArgs
105 private Application application;
107 // Application - is the application that is being Reset
108 public Application Application
121 // Event arguments that passed via NUIApplicationLanguageChanged signal
122 internal class NUIApplicationLanguageChangedEventArgs : EventArgs
124 private Application application;
126 // Application - is the application that is being affected with Device's language change
127 public Application Application
140 // Event arguments that passed via NUIApplicationRegionChanged signal
141 internal class NUIApplicationRegionChangedEventArgs : EventArgs
143 private Application application;
145 // Application - is the application that is being affected with Device's region change
146 public Application Application
159 // Event arguments that passed via NUIApplicationBatteryLow signal
160 internal class NUIApplicationBatteryLowEventArgs : EventArgs
162 private Application.BatteryStatus status;
164 // Application - is the application that is being affected when the battery level of the device is low
165 public Application.BatteryStatus BatteryStatus
178 // Event arguments that passed via NUIApplicationMemoryLow signal
179 internal class NUIApplicationMemoryLowEventArgs : EventArgs
181 private Application.MemoryStatus status;
183 // Application - is the application that is being affected when the memory level of the device is low
184 public Application.MemoryStatus MemoryStatus
197 // Event arguments that passed via NUIApplicationDeviceOrientationChanged signal
198 internal class NUIApplicationDeviceOrientationChangedEventArgs : EventArgs
200 private Application.DeviceOrientationStatus status;
202 // Application - is the application that is being affected when the device orientation is changed.
203 public Application.DeviceOrientationStatus DeviceOrientationStatus
216 // Event arguments that passed via NUIApplicationAppControl signal
217 internal class NUIApplicationAppControlEventArgs : EventArgs
219 private Application application;
220 private IntPtr voidp;
222 // Application - is the application that is receiving the launch request from another application
223 public Application Application
235 // VoidP - contains the information about why the application is launched
250 /// A class to get resources in current application.
252 public sealed class GetResourcesProvider
255 /// Get resources in current application.
257 static public IResourcesProvider Get()
259 return Tizen.NUI.Application.Current;
263 internal class Application : BaseHandle, IResourcesProvider, IElementConfiguration<Application>
265 static Application s_current;
267 ReadOnlyCollection<Element> logicalChildren;
269 [EditorBrowsable(EditorBrowsableState.Never)]
270 public static void SetCurrentApplication(Application value) => Current = value;
272 public static Application Current
274 get { return s_current; }
277 if (s_current == value)
283 internal override ReadOnlyCollection<Element> LogicalChildrenInternal
285 get { return logicalChildren ?? (logicalChildren = new ReadOnlyCollection<Element>(InternalChildren)); }
288 internal IResourceDictionary SystemResources { get; }
290 ObservableCollection<Element> InternalChildren { get; } = new ObservableCollection<Element>();
292 ResourceDictionary resources;
293 public bool IsResourcesCreated => resources != null;
295 public delegate void resChangeCb(object sender, ResourcesChangedEventArgs e);
297 internal override void OnResourcesChanged(object sender, ResourcesChangedEventArgs e)
299 base.OnResourcesChanged(sender, e);
302 public ResourceDictionary XamlResources
306 if (resources == null)
308 resources = new ResourceDictionary();
309 int hashCode = resources.GetHashCode();
310 ((IResourceDictionary)resources).ValuesChanged += OnResourcesChanged;
316 if (resources == value)
318 OnPropertyChanging();
320 if (resources != null)
321 ((IResourceDictionary)resources).ValuesChanged -= OnResourcesChanged;
323 OnResourcesChanged(value);
324 if (resources != null)
325 ((IResourceDictionary)resources).ValuesChanged += OnResourcesChanged;
331 protected override void OnParentSet()
333 throw new InvalidOperationException("Setting a Parent on Application is invalid.");
336 [EditorBrowsable(EditorBrowsableState.Never)]
337 public static bool IsApplicationOrNull(Element element)
339 return element == null || element is Application;
342 internal override void OnParentResourcesChanged(IEnumerable<KeyValuePair<string, object>> values)
347 if (!((IResourcesProvider)this).IsResourcesCreated || XamlResources.Count == 0)
349 base.OnParentResourcesChanged(values);
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)
359 if (innerKeys.Add(value.Key))
360 changedResources.Add(value);
362 if (changedResources.Count != 0)
363 OnResourcesChanged(changedResources);
366 internal Application(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
368 SetCurrentApplication(this);
372 protected override void Dispose(DisposeTypes type)
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)
384 initSignal?.Disconnect(applicationInitEventCallbackDelegate);
385 initSignal?.Dispose();
389 if (applicationTerminateEventCallbackDelegate != null)
391 terminateSignal?.Disconnect(applicationTerminateEventCallbackDelegate);
392 terminateSignal?.Dispose();
393 terminateSignal = null;
396 if (applicationPauseEventCallbackDelegate != null)
398 pauseSignal?.Disconnect(applicationPauseEventCallbackDelegate);
399 pauseSignal?.Dispose();
403 if (applicationResumeEventCallbackDelegate != null)
405 resumeSignal?.Disconnect(applicationResumeEventCallbackDelegate);
406 resumeSignal?.Dispose();
410 if (applicationResetEventCallbackDelegate != null)
412 resetSignal?.Disconnect(applicationResetEventCallbackDelegate);
413 resetSignal?.Dispose();
417 if (applicationLanguageChangedEventCallbackDelegate != null)
419 languageChangedSignal?.Disconnect(applicationLanguageChangedEventCallbackDelegate);
420 languageChangedSignal?.Dispose();
421 languageChangedSignal = null;
424 if (applicationRegionChangedEventCallbackDelegate != null)
426 regionChangedSignal?.Disconnect(applicationRegionChangedEventCallbackDelegate);
427 regionChangedSignal?.Dispose();
428 regionChangedSignal = null;
431 if (applicationBatteryLowEventCallbackDelegate != null)
433 batteryLowSignal?.Disconnect(applicationBatteryLowEventCallbackDelegate);
434 batteryLowSignal?.Dispose();
435 batteryLowSignal = null;
438 if (applicationMemoryLowEventCallbackDelegate != null)
440 memoryLowSignal?.Disconnect(applicationMemoryLowEventCallbackDelegate);
441 memoryLowSignal?.Dispose();
442 memoryLowSignal = null;
445 if (applicationDeviceOrientationChangedEventCallback != null)
447 deviceOrientationChangedSignal?.Disconnect(applicationDeviceOrientationChangedEventCallback);
448 deviceOrientationChangedSignal?.Dispose();
449 deviceOrientationChangedSignal = null;
452 if (applicationAppControlEventCallbackDelegate != null)
454 appControlSignal?.Disconnect(applicationAppControlEventCallbackDelegate);
455 appControlSignal?.Dispose();
456 appControlSignal = null;
460 if (applicationTaskInitEventCallbackDelegate != null)
462 taskInitSignal?.Disconnect(applicationTaskInitEventCallbackDelegate);
463 taskInitSignal?.Dispose();
464 taskInitSignal = null;
467 if (applicationTaskTerminateEventCallbackDelegate != null)
469 taskTerminateSignal?.Disconnect(applicationTaskTerminateEventCallbackDelegate);
470 taskTerminateSignal?.Dispose();
471 taskTerminateSignal = null;
474 if (applicationTaskLanguageChangedEventCallbackDelegate != null)
476 taskLanguageChangedSignal?.Disconnect(applicationTaskLanguageChangedEventCallbackDelegate);
477 taskLanguageChangedSignal?.Dispose();
478 taskLanguageChangedSignal = null;
481 if (applicationTaskRegionChangedEventCallbackDelegate != null)
483 taskRegionChangedSignal?.Disconnect(applicationTaskRegionChangedEventCallbackDelegate);
484 taskRegionChangedSignal?.Dispose();
485 taskRegionChangedSignal = null;
488 if (applicationTaskBatteryLowEventCallbackDelegate != null)
490 taskBatteryLowSignal?.Disconnect(applicationTaskBatteryLowEventCallbackDelegate);
491 taskBatteryLowSignal?.Dispose();
492 taskBatteryLowSignal = null;
495 if (applicationTaskMemoryLowEventCallbackDelegate != null)
497 taskMemoryLowSignal?.Disconnect(applicationTaskMemoryLowEventCallbackDelegate);
498 taskMemoryLowSignal?.Dispose();
499 taskMemoryLowSignal = null;
502 if (applicationTaskDeviceOrientationChangedEventCallback != null)
504 taskDeviceOrientationChangedSignal?.Disconnect(applicationTaskDeviceOrientationChangedEventCallback);
505 taskDeviceOrientationChangedSignal?.Dispose();
506 taskDeviceOrientationChangedSignal = null;
509 if (applicationTaskAppControlEventCallbackDelegate != null)
511 taskAppControlSignal?.Disconnect(applicationTaskAppControlEventCallbackDelegate);
512 taskAppControlSignal?.Dispose();
513 taskAppControlSignal = null;
521 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
523 Interop.Application.DeleteApplication(swigCPtr);
526 public enum BatteryStatus
533 public enum MemoryStatus
540 public enum DeviceOrientationStatus
544 Orientation_180 = 180,
545 Orientation_270 = 270
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
615 private DaliEventHandler<object, NUIApplicationInitEventArgs> applicationTaskInitEventHandler;
616 private NUIApplicationInitEventCallbackDelegate applicationTaskInitEventCallbackDelegate;
617 private ApplicationSignal taskInitSignal;
619 private DaliEventHandler<object, NUIApplicationTerminatingEventArgs> applicationTaskTerminateEventHandler;
620 private NUIApplicationTerminateEventCallbackDelegate applicationTaskTerminateEventCallbackDelegate;
621 private ApplicationSignal taskTerminateSignal;
623 private DaliEventHandler<object, NUIApplicationLanguageChangedEventArgs> applicationTaskLanguageChangedEventHandler;
624 private NUIApplicationLanguageChangedEventCallbackDelegate applicationTaskLanguageChangedEventCallbackDelegate;
625 private ApplicationSignal taskLanguageChangedSignal;
627 private DaliEventHandler<object, NUIApplicationRegionChangedEventArgs> applicationTaskRegionChangedEventHandler;
628 private NUIApplicationRegionChangedEventCallbackDelegate applicationTaskRegionChangedEventCallbackDelegate;
629 private ApplicationSignal taskRegionChangedSignal;
631 private DaliEventHandler<object, NUIApplicationBatteryLowEventArgs> applicationTaskBatteryLowEventHandler;
632 private NUIApplicationBatteryLowEventCallbackDelegate applicationTaskBatteryLowEventCallbackDelegate;
633 private LowBatterySignalType taskBatteryLowSignal;
635 private DaliEventHandler<object, NUIApplicationMemoryLowEventArgs> applicationTaskMemoryLowEventHandler;
636 private NUIApplicationMemoryLowEventCallbackDelegate applicationTaskMemoryLowEventCallbackDelegate;
637 private LowMemorySignalType taskMemoryLowSignal;
639 private DaliEventHandler<object, NUIApplicationDeviceOrientationChangedEventArgs> applicationTaskDeviceOrientationChangedEventHandler;
640 private NUIApplicationDeviceOrientationChangedEventCallback applicationTaskDeviceOrientationChangedEventCallback;
641 private DeviceOrientationChangedSignalType taskDeviceOrientationChangedSignal;
643 private DaliEventHandler<object, NUIApplicationAppControlEventArgs> applicationTaskAppControlEventHandler;
644 private NUIApplicationAppControlEventCallbackDelegate applicationTaskAppControlEventCallbackDelegate;
645 private ApplicationControlSignal taskAppControlSignal;
647 private Window window;
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
655 // Restricted to only one listener
656 if (applicationInitEventHandler == null)
658 applicationInitEventHandler += value;
659 applicationInitEventCallbackDelegate = new NUIApplicationInitEventCallbackDelegate(OnApplicationInit);
660 initSignal = this.InitSignal();
661 initSignal?.Connect(applicationInitEventCallbackDelegate);
667 if (applicationInitEventHandler != null)
669 initSignal?.Disconnect(applicationInitEventCallbackDelegate);
670 initSignal?.Dispose();
674 applicationInitEventHandler -= value;
678 // Callback for Application InitSignal
679 private void OnApplicationInit(IntPtr data)
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();
687 Log.Info("NUI", "[NUI] OnApplicationInit: ProcessorController Initialize");
688 Tizen.Tracer.Begin("[NUI] OnApplicationInit: ProcessorController Initialize");
689 // Initialize ProcessorController Singleton class. This is also required to create ProcessorController on main thread.
690 ProcessorController.Instance.Initialize();
693 Log.Info("NUI", "[NUI] OnApplicationInit: GetWindow");
694 Tizen.Tracer.Begin("[NUI] OnApplicationInit: GetWindow");
695 Window.Instance = GetWindow();
697 //tv profile never use default focus indicator, so this is not needed!
698 _ = FocusManager.Instance;
702 Log.Info("NUI", "[NUI] OnApplicationInit: Window Show");
703 Tizen.Tracer.Begin("[NUI] OnApplicationInit: Window Show");
704 // Notify that the window is displayed to the app core.
705 if (NUIApplication.IsPreload)
707 Window.Instance.Show();
711 Log.Info("NUI", "[NUI] OnApplicationInit: applicationInitEventHandler Invoke");
712 Tizen.Tracer.Begin("[NUI] OnApplicationInit: applicationInitEventHandler Invoke");
713 if (applicationInitEventHandler != null)
715 NUIApplicationInitEventArgs e = new NUIApplicationInitEventArgs();
716 e.Application = this;
717 applicationInitEventHandler.Invoke(this, e);
722 // Event for Terminated signal which can be used to subscribe/unsubscribe the event handler
723 // provided by the user. Terminated signal is emitted when application is terminating
724 public event DaliEventHandler<object, NUIApplicationTerminatingEventArgs> Terminating
728 // Restricted to only one listener
729 if (applicationTerminateEventHandler == null)
731 applicationTerminateEventHandler += value;
733 applicationTerminateEventCallbackDelegate = new NUIApplicationTerminateEventCallbackDelegate(OnNUIApplicationTerminate);
734 terminateSignal = this.TerminateSignal();
735 terminateSignal?.Connect(applicationTerminateEventCallbackDelegate);
741 if (applicationTerminateEventHandler != null)
743 terminateSignal?.Disconnect(applicationTerminateEventCallbackDelegate);
744 terminateSignal?.Dispose();
745 terminateSignal = null;
748 applicationTerminateEventHandler -= value;
752 // Callback for Application TerminateSignal
753 private void OnNUIApplicationTerminate(IntPtr data)
755 if (applicationTerminateEventHandler != null)
757 NUIApplicationTerminatingEventArgs e = new NUIApplicationTerminatingEventArgs();
758 e.Application = this;
759 applicationTerminateEventHandler.Invoke(this, e);
762 List<Window> windows = GetWindowList();
765 foreach (Window window in windows)
767 window?.DisconnectNativeSignals();
772 // Event for Paused signal which can be used to subscribe/unsubscribe the event handler
773 // provided by the user. Paused signal is emitted when application is paused
774 public event DaliEventHandler<object, NUIApplicationPausedEventArgs> Paused
778 // Restricted to only one listener
779 if (applicationPauseEventHandler == null)
781 applicationPauseEventHandler += value;
783 applicationPauseEventCallbackDelegate = new NUIApplicationPauseEventCallbackDelegate(OnNUIApplicationPause);
784 pauseSignal = this.PauseSignal();
785 pauseSignal?.Connect(applicationPauseEventCallbackDelegate);
791 if (applicationPauseEventHandler != null)
793 pauseSignal?.Disconnect(applicationPauseEventCallbackDelegate);
794 pauseSignal?.Dispose();
798 applicationPauseEventHandler -= value;
802 // Callback for Application PauseSignal
803 private void OnNUIApplicationPause(IntPtr data)
805 if (applicationPauseEventHandler != null)
807 NUIApplicationPausedEventArgs e = new NUIApplicationPausedEventArgs();
808 e.Application = this;
809 applicationPauseEventHandler.Invoke(this, e);
813 // Event for Resumed signal which can be used to subscribe/unsubscribe the event handler
814 // provided by the user. Resumed signal is emitted when application is resumed
815 public event DaliEventHandler<object, NUIApplicationResumedEventArgs> Resumed
819 // Restricted to only one listener
820 if (applicationResumeEventHandler == null)
822 applicationResumeEventHandler += value;
824 applicationResumeEventCallbackDelegate = new NUIApplicationResumeEventCallbackDelegate(OnNUIApplicationResume);
825 resumeSignal = this.ResumeSignal();
826 resumeSignal?.Connect(applicationResumeEventCallbackDelegate);
832 if (applicationResumeEventHandler != null)
834 resumeSignal?.Disconnect(applicationResumeEventCallbackDelegate);
835 resumeSignal?.Dispose();
839 applicationResumeEventHandler -= value;
843 // Callback for Application ResumeSignal
844 private void OnNUIApplicationResume(IntPtr data)
846 if (applicationResumeEventHandler != null)
848 NUIApplicationResumedEventArgs e = new NUIApplicationResumedEventArgs();
849 e.Application = this;
850 applicationResumeEventHandler.Invoke(this, e);
854 // Event for Reset signal which can be used to subscribe/unsubscribe the event handler
855 // provided by the user. Reset signal is emitted when application is reset
856 public new event DaliEventHandler<object, NUIApplicationResetEventArgs> Reset
860 // Restricted to only one listener
861 if (applicationResetEventHandler == null)
863 applicationResetEventHandler += value;
865 applicationResetEventCallbackDelegate = new NUIApplicationResetEventCallbackDelegate(OnNUIApplicationReset);
866 resetSignal = this.ResetSignal();
867 resetSignal?.Connect(applicationResetEventCallbackDelegate);
873 if (applicationResetEventHandler != null)
875 resetSignal?.Disconnect(applicationResetEventCallbackDelegate);
876 resetSignal?.Dispose();
880 applicationResetEventHandler -= value;
884 // Callback for Application ResetSignal
885 private void OnNUIApplicationReset(IntPtr data)
887 if (applicationResetEventHandler != null)
889 NUIApplicationResetEventArgs e = new NUIApplicationResetEventArgs();
890 e.Application = this;
891 applicationResetEventHandler.Invoke(this, e);
895 // Event for LanguageChanged signal which can be used to subscribe/unsubscribe the event handler
896 // provided by the user. LanguageChanged signal is emitted when the region of the device is changed.
897 public event DaliEventHandler<object, NUIApplicationLanguageChangedEventArgs> LanguageChanged
901 // Restricted to only one listener
902 if (applicationLanguageChangedEventHandler == null)
904 applicationLanguageChangedEventHandler += value;
906 applicationLanguageChangedEventCallbackDelegate = new NUIApplicationLanguageChangedEventCallbackDelegate(OnNUIApplicationLanguageChanged);
907 languageChangedSignal = this.LanguageChangedSignal();
908 languageChangedSignal?.Connect(applicationLanguageChangedEventCallbackDelegate);
914 if (applicationLanguageChangedEventHandler != null)
916 languageChangedSignal?.Disconnect(applicationLanguageChangedEventCallbackDelegate);
917 languageChangedSignal?.Dispose();
918 languageChangedSignal = null;
921 applicationLanguageChangedEventHandler -= value;
925 // Callback for Application LanguageChangedSignal
926 private void OnNUIApplicationLanguageChanged(IntPtr data)
928 if (applicationLanguageChangedEventHandler != null)
930 NUIApplicationLanguageChangedEventArgs e = new NUIApplicationLanguageChangedEventArgs();
931 e.Application = this;
932 applicationLanguageChangedEventHandler.Invoke(this, e);
936 // Event for RegionChanged signal which can be used to subscribe/unsubscribe the event handler
937 // provided by the user. RegionChanged signal is emitted when the region of the device is changed.
938 public event DaliEventHandler<object, NUIApplicationRegionChangedEventArgs> RegionChanged
942 // Restricted to only one listener
943 if (applicationRegionChangedEventHandler == null)
945 applicationRegionChangedEventHandler += value;
947 applicationRegionChangedEventCallbackDelegate = new NUIApplicationRegionChangedEventCallbackDelegate(OnNUIApplicationRegionChanged);
948 regionChangedSignal = this.RegionChangedSignal();
949 regionChangedSignal?.Connect(applicationRegionChangedEventCallbackDelegate);
955 if (applicationRegionChangedEventHandler != null)
957 regionChangedSignal?.Disconnect(applicationRegionChangedEventCallbackDelegate);
958 regionChangedSignal?.Dispose();
959 regionChangedSignal = null;
962 applicationRegionChangedEventHandler -= value;
966 // Callback for Application RegionChangedSignal
967 private void OnNUIApplicationRegionChanged(IntPtr data)
969 if (applicationRegionChangedEventHandler != null)
971 NUIApplicationRegionChangedEventArgs e = new NUIApplicationRegionChangedEventArgs();
972 e.Application = this;
973 applicationRegionChangedEventHandler.Invoke(this, e);
977 // Event for BatteryLow signal which can be used to subscribe/unsubscribe the event handler
978 // provided by the user. BatteryLow signal is emitted when the battery level of the device is low.
979 public event DaliEventHandler<object, NUIApplicationBatteryLowEventArgs> BatteryLow
983 // Restricted to only one listener
984 if (applicationBatteryLowEventHandler == null)
986 applicationBatteryLowEventHandler += value;
988 applicationBatteryLowEventCallbackDelegate = new NUIApplicationBatteryLowEventCallbackDelegate(OnNUIApplicationBatteryLow);
989 batteryLowSignal = this.BatteryLowSignal();
990 batteryLowSignal?.Connect(applicationBatteryLowEventCallbackDelegate);
996 if (applicationBatteryLowEventHandler != null)
998 batteryLowSignal?.Disconnect(applicationBatteryLowEventCallbackDelegate);
999 batteryLowSignal?.Dispose();
1000 batteryLowSignal = null;
1003 applicationBatteryLowEventHandler -= value;
1007 // Callback for Application BatteryLowSignal
1008 private void OnNUIApplicationBatteryLow(BatteryStatus status)
1010 NUIApplicationBatteryLowEventArgs e = new NUIApplicationBatteryLowEventArgs();
1012 // Populate all members of "e" (NUIApplicationBatteryLowEventArgs) with real data
1013 e.BatteryStatus = status;
1014 applicationBatteryLowEventHandler?.Invoke(this, e);
1017 // Event for MemoryLow signal which can be used to subscribe/unsubscribe the event handler
1018 // provided by the user. MemoryLow signal is emitted when the memory level of the device is low.
1019 public event DaliEventHandler<object, NUIApplicationMemoryLowEventArgs> MemoryLow
1023 // Restricted to only one listener
1024 if (applicationMemoryLowEventHandler == null)
1026 applicationMemoryLowEventHandler += value;
1028 applicationMemoryLowEventCallbackDelegate = new NUIApplicationMemoryLowEventCallbackDelegate(OnNUIApplicationMemoryLow);
1029 memoryLowSignal = this.MemoryLowSignal();
1030 memoryLowSignal?.Connect(applicationMemoryLowEventCallbackDelegate);
1036 if (applicationMemoryLowEventHandler != null)
1038 memoryLowSignal?.Disconnect(applicationMemoryLowEventCallbackDelegate);
1039 memoryLowSignal?.Dispose();
1040 memoryLowSignal = null;
1043 applicationMemoryLowEventHandler -= value;
1047 // Callback for Application MemoryLowSignal
1048 private void OnNUIApplicationMemoryLow(MemoryStatus status)
1050 NUIApplicationMemoryLowEventArgs e = new NUIApplicationMemoryLowEventArgs();
1052 // Populate all members of "e" (NUIApplicationMemoryLowEventArgs) with real data
1053 e.MemoryStatus = status;
1054 applicationMemoryLowEventHandler?.Invoke(this, e);
1057 // Event for changing Device orientation signal which can be used to subscribe/unsubscribe the event handler
1058 // provided by the user. DeviceOrientationChanged signal is emitted when the device orientation is changed.
1059 public event DaliEventHandler<object, NUIApplicationDeviceOrientationChangedEventArgs> DeviceOrientationChanged
1063 // Restricted to only one listener
1064 if (applicationDeviceOrientationChangedEventHandler == null)
1066 applicationDeviceOrientationChangedEventHandler += value;
1068 applicationDeviceOrientationChangedEventCallback = new NUIApplicationDeviceOrientationChangedEventCallback(OnNUIApplicationDeviceOrientationChanged);
1069 deviceOrientationChangedSignal = this.DeviceOrientationChangedSignal();
1070 deviceOrientationChangedSignal?.Connect(applicationDeviceOrientationChangedEventCallback);
1076 if (applicationDeviceOrientationChangedEventHandler != null)
1078 deviceOrientationChangedSignal?.Disconnect(applicationDeviceOrientationChangedEventCallback);
1079 deviceOrientationChangedSignal?.Dispose();
1080 deviceOrientationChangedSignal = null;
1083 applicationDeviceOrientationChangedEventHandler -= value;
1087 // Callback for Application DeviceOrientationChangedSignal
1088 private void OnNUIApplicationDeviceOrientationChanged(DeviceOrientationStatus status)
1090 NUIApplicationDeviceOrientationChangedEventArgs e = new NUIApplicationDeviceOrientationChangedEventArgs();
1092 e.DeviceOrientationStatus = status;
1093 applicationDeviceOrientationChangedEventHandler?.Invoke(this, e);
1096 // Event for AppControl signal which can be used to subscribe/unsubscribe the event handler
1097 // provided by the user. AppControl signal is emitted when another application sends a launch request to the application.
1098 public event DaliEventHandler<object, NUIApplicationAppControlEventArgs> AppControl
1102 // Restricted to only one listener
1103 if (applicationAppControlEventHandler == null)
1105 applicationAppControlEventHandler += value;
1107 applicationAppControlEventCallbackDelegate = new NUIApplicationAppControlEventCallbackDelegate(OnNUIApplicationAppControl);
1108 appControlSignal = this.AppControlSignal();
1109 appControlSignal?.Connect(applicationAppControlEventCallbackDelegate);
1115 if (applicationAppControlEventHandler != null)
1117 appControlSignal?.Disconnect(applicationAppControlEventCallbackDelegate);
1118 appControlSignal?.Dispose();
1119 appControlSignal = null;
1122 applicationAppControlEventHandler -= value;
1126 // Callback for Application AppControlSignal
1127 private void OnNUIApplicationAppControl(IntPtr application, IntPtr voidp)
1129 if (applicationAppControlEventHandler != null)
1131 NUIApplicationAppControlEventArgs e = new NUIApplicationAppControlEventArgs();
1133 e.Application = this;
1134 applicationAppControlEventHandler.Invoke(this, e);
1139 /// Event for Initialized signal which can be used to subscribe/unsubscribe the event handler
1140 /// provided by the user. Initialized signal is emitted when application is initialized
1142 public event DaliEventHandler<object, NUIApplicationInitEventArgs> TaskInitialized
1146 // Restricted to only one listener
1147 if (applicationTaskInitEventHandler == null)
1149 Tizen.Log.Fatal("NUI", "TaskInitialized Property adding");
1150 applicationTaskInitEventHandler += value;
1151 applicationTaskInitEventCallbackDelegate = new NUIApplicationInitEventCallbackDelegate(OnApplicationTaskInit);
1152 taskInitSignal = this.TaskInitSignal();
1153 taskInitSignal?.Connect(applicationTaskInitEventCallbackDelegate);
1159 if (applicationTaskInitEventHandler != null)
1161 taskInitSignal?.Disconnect(applicationTaskInitEventCallbackDelegate);
1162 taskInitSignal?.Dispose();
1163 taskInitSignal = null;
1166 applicationTaskInitEventHandler -= value;
1170 private void OnApplicationTaskInit(IntPtr data)
1172 if (applicationTaskInitEventHandler != null)
1174 NUIApplicationInitEventArgs e = new NUIApplicationInitEventArgs();
1175 e.Application = this;
1176 applicationTaskInitEventHandler.Invoke(this, e);
1182 /// Event for Terminated signal which can be used to subscribe/unsubscribe the event handler
1183 /// provided by the user. Terminated signal is emitted when application is terminating
1185 public event DaliEventHandler<object, NUIApplicationTerminatingEventArgs> TaskTerminating
1189 // Restricted to only one listener
1190 if (applicationTaskTerminateEventHandler == null)
1192 applicationTaskTerminateEventHandler += value;
1194 applicationTaskTerminateEventCallbackDelegate = new NUIApplicationTerminateEventCallbackDelegate(OnNUIApplicationTaskTerminate);
1195 taskTerminateSignal = this.TaskTerminateSignal();
1196 taskTerminateSignal?.Connect(applicationTaskTerminateEventCallbackDelegate);
1202 if (applicationTaskTerminateEventHandler != null)
1204 taskTerminateSignal?.Disconnect(applicationTaskTerminateEventCallbackDelegate);
1205 taskTerminateSignal?.Dispose();
1206 taskTerminateSignal = null;
1209 applicationTaskTerminateEventHandler -= value;
1213 private void OnNUIApplicationTaskTerminate(IntPtr data)
1215 if (applicationTaskTerminateEventHandler != null)
1217 NUIApplicationTerminatingEventArgs e = new NUIApplicationTerminatingEventArgs();
1218 e.Application = this;
1219 applicationTaskTerminateEventHandler.Invoke(this, e);
1224 /// Event for TaskLanguageChanged signal which can be used to subscribe/unsubscribe the event handler
1225 /// provided by the user. TaskLanguageChanged signal is emitted when the region of the device is changed.
1227 public event DaliEventHandler<object, NUIApplicationLanguageChangedEventArgs> TaskLanguageChanged
1231 // Restricted to only one listener
1232 if (applicationTaskLanguageChangedEventHandler == null)
1234 applicationTaskLanguageChangedEventHandler += value;
1236 applicationTaskLanguageChangedEventCallbackDelegate = new NUIApplicationLanguageChangedEventCallbackDelegate(OnNUIApplicationTaskLanguageChanged);
1237 taskLanguageChangedSignal = this.TaskLanguageChangedSignal();
1238 taskLanguageChangedSignal?.Connect(applicationTaskLanguageChangedEventCallbackDelegate);
1244 if (applicationTaskLanguageChangedEventHandler != null)
1246 taskLanguageChangedSignal?.Disconnect(applicationTaskLanguageChangedEventCallbackDelegate);
1247 taskLanguageChangedSignal?.Dispose();
1248 taskLanguageChangedSignal = null;
1251 applicationTaskLanguageChangedEventHandler -= value;
1255 private void OnNUIApplicationTaskLanguageChanged(IntPtr data)
1257 if (applicationTaskLanguageChangedEventHandler != null)
1259 NUIApplicationLanguageChangedEventArgs e = new NUIApplicationLanguageChangedEventArgs();
1260 e.Application = this;
1261 applicationTaskLanguageChangedEventHandler.Invoke(this, e);
1266 /// Event for TaskRegionChanged signal which can be used to subscribe/unsubscribe the event handler
1267 /// provided by the user. TaskRegionChanged signal is emitted when the region of the device is changed.
1269 public event DaliEventHandler<object, NUIApplicationRegionChangedEventArgs> TaskRegionChanged
1273 // Restricted to only one listener
1274 if (applicationTaskRegionChangedEventHandler == null)
1276 applicationTaskRegionChangedEventHandler += value;
1278 applicationTaskRegionChangedEventCallbackDelegate = new NUIApplicationRegionChangedEventCallbackDelegate(OnNUIApplicationTaskRegionChanged);
1279 taskRegionChangedSignal = this.TaskRegionChangedSignal();
1280 taskRegionChangedSignal?.Connect(applicationTaskRegionChangedEventCallbackDelegate);
1286 if (applicationTaskRegionChangedEventHandler != null)
1288 taskRegionChangedSignal?.Disconnect(applicationTaskRegionChangedEventCallbackDelegate);
1289 taskRegionChangedSignal?.Dispose();
1290 taskRegionChangedSignal = null;
1293 applicationTaskRegionChangedEventHandler -= value;
1297 private void OnNUIApplicationTaskRegionChanged(IntPtr data)
1299 if (applicationTaskRegionChangedEventHandler != null)
1301 NUIApplicationRegionChangedEventArgs e = new NUIApplicationRegionChangedEventArgs();
1302 e.Application = this;
1303 applicationTaskRegionChangedEventHandler.Invoke(this, e);
1308 /// Event for TaskBatteryLow signal which can be used to subscribe/unsubscribe the event handler
1309 /// provided by the user. TaskBatteryLow signal is emitted when the battery level of the device is low.
1311 public event DaliEventHandler<object, NUIApplicationBatteryLowEventArgs> TaskBatteryLow
1315 // Restricted to only one listener
1316 if (applicationTaskBatteryLowEventHandler == null)
1318 applicationTaskBatteryLowEventHandler += value;
1320 applicationTaskBatteryLowEventCallbackDelegate = new NUIApplicationBatteryLowEventCallbackDelegate(OnNUIApplicationTaskBatteryLow);
1321 taskBatteryLowSignal = this.TaskBatteryLowSignal();
1322 taskBatteryLowSignal?.Connect(applicationTaskBatteryLowEventCallbackDelegate);
1328 if (applicationTaskBatteryLowEventHandler != null)
1330 taskBatteryLowSignal?.Disconnect(applicationTaskBatteryLowEventCallbackDelegate);
1331 taskBatteryLowSignal?.Dispose();
1332 taskBatteryLowSignal = null;
1335 applicationTaskBatteryLowEventHandler -= value;
1339 private void OnNUIApplicationTaskBatteryLow(BatteryStatus status)
1341 NUIApplicationBatteryLowEventArgs e = new NUIApplicationBatteryLowEventArgs();
1343 // Populate all members of "e" (NUIApplicationBatteryLowEventArgs) with real data
1344 e.BatteryStatus = status;
1345 applicationTaskBatteryLowEventHandler?.Invoke(this, e);
1349 /// Event for TaskMemoryLow signal which can be used to subscribe/unsubscribe the event handler
1350 /// provided by the user. TaskMemoryLow signal is emitted when the memory level of the device is low.
1352 public event DaliEventHandler<object, NUIApplicationMemoryLowEventArgs> TaskMemoryLow
1356 // Restricted to only one listener
1357 if (applicationTaskMemoryLowEventHandler == null)
1359 applicationTaskMemoryLowEventHandler += value;
1361 applicationTaskMemoryLowEventCallbackDelegate = new NUIApplicationMemoryLowEventCallbackDelegate(OnNUIApplicationTaskMemoryLow);
1362 taskMemoryLowSignal = this.TaskMemoryLowSignal();
1363 taskMemoryLowSignal?.Connect(applicationTaskMemoryLowEventCallbackDelegate);
1369 if (applicationTaskMemoryLowEventHandler != null)
1371 taskMemoryLowSignal?.Disconnect(applicationTaskMemoryLowEventCallbackDelegate);
1372 taskMemoryLowSignal?.Dispose();
1373 taskMemoryLowSignal = null;
1376 applicationTaskMemoryLowEventHandler -= value;
1380 private void OnNUIApplicationTaskMemoryLow(MemoryStatus status)
1382 NUIApplicationMemoryLowEventArgs e = new NUIApplicationMemoryLowEventArgs();
1384 // Populate all members of "e" (NUIApplicationMemoryLowEventArgs) with real data
1385 e.MemoryStatus = status;
1386 applicationTaskMemoryLowEventHandler?.Invoke(this, e);
1390 /// Event for TaskDeviceOrientationChanged signal which can be used to subscribe/unsubscribe the event handler
1391 /// provided by the user. TaskDeviceOrientationChanged signal is emitted when the device orientation is changed.
1393 public event DaliEventHandler<object, NUIApplicationDeviceOrientationChangedEventArgs> TaskDeviceOrientationChanged
1397 if (applicationTaskDeviceOrientationChangedEventHandler == null)
1399 applicationTaskDeviceOrientationChangedEventHandler += value;
1401 applicationTaskDeviceOrientationChangedEventCallback = new NUIApplicationDeviceOrientationChangedEventCallback(OnNUIApplicationTaskDeviceOrientationChanged);
1402 taskDeviceOrientationChangedSignal = this.TaskDeviceOrientationChangedSignal();
1403 taskDeviceOrientationChangedSignal?.Connect(applicationTaskDeviceOrientationChangedEventCallback);
1409 if (applicationTaskDeviceOrientationChangedEventHandler != null)
1411 taskDeviceOrientationChangedSignal?.Disconnect(applicationTaskDeviceOrientationChangedEventCallback);
1412 taskDeviceOrientationChangedSignal?.Dispose();
1413 taskDeviceOrientationChangedSignal = null;
1416 applicationTaskDeviceOrientationChangedEventHandler -= value;
1420 private void OnNUIApplicationTaskDeviceOrientationChanged(DeviceOrientationStatus status)
1422 NUIApplicationDeviceOrientationChangedEventArgs e = new NUIApplicationDeviceOrientationChangedEventArgs();
1424 e.DeviceOrientationStatus = status;
1425 applicationTaskDeviceOrientationChangedEventHandler?.Invoke(this, e);
1429 /// Event for TaskAppControl signal which can be used to subscribe/unsubscribe the event handler
1430 /// provided by the user. TaskAppControl signal is emitted when another application sends a launch request to the application.
1432 public event DaliEventHandler<object, NUIApplicationAppControlEventArgs> TaskAppControl
1436 // Restricted to only one listener
1437 if (applicationTaskAppControlEventHandler == null)
1439 applicationTaskAppControlEventHandler += value;
1441 applicationTaskAppControlEventCallbackDelegate = new NUIApplicationAppControlEventCallbackDelegate(OnNUIApplicationTaskAppControl);
1442 taskAppControlSignal = this.TaskAppControlSignal();
1443 taskAppControlSignal?.Connect(applicationTaskAppControlEventCallbackDelegate);
1449 if (applicationTaskAppControlEventHandler != null)
1451 taskAppControlSignal?.Disconnect(applicationTaskAppControlEventCallbackDelegate);
1452 taskAppControlSignal?.Dispose();
1453 taskAppControlSignal = null;
1456 applicationTaskAppControlEventHandler -= value;
1460 private void OnNUIApplicationTaskAppControl(IntPtr application, IntPtr voidp)
1462 if (applicationTaskAppControlEventHandler != null)
1464 NUIApplicationAppControlEventArgs e = new NUIApplicationAppControlEventArgs();
1466 e.Application = this;
1467 applicationTaskAppControlEventHandler.Invoke(this, e);
1471 protected static Application instance; // singleton
1473 public static Application Instance
1481 public static Application GetApplicationFromPtr(global::System.IntPtr cPtr)
1483 if (cPtr == global::System.IntPtr.Zero)
1488 Application ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Application;
1489 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1493 public static Application NewApplication()
1495 return NewApplication("", NUIApplication.WindowMode.Opaque);
1498 public static Application NewApplication(string stylesheet)
1500 return NewApplication(stylesheet, NUIApplication.WindowMode.Opaque);
1503 public static Application NewApplication(string stylesheet, NUIApplication.WindowMode windowMode)
1505 // register all Views with the type registry, so that can be created / styled via JSON
1506 //ViewRegistryHelper.Initialize(); //moved to Application side.
1507 if (instance != null)
1512 Application ret = New(1, stylesheet, windowMode);
1513 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1515 // set the singleton
1520 public static Application NewApplication(string stylesheet, NUIApplication.WindowMode windowMode, Rectangle positionSize)
1522 if (instance != null)
1526 Application ret = New(1, stylesheet, windowMode, positionSize);
1527 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1529 // set the singleton
1534 public static Application NewApplication(string[] args, string stylesheet, NUIApplication.WindowMode windowMode)
1536 if (instance != null)
1540 Application ret = New(args, stylesheet, windowMode);
1541 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1543 // set the singleton
1548 public static Application NewApplication(string[] args, string stylesheet, NUIApplication.WindowMode windowMode, Rectangle positionSize)
1550 if (instance != null)
1554 Application ret = New(args, stylesheet, windowMode, positionSize);
1555 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1557 // set the singleton
1562 public static Application NewApplication(string[] args, string stylesheet, NUIApplication.WindowMode windowMode, WindowType type)
1564 if (instance != null)
1568 Application ret = New(args, stylesheet, windowMode, type);
1569 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1575 public static Application NewApplication(string[] args, string stylesheet, NUIApplication.WindowMode windowMode, Rectangle positionSize, bool useUIThread)
1577 if (instance != null)
1581 Application ret = New(args, stylesheet, windowMode, positionSize, useUIThread);
1582 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1588 public static Application NewApplication(string[] args, string stylesheet, bool useUIThread, WindowData windowData)
1590 if (instance != null)
1594 Application ret = New(args, stylesheet, useUIThread, windowData);
1595 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1602 /// Ensures that the function passed in is called from the main loop when it is idle.
1604 /// <param name="func">The function to call</param>
1605 /// <returns>true if added successfully, false otherwise</returns>
1607 /// It will return false when one of the following conditions is met.
1608 /// 1) the <see cref="Window"/> is hidden.
1609 /// 2) the <see cref="Window"/> is iconified.
1611 public bool AddIdle(System.Delegate func)
1613 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
1614 System.IntPtr ip2 = Interop.Application.MakeCallback(new System.Runtime.InteropServices.HandleRef(this, ip));
1616 bool ret = Interop.Application.AddIdle(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip2));
1618 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1623 * Outer::outer_method(int)
1625 public static Application New()
1627 Application ret = new Application(Interop.Application.New(), true);
1628 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1632 public static Application New(int argc)
1634 Application ret = new Application(Interop.Application.New(argc), true);
1635 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1639 public static Application New(int argc, string stylesheet)
1641 Application ret = new Application(Interop.Application.New(argc, stylesheet), true);
1642 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1646 public static Application New(int argc, string stylesheet, NUIApplication.WindowMode windowMode)
1648 Application ret = new Application(Interop.Application.New(argc, stylesheet, (int)windowMode), true);
1649 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1654 public static Application New(string[] args, string stylesheet, NUIApplication.WindowMode windowMode)
1656 Application ret = null;
1658 string argvStr = "";
1662 argvStr = string.Join(" ", args);
1664 catch (Exception exception)
1666 Tizen.Log.Fatal("NUI", "[Error] got exception during Application New(), this should not occur, message : " + exception.Message);
1667 Tizen.Log.Fatal("NUI", "[Error] error line number : " + new StackTrace(exception, true).GetFrame(0).GetFileLineNumber());
1668 Tizen.Log.Fatal("NUI", "[Error] Stack Trace : " + exception.StackTrace);
1672 ret = new Application(NDalicPINVOKE.ApplicationNewManual4(argc, argvStr, stylesheet, (int)windowMode), true);
1673 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1678 public static Application New(int argc, string stylesheet, NUIApplication.WindowMode windowMode, Rectangle positionSize)
1680 Application ret = new Application(Interop.Application.New(argc, stylesheet, (int)windowMode, Rectangle.getCPtr(positionSize)), true);
1681 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1685 public static Application New(string[] args, string stylesheet, NUIApplication.WindowMode windowMode, Rectangle positionSize)
1687 Application ret = null;
1689 string argvStr = "";
1693 argvStr = string.Join(" ", args);
1695 catch (Exception exception)
1697 Tizen.Log.Fatal("NUI", "[Error] got exception during Application New(), this should not occur, message : " + exception.Message);
1698 Tizen.Log.Fatal("NUI", "[Error] error line number : " + new StackTrace(exception, true).GetFrame(0).GetFileLineNumber());
1699 Tizen.Log.Fatal("NUI", "[Error] Stack Trace : " + exception.StackTrace);
1703 ret = new Application(NDalicPINVOKE.ApplicationNewWithWindowSizePosition(argc, argvStr, stylesheet, (int)windowMode, Rectangle.getCPtr(positionSize)), true);
1704 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1709 public static Application New(string[] args, string stylesheet, NUIApplication.WindowMode windowMode, WindowType type)
1712 string argvStr = "";
1716 argvStr = string.Join(" ", args);
1718 catch (Exception exception)
1720 Tizen.Log.Fatal("NUI", "[Error] got exception during Application New(), this should not occur, message : " + exception.Message);
1721 Tizen.Log.Fatal("NUI", "[Error] error line number : " + new StackTrace(exception, true).GetFrame(0).GetFileLineNumber());
1722 Tizen.Log.Fatal("NUI", "[Error] Stack Trace : " + exception.StackTrace);
1726 // It will be removed until dali APIs are prepared.
1727 Rectangle initRectangle = new Rectangle(0, 0, 0, 0);
1729 Application ret = new Application(Interop.Application.New(argc, argvStr, stylesheet, (int)windowMode, Rectangle.getCPtr(initRectangle), (int)type), true);
1730 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1734 public static Application New(string[] args, string stylesheet, NUIApplication.WindowMode windowMode, Rectangle positionSize, bool useUIThread)
1736 Application ret = null;
1738 string argvStr = "";
1742 argvStr = string.Join(" ", args);
1744 ret = new Application(Interop.Application.New(argc, argvStr, stylesheet, (int)windowMode, Rectangle.getCPtr(positionSize), useUIThread), true);
1745 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1747 catch (Exception exception)
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);
1758 public static Application New(string[] args, string stylesheet, bool useUIThread, WindowData windowData)
1760 Application ret = null;
1762 string argvStr = "";
1766 argvStr = string.Join(" ", args);
1768 ret = new Application(Interop.Application.New(argc, argvStr, stylesheet, useUIThread, WindowData.getCPtr(windowData)), true);
1769 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1771 catch (Exception exception)
1773 Tizen.Log.Fatal("NUI", "[Error] got exception during Application New(), this should not occur, message : " + exception.Message);
1774 Tizen.Log.Fatal("NUI", "[Error] error line number : " + new StackTrace(exception, true).GetFrame(0).GetFileLineNumber());
1775 Tizen.Log.Fatal("NUI", "[Error] Stack Trace : " + exception.StackTrace);
1782 public Application() : this(Interop.Application.NewApplication(), true)
1784 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1787 public Application(Application application) : this(Interop.Application.NewApplication(Application.getCPtr(application)), true)
1789 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1792 public Application Assign(Application application)
1794 Application ret = new Application(Interop.Application.Assign(SwigCPtr, Application.getCPtr(application)), false);
1795 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1799 public void MainLoop()
1801 NDalicPINVOKE.ApplicationMainLoop(SwigCPtr);
1802 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1807 Interop.Application.Lower(SwigCPtr);
1808 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1813 Interop.Application.Quit(SwigCPtr);
1814 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1817 internal bool AddIdle(SWIGTYPE_p_Dali__CallbackBase callback)
1819 bool ret = Interop.Application.AddIdle(SwigCPtr, SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback));
1820 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1824 public Window GetWindow()
1831 var nativeWindow = Interop.Application.GetWindow(SwigCPtr);
1832 window = Registry.GetManagedBaseHandleFromNativePtr(nativeWindow) as Window;
1835 HandleRef CPtr = new HandleRef(this, nativeWindow);
1836 Interop.BaseHandle.DeleteBaseHandle(CPtr);
1837 CPtr = new HandleRef(null, IntPtr.Zero);
1841 window = new Window(nativeWindow, true);
1844 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1848 public static string GetResourcePath()
1850 string ret = Interop.Application.GetResourcePath();
1851 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1855 public string GetLanguage()
1857 string ret = Interop.Application.GetLanguage(SwigCPtr);
1858 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1862 public string GetRegion()
1864 string ret = Interop.Application.GetRegion(SwigCPtr);
1865 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1869 public void FlushUpdateMessages()
1871 Interop.Application.FlushUpdateMessages(SwigCPtr);
1872 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1875 [EditorBrowsable(EditorBrowsableState.Never)]
1876 public static List<Window> GetWindowList()
1878 if (Interop.Stage.IsInstalled() == false)
1880 NUILog.ErrorBacktrace($"[ERROR] dali adaptor and dali window is not ready. just return NULL here");
1884 uint ListSize = Interop.Application.GetWindowsListSize();
1885 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1887 List<Window> WindowList = new List<Window>();
1888 for (uint i = 0; i < ListSize; ++i)
1890 Window currWin = WindowList.GetInstanceSafely<Window>(Interop.Application.GetWindowsFromList(i));
1891 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1892 if (currWin != null)
1894 WindowList.Add(currWin);
1900 internal ApplicationSignal InitSignal()
1902 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationInitSignal(SwigCPtr), false);
1903 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1907 internal ApplicationSignal TerminateSignal()
1909 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationTerminateSignal(SwigCPtr), false);
1910 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1914 internal ApplicationSignal PauseSignal()
1916 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationPauseSignal(SwigCPtr), false);
1917 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1921 internal ApplicationSignal ResumeSignal()
1923 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationResumeSignal(SwigCPtr), false);
1924 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1928 internal ApplicationSignal ResetSignal()
1930 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationResetSignal(SwigCPtr), false);
1931 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1935 internal ApplicationControlSignal AppControlSignal()
1937 ApplicationControlSignal ret = new ApplicationControlSignal(NDalicPINVOKE.ApplicationAppControlSignal(SwigCPtr), false);
1938 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1942 internal ApplicationSignal LanguageChangedSignal()
1944 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationLanguageChangedSignal(SwigCPtr), false);
1945 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1949 internal ApplicationSignal RegionChangedSignal()
1951 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationRegionChangedSignal(SwigCPtr), false);
1952 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1956 internal LowBatterySignalType BatteryLowSignal()
1958 LowBatterySignalType ret = new LowBatterySignalType(NDalicPINVOKE.ApplicationLowBatterySignal(SwigCPtr), false);
1959 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1963 internal LowMemorySignalType MemoryLowSignal()
1965 LowMemorySignalType ret = new LowMemorySignalType(NDalicPINVOKE.ApplicationLowMemorySignal(SwigCPtr), false);
1966 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1970 internal DeviceOrientationChangedSignalType DeviceOrientationChangedSignal()
1972 DeviceOrientationChangedSignalType ret = new DeviceOrientationChangedSignalType(NDalicPINVOKE.ApplicationDeviceOrientationChangedSignal(SwigCPtr), false);
1973 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1978 internal ApplicationSignal TaskInitSignal()
1980 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationTaskInitSignal(SwigCPtr), false);
1981 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1985 internal ApplicationSignal TaskTerminateSignal()
1987 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationTaskTerminateSignal(SwigCPtr), false);
1988 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1992 internal ApplicationControlSignal TaskAppControlSignal()
1994 ApplicationControlSignal ret = new ApplicationControlSignal(NDalicPINVOKE.ApplicationTaskAppControlSignal(SwigCPtr), false);
1995 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1999 internal ApplicationSignal TaskLanguageChangedSignal()
2001 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationTaskLanguageChangedSignal(SwigCPtr), false);
2002 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2006 internal ApplicationSignal TaskRegionChangedSignal()
2008 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.ApplicationTaskRegionChangedSignal(SwigCPtr), false);
2009 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2013 internal LowBatterySignalType TaskBatteryLowSignal()
2015 LowBatterySignalType ret = new LowBatterySignalType(NDalicPINVOKE.ApplicationTaskLowBatterySignal(SwigCPtr), false);
2016 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2020 internal LowMemorySignalType TaskMemoryLowSignal()
2022 LowMemorySignalType ret = new LowMemorySignalType(NDalicPINVOKE.ApplicationTaskLowMemorySignal(SwigCPtr), false);
2023 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
2027 internal DeviceOrientationChangedSignalType TaskDeviceOrientationChangedSignal()
2029 DeviceOrientationChangedSignalType ret = new DeviceOrientationChangedSignalType(NDalicPINVOKE.ApplicationTaskDeviceOrientationChangedSignal(SwigCPtr), false);
2030 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();