1 /** Copyright (c) 2017 Samsung Electronics Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
21 using System.Runtime.InteropServices;
24 * @brief Event arguments that passed via NUIApplicationInit signal
27 internal class NUIApplicationInitEventArgs : EventArgs
29 private Application _application;
32 * @brief Application - is the application that is being initialized
35 public Application Application
49 * @brief Event arguments that passed via NUIApplicationTerminate signal
52 internal class NUIApplicationTerminatingEventArgs : EventArgs
54 private Application _application;
56 * @brief Application - is the application that is being Terminated
59 public Application Application
73 * @brief Event arguments that passed via NUIApplicationPause signal
76 internal class NUIApplicationPausedEventArgs : EventArgs
78 private Application _application;
80 * @brief Application - is the application that is being Paused
83 public Application Application
97 * @brief Event arguments that passed via NUIApplicationResume signal
100 internal class NUIApplicationResumedEventArgs : EventArgs
102 private Application _application;
104 * @brief Application - is the application that is being Resumed
107 public Application Application
115 _application = value;
121 * @brief Event arguments that passed via NUIApplicationReset signal
124 internal class NUIApplicationResetEventArgs : EventArgs
126 private Application _application;
128 * @brief Application - is the application that is being Reset
131 public Application Application
139 _application = value;
145 * @brief Event arguments that passed via NUIApplicationResize signal
148 internal class NUIApplicationResizedEventArgs : EventArgs
150 private Application _application;
152 * @brief Application - is the application that is being Resized
155 public Application Application
163 _application = value;
169 * @brief Event arguments that passed via NUIApplicationLanguageChanged signal
172 internal class NUIApplicationLanguageChangedEventArgs : EventArgs
174 private Application _application;
176 * @brief Application - is the application that is being affected with Device's language change
179 public Application Application
187 _application = value;
193 * @brief Event arguments that passed via NUIApplicationRegionChanged signal
196 internal class NUIApplicationRegionChangedEventArgs : EventArgs
198 private Application _application;
200 * @brief Application - is the application that is being affected with Device's region change
203 public Application Application
211 _application = value;
217 * @brief Event arguments that passed via NUIApplicationBatteryLow signal
220 internal class NUIApplicationBatteryLowEventArgs : EventArgs
222 private Application _application;
224 * @brief Application - is the application that is being affected when the battery level of the device is low
227 public Application Application
235 _application = value;
241 * @brief Event arguments that passed via NUIApplicationMemoryLow signal
244 internal class NUIApplicationMemoryLowEventArgs : EventArgs
246 private Application _application;
248 * @brief Application - is the application that is being affected when the memory level of the device is low
251 public Application Application
259 _application = value;
265 * @brief Event arguments that passed via NUIApplicationAppControl signal
268 internal class NUIApplicationAppControlEventArgs : EventArgs
270 private Application _application;
271 private IntPtr _voidp;
273 * @brief Application - is the application that is receiving the launch request from another application
276 public Application Application
284 _application = value;
288 * @brief VoidP - contains the information about why the application is launched
304 internal class Application : BaseHandle
306 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
308 internal Application(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Application_SWIGUpcast(cPtr), cMemoryOwn)
310 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
313 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Application obj)
315 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
318 protected override void Dispose(DisposeTypes type)
325 if (type == DisposeTypes.Explicit)
328 //Release your own managed resources here.
329 //You should release all of your own disposable objects here.
333 //Release your own unmanaged resources here.
334 //You should not access any managed member here except static instance.
335 //because the execution order of Finalizes is non-deterministic.
337 if (_applicationInitEventCallbackDelegate != null)
339 this.InitSignal().Disconnect(_applicationInitEventCallbackDelegate);
342 if (_applicationTerminateEventCallbackDelegate != null)
344 this.TerminateSignal().Disconnect(_applicationTerminateEventCallbackDelegate);
347 if (_applicationPauseEventCallbackDelegate != null)
349 this.PauseSignal().Disconnect(_applicationPauseEventCallbackDelegate);
352 if (_applicationResumeEventCallbackDelegate != null)
354 this.ResumeSignal().Disconnect(_applicationResumeEventCallbackDelegate);
357 if (_applicationResetEventCallbackDelegate != null)
359 this.ResetSignal().Disconnect(_applicationResetEventCallbackDelegate);
362 if (_applicationResizeEventCallbackDelegate != null)
364 this.ResizeSignal().Disconnect(_applicationResizeEventCallbackDelegate);
367 if (_applicationLanguageChangedEventCallbackDelegate != null)
369 this.LanguageChangedSignal().Disconnect(_applicationLanguageChangedEventCallbackDelegate);
372 if (_applicationRegionChangedEventCallbackDelegate != null)
374 this.RegionChangedSignal().Disconnect(_applicationRegionChangedEventCallbackDelegate);
377 if (_applicationBatteryLowEventCallbackDelegate != null)
379 this.BatteryLowSignal().Disconnect(_applicationBatteryLowEventCallbackDelegate);
382 if (_applicationMemoryLowEventCallbackDelegate != null)
384 this.MemoryLowSignal().Disconnect(_applicationMemoryLowEventCallbackDelegate);
387 if (_applicationAppControlEventCallbackDelegate != null)
389 this.AppControlSignal().Disconnect(_applicationAppControlEventCallbackDelegate);
392 if (swigCPtr.Handle != global::System.IntPtr.Zero)
397 NDalicPINVOKE.delete_Application(swigCPtr);
399 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
405 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
406 private delegate void NUIApplicationInitEventCallbackDelegate(IntPtr application);
407 private DaliEventHandler<object, NUIApplicationInitEventArgs> _applicationInitEventHandler;
408 private NUIApplicationInitEventCallbackDelegate _applicationInitEventCallbackDelegate;
411 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
412 private delegate void NUIApplicationTerminateEventCallbackDelegate(IntPtr application);
413 private DaliEventHandler<object, NUIApplicationTerminatingEventArgs> _applicationTerminateEventHandler;
414 private NUIApplicationTerminateEventCallbackDelegate _applicationTerminateEventCallbackDelegate;
417 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
418 private delegate void NUIApplicationPauseEventCallbackDelegate(IntPtr application);
419 private DaliEventHandler<object, NUIApplicationPausedEventArgs> _applicationPauseEventHandler;
420 private NUIApplicationPauseEventCallbackDelegate _applicationPauseEventCallbackDelegate;
422 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
423 private delegate void NUIApplicationResumeEventCallbackDelegate(IntPtr application);
424 private DaliEventHandler<object, NUIApplicationResumedEventArgs> _applicationResumeEventHandler;
425 private NUIApplicationResumeEventCallbackDelegate _applicationResumeEventCallbackDelegate;
427 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
428 private delegate void NUIApplicationResetEventCallbackDelegate(IntPtr application);
429 private DaliEventHandler<object, NUIApplicationResetEventArgs> _applicationResetEventHandler;
430 private NUIApplicationResetEventCallbackDelegate _applicationResetEventCallbackDelegate;
432 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
433 private delegate void NUIApplicationResizeEventCallbackDelegate(IntPtr application);
434 private DaliEventHandler<object, NUIApplicationResizedEventArgs> _applicationResizeEventHandler;
435 private NUIApplicationResizeEventCallbackDelegate _applicationResizeEventCallbackDelegate;
437 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
438 private delegate void NUIApplicationLanguageChangedEventCallbackDelegate(IntPtr application);
439 private DaliEventHandler<object, NUIApplicationLanguageChangedEventArgs> _applicationLanguageChangedEventHandler;
440 private NUIApplicationLanguageChangedEventCallbackDelegate _applicationLanguageChangedEventCallbackDelegate;
443 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
444 private delegate void NUIApplicationRegionChangedEventCallbackDelegate(IntPtr application);
445 private DaliEventHandler<object, NUIApplicationRegionChangedEventArgs> _applicationRegionChangedEventHandler;
446 private NUIApplicationRegionChangedEventCallbackDelegate _applicationRegionChangedEventCallbackDelegate;
448 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
449 private delegate void NUIApplicationBatteryLowEventCallbackDelegate(IntPtr application);
450 private DaliEventHandler<object, NUIApplicationBatteryLowEventArgs> _applicationBatteryLowEventHandler;
451 private NUIApplicationBatteryLowEventCallbackDelegate _applicationBatteryLowEventCallbackDelegate;
453 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
454 private delegate void NUIApplicationMemoryLowEventCallbackDelegate(IntPtr application);
455 private DaliEventHandler<object, NUIApplicationMemoryLowEventArgs> _applicationMemoryLowEventHandler;
456 private NUIApplicationMemoryLowEventCallbackDelegate _applicationMemoryLowEventCallbackDelegate;
458 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
459 private delegate void NUIApplicationAppControlEventCallbackDelegate(IntPtr application, IntPtr voidp);
460 private DaliEventHandler<object, NUIApplicationAppControlEventArgs> _applicationAppControlEventHandler;
461 private NUIApplicationAppControlEventCallbackDelegate _applicationAppControlEventCallbackDelegate;
464 * @brief Event for Initialized signal which can be used to subscribe/unsubscribe the event handler
465 * (in the type of NUIApplicationInitEventHandler - DaliEventHandler<object,NUIApplicationInitEventArgs>)
466 * provided by the user. Initialized signal is emitted when application is initialised
468 public event DaliEventHandler<object, NUIApplicationInitEventArgs> Initialized
474 // Restricted to only one listener
475 if (_applicationInitEventHandler == null)
477 _applicationInitEventHandler += value;
479 _applicationInitEventCallbackDelegate = new NUIApplicationInitEventCallbackDelegate(OnApplicationInit);
480 this.InitSignal().Connect(_applicationInitEventCallbackDelegate);
489 if (_applicationInitEventHandler != null)
491 this.InitSignal().Disconnect(_applicationInitEventCallbackDelegate);
494 _applicationInitEventHandler -= value;
499 // Callback for Application InitSignal
500 private void OnApplicationInit(IntPtr data)
502 // Initialize DisposeQueue Singleton class. This is also required to create DisposeQueue on main thread.
503 DisposeQueue.Instance.Initialize();
504 NUIApplicationInitEventArgs e = new NUIApplicationInitEventArgs();
506 // Populate all members of "e" (NUIApplicationInitEventArgs) with real data
507 e.Application = Application.GetApplicationFromPtr(data);
509 if (_applicationInitEventHandler != null)
511 //here we send all data to user event handlers
512 _applicationInitEventHandler(this, e);
517 * @brief Event for Terminated signal which can be used to subscribe/unsubscribe the event handler
518 * (in the type of NUIApplicationTerminateEventHandler-DaliEventHandler<object,NUIApplicationTerminateEventArgs>)
519 * provided by the user. Terminated signal is emitted when application is terminating
521 public event DaliEventHandler<object, NUIApplicationTerminatingEventArgs> Terminating
527 // Restricted to only one listener
528 if (_applicationTerminateEventHandler == null)
530 _applicationTerminateEventHandler += value;
532 _applicationTerminateEventCallbackDelegate = new NUIApplicationTerminateEventCallbackDelegate(OnNUIApplicationTerminate);
533 this.TerminateSignal().Connect(_applicationTerminateEventCallbackDelegate);
542 if (_applicationTerminateEventHandler != null)
544 this.TerminateSignal().Disconnect(_applicationTerminateEventCallbackDelegate);
547 _applicationTerminateEventHandler -= value;
552 // Callback for Application TerminateSignal
553 private void OnNUIApplicationTerminate(IntPtr data)
555 NUIApplicationTerminatingEventArgs e = new NUIApplicationTerminatingEventArgs();
557 // Populate all members of "e" (NUIApplicationTerminateEventArgs) with real data
558 e.Application = Application.GetApplicationFromPtr(data);
560 if (_applicationTerminateEventHandler != null)
562 //here we send all data to user event handlers
563 _applicationTerminateEventHandler(this, e);
568 * @brief Event for Paused signal which can be used to subscribe/unsubscribe the event handler
569 * (in the type of NUIApplicationPauseEventHandler-DaliEventHandler<object,NUIApplicationPauseEventArgs>)
570 * provided by the user. Paused signal is emitted when application is paused
572 public event DaliEventHandler<object, NUIApplicationPausedEventArgs> Paused
578 // Restricted to only one listener
579 if (_applicationPauseEventHandler == null)
581 _applicationPauseEventHandler += value;
583 _applicationPauseEventCallbackDelegate = new NUIApplicationPauseEventCallbackDelegate(OnNUIApplicationPause);
584 this.PauseSignal().Connect(_applicationPauseEventCallbackDelegate);
593 if (_applicationPauseEventHandler != null)
595 this.PauseSignal().Disconnect(_applicationPauseEventCallbackDelegate);
598 _applicationPauseEventHandler -= value;
603 // Callback for Application PauseSignal
604 private void OnNUIApplicationPause(IntPtr data)
606 NUIApplicationPausedEventArgs e = new NUIApplicationPausedEventArgs();
608 // Populate all members of "e" (NUIApplicationPauseEventArgs) with real data
609 e.Application = Application.GetApplicationFromPtr(data);
611 if (_applicationPauseEventHandler != null)
613 //here we send all data to user event handlers
614 _applicationPauseEventHandler(this, e);
619 * @brief Event for Resumed signal which can be used to subscribe/unsubscribe the event handler
620 * (in the type of NUIApplicationResumeEventHandler-DaliEventHandler<object,NUIApplicationResumeEventArgs>)
621 * provided by the user. Resumed signal is emitted when application is resumed
623 public event DaliEventHandler<object, NUIApplicationResumedEventArgs> Resumed
629 // Restricted to only one listener
630 if (_applicationResumeEventHandler == null)
632 _applicationResumeEventHandler += value;
634 _applicationResumeEventCallbackDelegate = new NUIApplicationResumeEventCallbackDelegate(OnNUIApplicationResume);
635 this.ResumeSignal().Connect(_applicationResumeEventCallbackDelegate);
644 if (_applicationResumeEventHandler != null)
646 this.ResumeSignal().Disconnect(_applicationResumeEventCallbackDelegate);
649 _applicationResumeEventHandler -= value;
654 // Callback for Application ResumeSignal
655 private void OnNUIApplicationResume(IntPtr data)
657 NUIApplicationResumedEventArgs e = new NUIApplicationResumedEventArgs();
659 // Populate all members of "e" (NUIApplicationResumeEventArgs) with real data
660 e.Application = Application.GetApplicationFromPtr(data);
662 if (_applicationResumeEventHandler != null)
664 //here we send all data to user event handlers
665 _applicationResumeEventHandler(this, e);
670 * @brief Event for Reset signal which can be used to subscribe/unsubscribe the event handler
671 * (in the type of NUIApplicationResetEventHandler-DaliEventHandler<object,NUIApplicationResetEventArgs>)
672 * provided by the user. Reset signal is emitted when application is reset
674 public new event DaliEventHandler<object, NUIApplicationResetEventArgs> Reset
680 // Restricted to only one listener
681 if (_applicationResetEventHandler == null)
683 _applicationResetEventHandler += value;
685 _applicationResetEventCallbackDelegate = new NUIApplicationResetEventCallbackDelegate(OnNUIApplicationReset);
686 this.ResetSignal().Connect(_applicationResetEventCallbackDelegate);
695 if (_applicationResetEventHandler != null)
697 this.ResetSignal().Disconnect(_applicationResetEventCallbackDelegate);
700 _applicationResetEventHandler -= value;
705 // Callback for Application ResetSignal
706 private void OnNUIApplicationReset(IntPtr data)
708 NUIApplicationResetEventArgs e = new NUIApplicationResetEventArgs();
710 // Populate all members of "e" (NUIApplicationResetEventArgs) with real data
711 e.Application = Application.GetApplicationFromPtr(data);
713 if (_applicationResetEventHandler != null)
715 //here we send all data to user event handlers
716 _applicationResetEventHandler(this, e);
721 * @brief Event for Resized signal which can be used to subscribe/unsubscribe the event handler
722 * (in the type of NUIApplicationResizeEventHandler-DaliEventHandler<object,NUIApplicationResizeEventArgs>)
723 * provided by the user. Resized signal is emitted when application is resized
725 public event DaliEventHandler<object, NUIApplicationResizedEventArgs> Resized
731 // Restricted to only one listener
732 if (_applicationResizeEventHandler == null)
734 _applicationResizeEventHandler += value;
736 _applicationResizeEventCallbackDelegate = new NUIApplicationResizeEventCallbackDelegate(OnNUIApplicationResize);
737 this.ResizeSignal().Connect(_applicationResizeEventCallbackDelegate);
746 if (_applicationResizeEventHandler != null)
748 this.ResizeSignal().Disconnect(_applicationResizeEventCallbackDelegate);
751 _applicationResizeEventHandler -= value;
756 // Callback for Application ResizeSignal
757 private void OnNUIApplicationResize(IntPtr data)
759 NUIApplicationResizedEventArgs e = new NUIApplicationResizedEventArgs();
761 // Populate all members of "e" (NUIApplicationResizeEventArgs) with real data
762 e.Application = Application.GetApplicationFromPtr(data);
764 if (_applicationResizeEventHandler != null)
766 //here we send all data to user event handlers
767 _applicationResizeEventHandler(this, e);
772 * @brief Event for LanguageChanged signal which can be used to subscribe/unsubscribe the event handler
773 * (in the type of NUIApplicationLanguageChangedEventHandler-DaliEventHandler<object,NUIApplicationLanguageChangedEventArgs>)
774 * provided by the user. LanguageChanged signal is emitted when the region of the device is changed.
776 public event DaliEventHandler<object, NUIApplicationLanguageChangedEventArgs> LanguageChanged
782 // Restricted to only one listener
783 if (_applicationLanguageChangedEventHandler == null)
785 _applicationLanguageChangedEventHandler += value;
787 _applicationLanguageChangedEventCallbackDelegate = new NUIApplicationLanguageChangedEventCallbackDelegate(OnNUIApplicationLanguageChanged);
788 this.LanguageChangedSignal().Connect(_applicationLanguageChangedEventCallbackDelegate);
797 if (_applicationLanguageChangedEventHandler != null)
799 this.LanguageChangedSignal().Disconnect(_applicationLanguageChangedEventCallbackDelegate);
802 _applicationLanguageChangedEventHandler -= value;
807 // Callback for Application LanguageChangedSignal
808 private void OnNUIApplicationLanguageChanged(IntPtr data)
810 NUIApplicationLanguageChangedEventArgs e = new NUIApplicationLanguageChangedEventArgs();
812 // Populate all members of "e" (NUIApplicationLanguageChangedEventArgs) with real data
813 e.Application = Application.GetApplicationFromPtr(data);
815 if (_applicationLanguageChangedEventHandler != null)
817 //here we send all data to user event handlers
818 _applicationLanguageChangedEventHandler(this, e);
823 * @brief Event for RegionChanged signal which can be used to subscribe/unsubscribe the event handler
824 * (in the type of NUIApplicationRegionChangedEventHandler-DaliEventHandler<object,NUIApplicationRegionChangedEventArgs>)
825 * provided by the user. RegionChanged signal is emitted when the region of the device is changed.
827 public event DaliEventHandler<object, NUIApplicationRegionChangedEventArgs> RegionChanged
833 // Restricted to only one listener
834 if (_applicationRegionChangedEventHandler == null)
836 _applicationRegionChangedEventHandler += value;
838 _applicationRegionChangedEventCallbackDelegate = new NUIApplicationRegionChangedEventCallbackDelegate(OnNUIApplicationRegionChanged);
839 this.RegionChangedSignal().Connect(_applicationRegionChangedEventCallbackDelegate);
848 if (_applicationRegionChangedEventHandler != null)
850 this.RegionChangedSignal().Disconnect(_applicationRegionChangedEventCallbackDelegate);
853 _applicationRegionChangedEventHandler -= value;
858 // Callback for Application RegionChangedSignal
859 private void OnNUIApplicationRegionChanged(IntPtr data)
861 NUIApplicationRegionChangedEventArgs e = new NUIApplicationRegionChangedEventArgs();
863 // Populate all members of "e" (NUIApplicationRegionChangedEventArgs) with real data
864 e.Application = Application.GetApplicationFromPtr(data);
866 if (_applicationRegionChangedEventHandler != null)
868 //here we send all data to user event handlers
869 _applicationRegionChangedEventHandler(this, e);
874 * @brief Event for BatteryLow signal which can be used to subscribe/unsubscribe the event handler
875 * (in the type of NUIApplicationBatteryLowEventHandler-DaliEventHandler<object,NUIApplicationBatteryLowEventArgs>)
876 * provided by the user. BatteryLow signal is emitted when the battery level of the device is low.
878 public event DaliEventHandler<object, NUIApplicationBatteryLowEventArgs> BatteryLow
884 // Restricted to only one listener
885 if (_applicationBatteryLowEventHandler == null)
887 _applicationBatteryLowEventHandler += value;
889 _applicationBatteryLowEventCallbackDelegate = new NUIApplicationBatteryLowEventCallbackDelegate(OnNUIApplicationBatteryLow);
890 this.BatteryLowSignal().Connect(_applicationBatteryLowEventCallbackDelegate);
899 if (_applicationBatteryLowEventHandler != null)
901 this.BatteryLowSignal().Disconnect(_applicationBatteryLowEventCallbackDelegate);
904 _applicationBatteryLowEventHandler -= value;
909 // Callback for Application BatteryLowSignal
910 private void OnNUIApplicationBatteryLow(IntPtr data)
912 NUIApplicationBatteryLowEventArgs e = new NUIApplicationBatteryLowEventArgs();
914 // Populate all members of "e" (NUIApplicationBatteryLowEventArgs) with real data
915 e.Application = Application.GetApplicationFromPtr(data);
917 if (_applicationBatteryLowEventHandler != null)
919 //here we send all data to user event handlers
920 _applicationBatteryLowEventHandler(this, e);
925 * @brief Event for MemoryLow signal which can be used to subscribe/unsubscribe the event handler
926 * (in the type of NUIApplicationMemoryLowEventHandler-DaliEventHandler<object,NUIApplicationMemoryLowEventArgs>)
927 * provided by the user. MemoryLow signal is emitted when the memory level of the device is low.
929 public event DaliEventHandler<object, NUIApplicationMemoryLowEventArgs> MemoryLow
935 // Restricted to only one listener
936 if (_applicationMemoryLowEventHandler == null)
938 _applicationMemoryLowEventHandler += value;
940 _applicationMemoryLowEventCallbackDelegate = new NUIApplicationMemoryLowEventCallbackDelegate(OnNUIApplicationMemoryLow);
941 this.MemoryLowSignal().Connect(_applicationMemoryLowEventCallbackDelegate);
950 if (_applicationMemoryLowEventHandler != null)
952 this.MemoryLowSignal().Disconnect(_applicationMemoryLowEventCallbackDelegate);
955 _applicationMemoryLowEventHandler -= value;
960 // Callback for Application MemoryLowSignal
961 private void OnNUIApplicationMemoryLow(IntPtr data)
963 NUIApplicationMemoryLowEventArgs e = new NUIApplicationMemoryLowEventArgs();
965 // Populate all members of "e" (NUIApplicationMemoryLowEventArgs) with real data
966 e.Application = Application.GetApplicationFromPtr(data);
968 if (_applicationMemoryLowEventHandler != null)
970 //here we send all data to user event handlers
971 _applicationMemoryLowEventHandler(this, e);
976 * @brief Event for AppControl signal which can be used to subscribe/unsubscribe the event handler
977 * (in the type of NUIApplicationAppControlEventHandler-DaliEventHandler<object,NUIApplicationAppControlEventArgs>)
978 * provided by the user. AppControl signal is emitted when another application sends a launch request to the application.
980 public event DaliEventHandler<object, NUIApplicationAppControlEventArgs> AppControl
986 // Restricted to only one listener
987 if (_applicationAppControlEventHandler == null)
989 _applicationAppControlEventHandler += value;
991 _applicationAppControlEventCallbackDelegate = new NUIApplicationAppControlEventCallbackDelegate(OnNUIApplicationAppControl);
992 this.AppControlSignal().Connect(_applicationAppControlEventCallbackDelegate);
1001 if (_applicationAppControlEventHandler != null)
1003 this.AppControlSignal().Disconnect(_applicationAppControlEventCallbackDelegate);
1006 _applicationAppControlEventHandler -= value;
1011 // Callback for Application AppControlSignal
1012 private void OnNUIApplicationAppControl(IntPtr application, IntPtr voidp)
1014 NUIApplicationAppControlEventArgs e = new NUIApplicationAppControlEventArgs();
1016 // Populate all members of "e" (NUIApplicationAppControlEventArgs) with real data
1017 e.Application = Application.GetApplicationFromPtr(application);
1020 if (_applicationAppControlEventHandler != null)
1022 //here we send all data to user event handlers
1023 _applicationAppControlEventHandler(this, e);
1027 private static Application _instance; // singleton
1029 public delegate void InitDelegate();
1031 public delegate void TerminateDelegate();
1033 public delegate void PauseDelegate();
1035 public delegate void ResumeDelegate();
1037 public delegate void ResizeDelegate();
1039 public delegate void AppControlDelegate();
1041 public delegate void LanguageChangedDelegate();
1043 public delegate void RegionChangedDelegate();
1045 public delegate void BatteryLowDelegate();
1047 public delegate void MemoryLowDelegate();
1049 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1050 internal delegate void InitDelegateInternal();
1052 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1053 internal delegate void TerminateDelegateInternal();
1055 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1056 internal delegate void PauseDelegateInternal();
1058 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1059 internal delegate void ResumeDelegateInternal();
1061 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1062 internal delegate void ResizeDelegateInternal();
1064 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1065 internal delegate void AppControlDelegateInternal();
1067 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1068 internal delegate void LanguageChangedDelegateInternal();
1070 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1071 internal delegate void RegionChangedDelegateInternal();
1073 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1074 internal delegate void BatteryLowDelegateInternal();
1076 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1077 internal delegate void MemoryLowDelegateInternal();
1079 static void Initialization()
1081 // instance.InitDelegate();
1084 public static Application Instance
1092 public static Application GetApplicationFromPtr(global::System.IntPtr cPtr)
1094 Application ret = new Application(cPtr, false);
1095 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1099 internal void SetupDelegates()
1101 InitDelegateInternal initializeCallback = new InitDelegateInternal(Initialization);
1103 NUILog.Debug("InitSignal connection count");
1105 this.InitSignal().Connect(initializeCallback);
1107 NUILog.Debug("InitSignal connection count = " + InitSignal().GetConnectionCount());
1110 public static Application NewApplication()
1112 _instance = NewApplication("", Application.WindowMode.Opaque);
1116 public static Application NewApplication(string stylesheet)
1118 _instance = NewApplication(stylesheet, Application.WindowMode.Opaque);
1122 public static Application NewApplication(string stylesheet, Application.WindowMode windowMode)
1124 // register all Views with the type registry, so that can be created / styled via JSON
1125 //ViewRegistryHelper.Initialize(); //moved to Application side.
1127 Application ret = New(1, stylesheet, windowMode);
1128 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1130 // we've got an application now connect the signals
1131 ret.SetupDelegates();
1132 // set the singleton
1138 public static Application NewApplication(string[] args, string stylesheet, Application.WindowMode windowMode)
1140 NUILog.Debug(" NewApplication(string[] args, string stylesheet, Application.WindowMode windowMode) is called! ");
1142 Application ret = New(args, stylesheet, (Application.WindowMode)windowMode);
1143 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1145 // we've got an application now connect the signals
1146 ret.SetupDelegates();
1147 // set the singleton
1153 /// Ensures that the function passed in is called from the main loop when it is idle.
1155 /// <param name="func">The function to call</param>
1156 /// <returns>true if added successfully, false otherwise</returns>
1157 public bool AddIdle(System.Delegate func)
1159 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(func);
1160 System.IntPtr ip2 = NDalicManualPINVOKE.MakeCallback(new System.Runtime.InteropServices.HandleRef(this, ip));
1162 bool ret = NDalicPINVOKE.Application_AddIdle(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip2));
1164 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1169 * Outer::outer_method(int)
1171 public static Application New()
1173 NUILog.Debug("New() is called!");
1175 Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_0(), true);
1176 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1180 public static Application New(int argc)
1182 NUILog.Debug("New(int argc) is called!");
1184 Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_1(argc), true);
1185 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1189 public static Application New(int argc, string stylesheet)
1191 NUILog.Debug("New(int argc, string stylesheet) is called!");
1193 Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_2(argc, stylesheet), true);
1194 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1198 public static Application New(int argc, string stylesheet, Application.WindowMode windowMode)
1200 NUILog.Debug("New(int argc, string stylesheet, Application.WindowMode windowMode) is called!");
1202 Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_3(argc, stylesheet, (int)windowMode), true);
1203 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1207 public static Application New(string[] args, string stylesheet, Application.WindowMode windowMode)
1209 NUILog.Debug("New(string[] args) is called!");
1210 int argc = args.Length;
1211 string argvStr = string.Join(" ", args);
1213 Application ret = new Application(NDalicPINVOKE.Application_New__MANUAL_4(argc, argvStr, stylesheet, (int)windowMode), true);
1214 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1218 public static Application New(int argc, string stylesheet, Application.WindowMode windowMode, Rectangle positionSize)
1220 Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_4(argc, stylesheet, (int)windowMode, Rectangle.getCPtr(positionSize)), true);
1221 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1225 public Application() : this(NDalicPINVOKE.new_Application__SWIG_0(), true)
1227 NUILog.Debug("Application() is called!");
1229 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1232 public Application(Application application) : this(NDalicPINVOKE.new_Application__SWIG_1(Application.getCPtr(application)), true)
1234 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1237 public Application Assign(Application application)
1239 Application ret = new Application(NDalicPINVOKE.Application_Assign(swigCPtr, Application.getCPtr(application)), false);
1240 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1244 public void MainLoop()
1246 NDalicPINVOKE.Application_MainLoop__SWIG_0(swigCPtr);
1247 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1250 internal void MainLoop(SWIGTYPE_p_Configuration__ContextLoss configuration)
1252 NDalicPINVOKE.Application_MainLoop__SWIG_1(swigCPtr, SWIGTYPE_p_Configuration__ContextLoss.getCPtr(configuration));
1253 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1258 NDalicPINVOKE.Application_Lower(swigCPtr);
1259 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1264 NDalicPINVOKE.Application_Quit(swigCPtr);
1265 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1268 internal bool AddIdle(SWIGTYPE_p_Dali__CallbackBase callback)
1270 bool ret = NDalicPINVOKE.Application_AddIdle(swigCPtr, SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback));
1271 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1275 public Window GetWindow()
1277 Window ret = new Window(NDalicPINVOKE.Application_GetWindow(swigCPtr), true);
1278 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1282 public void ReplaceWindow(Rectangle windowPosition, string name)
1284 NDalicPINVOKE.Application_ReplaceWindow(swigCPtr, Rectangle.getCPtr(windowPosition), name);
1285 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1288 public static string GetResourcePath()
1290 string ret = NDalicPINVOKE.Application_GetResourcePath();
1291 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1295 internal void SetViewMode(ViewMode viewMode)
1297 NDalicPINVOKE.Application_SetViewMode(swigCPtr, (int)viewMode);
1298 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1301 internal ViewMode GetViewMode()
1303 ViewMode ret = (ViewMode)NDalicPINVOKE.Application_GetViewMode(swigCPtr);
1304 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1308 public void SetStereoBase(float stereoBase)
1310 NDalicPINVOKE.Application_SetStereoBase(swigCPtr, stereoBase);
1311 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1314 public float GetStereoBase()
1316 float ret = NDalicPINVOKE.Application_GetStereoBase(swigCPtr);
1317 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1321 internal ApplicationSignal InitSignal()
1323 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_InitSignal(swigCPtr), false);
1324 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1328 internal ApplicationSignal TerminateSignal()
1330 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_TerminateSignal(swigCPtr), false);
1331 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1335 internal ApplicationSignal PauseSignal()
1337 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_PauseSignal(swigCPtr), false);
1338 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1342 internal ApplicationSignal ResumeSignal()
1344 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_ResumeSignal(swigCPtr), false);
1345 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1349 internal ApplicationSignal ResetSignal()
1351 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_ResetSignal(swigCPtr), false);
1352 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1356 internal ApplicationSignal ResizeSignal()
1358 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_ResizeSignal(swigCPtr), false);
1359 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1363 internal ApplicationControlSignal AppControlSignal()
1365 ApplicationControlSignal ret = new ApplicationControlSignal(NDalicPINVOKE.Application_AppControlSignal(swigCPtr), false);
1366 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1370 internal ApplicationSignal LanguageChangedSignal()
1372 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_LanguageChangedSignal(swigCPtr), false);
1373 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1377 internal ApplicationSignal RegionChangedSignal()
1379 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_RegionChangedSignal(swigCPtr), false);
1380 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1384 internal ApplicationSignal BatteryLowSignal()
1386 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_BatteryLowSignal(swigCPtr), false);
1387 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1391 internal ApplicationSignal MemoryLowSignal()
1393 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_MemoryLowSignal(swigCPtr), false);
1394 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1398 public enum WindowMode