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;
23 //This version should be updated and synced for every Dali native release
24 internal static class Version
26 public const int ver1 = 1;
27 public const int ver2 = 2;
28 public const int ver3 = 46;
29 public const int nuiVer1 = 0;
30 public const int nuiVer2 = 2;
31 public const int nuiVer3 = 47;
32 public const string nuiRelease = "";
36 * @brief Event arguments that passed via NUIApplicationInit signal
39 internal class NUIApplicationInitEventArgs : EventArgs
41 private Application _application;
44 * @brief Application - is the application that is being initialized
47 public Application Application
61 * @brief Event arguments that passed via NUIApplicationTerminate signal
64 internal class NUIApplicationTerminatingEventArgs : EventArgs
66 private Application _application;
68 * @brief Application - is the application that is being Terminated
71 public Application Application
85 * @brief Event arguments that passed via NUIApplicationPause signal
88 internal class NUIApplicationPausedEventArgs : EventArgs
90 private Application _application;
92 * @brief Application - is the application that is being Paused
95 public Application Application
103 _application = value;
109 * @brief Event arguments that passed via NUIApplicationResume signal
112 internal class NUIApplicationResumedEventArgs : EventArgs
114 private Application _application;
116 * @brief Application - is the application that is being Resumed
119 public Application Application
127 _application = value;
133 * @brief Event arguments that passed via NUIApplicationReset signal
136 internal class NUIApplicationResetEventArgs : EventArgs
138 private Application _application;
140 * @brief Application - is the application that is being Reset
143 public Application Application
151 _application = value;
157 * @brief Event arguments that passed via NUIApplicationResize signal
160 internal class NUIApplicationResizedEventArgs : EventArgs
162 private Application _application;
164 * @brief Application - is the application that is being Resized
167 public Application Application
175 _application = value;
181 * @brief Event arguments that passed via NUIApplicationLanguageChanged signal
184 internal class NUIApplicationLanguageChangedEventArgs : EventArgs
186 private Application _application;
188 * @brief Application - is the application that is being affected with Device's language change
191 public Application Application
199 _application = value;
205 * @brief Event arguments that passed via NUIApplicationRegionChanged signal
208 internal class NUIApplicationRegionChangedEventArgs : EventArgs
210 private Application _application;
212 * @brief Application - is the application that is being affected with Device's region change
215 public Application Application
223 _application = value;
229 * @brief Event arguments that passed via NUIApplicationBatteryLow signal
232 internal class NUIApplicationBatteryLowEventArgs : EventArgs
234 private Application _application;
236 * @brief Application - is the application that is being affected when the battery level of the device is low
239 public Application Application
247 _application = value;
253 * @brief Event arguments that passed via NUIApplicationMemoryLow signal
256 internal class NUIApplicationMemoryLowEventArgs : EventArgs
258 private Application _application;
260 * @brief Application - is the application that is being affected when the memory level of the device is low
263 public Application Application
271 _application = value;
277 * @brief Event arguments that passed via NUIApplicationAppControl signal
280 internal class NUIApplicationAppControlEventArgs : EventArgs
282 private Application _application;
283 private IntPtr _voidp;
285 * @brief Application - is the application that is receiving the launch request from another application
288 public Application Application
296 _application = value;
300 * @brief VoidP - contains the information about why the application is launched
316 internal class Application : BaseHandle
318 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
320 internal Application(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Application_SWIGUpcast(cPtr), cMemoryOwn)
322 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
325 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Application obj)
327 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
330 protected override void Dispose(DisposeTypes type)
337 if (type == DisposeTypes.Explicit)
340 //Release your own managed resources here.
341 //You should release all of your own disposable objects here.
345 //Release your own unmanaged resources here.
346 //You should not access any managed member here except static instance.
347 //because the execution order of Finalizes is non-deterministic.
349 if (_applicationInitEventCallbackDelegate != null)
351 this.InitSignal().Disconnect(_applicationInitEventCallbackDelegate);
354 if (_applicationTerminateEventCallbackDelegate != null)
356 this.TerminateSignal().Disconnect(_applicationTerminateEventCallbackDelegate);
359 if (_applicationPauseEventCallbackDelegate != null)
361 this.PauseSignal().Disconnect(_applicationPauseEventCallbackDelegate);
364 if (_applicationResumeEventCallbackDelegate != null)
366 this.ResumeSignal().Disconnect(_applicationResumeEventCallbackDelegate);
369 if (_applicationResetEventCallbackDelegate != null)
371 this.ResetSignal().Disconnect(_applicationResetEventCallbackDelegate);
374 if (_applicationResizeEventCallbackDelegate != null)
376 this.ResizeSignal().Disconnect(_applicationResizeEventCallbackDelegate);
379 if (_applicationLanguageChangedEventCallbackDelegate != null)
381 this.LanguageChangedSignal().Disconnect(_applicationLanguageChangedEventCallbackDelegate);
384 if (_applicationRegionChangedEventCallbackDelegate != null)
386 this.RegionChangedSignal().Disconnect(_applicationRegionChangedEventCallbackDelegate);
389 if (_applicationBatteryLowEventCallbackDelegate != null)
391 this.BatteryLowSignal().Disconnect(_applicationBatteryLowEventCallbackDelegate);
394 if (_applicationMemoryLowEventCallbackDelegate != null)
396 this.MemoryLowSignal().Disconnect(_applicationMemoryLowEventCallbackDelegate);
399 if (_applicationAppControlEventCallbackDelegate != null)
401 this.AppControlSignal().Disconnect(_applicationAppControlEventCallbackDelegate);
404 if (swigCPtr.Handle != global::System.IntPtr.Zero)
409 NDalicPINVOKE.delete_Application(swigCPtr);
411 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
417 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
418 private delegate void NUIApplicationInitEventCallbackDelegate(IntPtr application);
419 private DaliEventHandler<object, NUIApplicationInitEventArgs> _applicationInitEventHandler;
420 private NUIApplicationInitEventCallbackDelegate _applicationInitEventCallbackDelegate;
423 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
424 private delegate void NUIApplicationTerminateEventCallbackDelegate(IntPtr application);
425 private DaliEventHandler<object, NUIApplicationTerminatingEventArgs> _applicationTerminateEventHandler;
426 private NUIApplicationTerminateEventCallbackDelegate _applicationTerminateEventCallbackDelegate;
429 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
430 private delegate void NUIApplicationPauseEventCallbackDelegate(IntPtr application);
431 private DaliEventHandler<object, NUIApplicationPausedEventArgs> _applicationPauseEventHandler;
432 private NUIApplicationPauseEventCallbackDelegate _applicationPauseEventCallbackDelegate;
434 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
435 private delegate void NUIApplicationResumeEventCallbackDelegate(IntPtr application);
436 private DaliEventHandler<object, NUIApplicationResumedEventArgs> _applicationResumeEventHandler;
437 private NUIApplicationResumeEventCallbackDelegate _applicationResumeEventCallbackDelegate;
439 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
440 private delegate void NUIApplicationResetEventCallbackDelegate(IntPtr application);
441 private DaliEventHandler<object, NUIApplicationResetEventArgs> _applicationResetEventHandler;
442 private NUIApplicationResetEventCallbackDelegate _applicationResetEventCallbackDelegate;
444 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
445 private delegate void NUIApplicationResizeEventCallbackDelegate(IntPtr application);
446 private DaliEventHandler<object, NUIApplicationResizedEventArgs> _applicationResizeEventHandler;
447 private NUIApplicationResizeEventCallbackDelegate _applicationResizeEventCallbackDelegate;
449 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
450 private delegate void NUIApplicationLanguageChangedEventCallbackDelegate(IntPtr application);
451 private DaliEventHandler<object, NUIApplicationLanguageChangedEventArgs> _applicationLanguageChangedEventHandler;
452 private NUIApplicationLanguageChangedEventCallbackDelegate _applicationLanguageChangedEventCallbackDelegate;
455 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
456 private delegate void NUIApplicationRegionChangedEventCallbackDelegate(IntPtr application);
457 private DaliEventHandler<object, NUIApplicationRegionChangedEventArgs> _applicationRegionChangedEventHandler;
458 private NUIApplicationRegionChangedEventCallbackDelegate _applicationRegionChangedEventCallbackDelegate;
460 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
461 private delegate void NUIApplicationBatteryLowEventCallbackDelegate(IntPtr application);
462 private DaliEventHandler<object, NUIApplicationBatteryLowEventArgs> _applicationBatteryLowEventHandler;
463 private NUIApplicationBatteryLowEventCallbackDelegate _applicationBatteryLowEventCallbackDelegate;
465 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
466 private delegate void NUIApplicationMemoryLowEventCallbackDelegate(IntPtr application);
467 private DaliEventHandler<object, NUIApplicationMemoryLowEventArgs> _applicationMemoryLowEventHandler;
468 private NUIApplicationMemoryLowEventCallbackDelegate _applicationMemoryLowEventCallbackDelegate;
470 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
471 private delegate void NUIApplicationAppControlEventCallbackDelegate(IntPtr application, IntPtr voidp);
472 private DaliEventHandler<object, NUIApplicationAppControlEventArgs> _applicationAppControlEventHandler;
473 private NUIApplicationAppControlEventCallbackDelegate _applicationAppControlEventCallbackDelegate;
476 * @brief Event for Initialized signal which can be used to subscribe/unsubscribe the event handler
477 * (in the type of NUIApplicationInitEventHandler - DaliEventHandler<object,NUIApplicationInitEventArgs>)
478 * provided by the user. Initialized signal is emitted when application is initialised
480 public event DaliEventHandler<object, NUIApplicationInitEventArgs> Initialized
486 // Restricted to only one listener
487 if (_applicationInitEventHandler == null)
489 _applicationInitEventHandler += value;
491 _applicationInitEventCallbackDelegate = new NUIApplicationInitEventCallbackDelegate(OnApplicationInit);
492 this.InitSignal().Connect(_applicationInitEventCallbackDelegate);
501 if (_applicationInitEventHandler != null)
503 this.InitSignal().Disconnect(_applicationInitEventCallbackDelegate);
506 _applicationInitEventHandler -= value;
511 // Callback for Application InitSignal
512 private void OnApplicationInit(IntPtr data)
514 // Initialize DisposeQueue Singleton class. This is also required to create DisposeQueue on main thread.
515 DisposeQueue.Instance.Initialize();
516 NUIApplicationInitEventArgs e = new NUIApplicationInitEventArgs();
518 // Populate all members of "e" (NUIApplicationInitEventArgs) with real data
519 e.Application = Application.GetApplicationFromPtr(data);
521 if (_applicationInitEventHandler != null)
523 //here we send all data to user event handlers
524 _applicationInitEventHandler(this, e);
529 * @brief Event for Terminated signal which can be used to subscribe/unsubscribe the event handler
530 * (in the type of NUIApplicationTerminateEventHandler-DaliEventHandler<object,NUIApplicationTerminateEventArgs>)
531 * provided by the user. Terminated signal is emitted when application is terminating
533 public event DaliEventHandler<object, NUIApplicationTerminatingEventArgs> Terminating
539 // Restricted to only one listener
540 if (_applicationTerminateEventHandler == null)
542 _applicationTerminateEventHandler += value;
544 _applicationTerminateEventCallbackDelegate = new NUIApplicationTerminateEventCallbackDelegate(OnNUIApplicationTerminate);
545 this.TerminateSignal().Connect(_applicationTerminateEventCallbackDelegate);
554 if (_applicationTerminateEventHandler != null)
556 this.TerminateSignal().Disconnect(_applicationTerminateEventCallbackDelegate);
559 _applicationTerminateEventHandler -= value;
564 // Callback for Application TerminateSignal
565 private void OnNUIApplicationTerminate(IntPtr data)
567 NUIApplicationTerminatingEventArgs e = new NUIApplicationTerminatingEventArgs();
569 // Populate all members of "e" (NUIApplicationTerminateEventArgs) with real data
570 e.Application = Application.GetApplicationFromPtr(data);
572 if (_applicationTerminateEventHandler != null)
574 //here we send all data to user event handlers
575 _applicationTerminateEventHandler(this, e);
580 * @brief Event for Paused signal which can be used to subscribe/unsubscribe the event handler
581 * (in the type of NUIApplicationPauseEventHandler-DaliEventHandler<object,NUIApplicationPauseEventArgs>)
582 * provided by the user. Paused signal is emitted when application is paused
584 public event DaliEventHandler<object, NUIApplicationPausedEventArgs> Paused
590 // Restricted to only one listener
591 if (_applicationPauseEventHandler == null)
593 _applicationPauseEventHandler += value;
595 _applicationPauseEventCallbackDelegate = new NUIApplicationPauseEventCallbackDelegate(OnNUIApplicationPause);
596 this.PauseSignal().Connect(_applicationPauseEventCallbackDelegate);
605 if (_applicationPauseEventHandler != null)
607 this.PauseSignal().Disconnect(_applicationPauseEventCallbackDelegate);
610 _applicationPauseEventHandler -= value;
615 // Callback for Application PauseSignal
616 private void OnNUIApplicationPause(IntPtr data)
618 NUIApplicationPausedEventArgs e = new NUIApplicationPausedEventArgs();
620 // Populate all members of "e" (NUIApplicationPauseEventArgs) with real data
621 e.Application = Application.GetApplicationFromPtr(data);
623 if (_applicationPauseEventHandler != null)
625 //here we send all data to user event handlers
626 _applicationPauseEventHandler(this, e);
631 * @brief Event for Resumed signal which can be used to subscribe/unsubscribe the event handler
632 * (in the type of NUIApplicationResumeEventHandler-DaliEventHandler<object,NUIApplicationResumeEventArgs>)
633 * provided by the user. Resumed signal is emitted when application is resumed
635 public event DaliEventHandler<object, NUIApplicationResumedEventArgs> Resumed
641 // Restricted to only one listener
642 if (_applicationResumeEventHandler == null)
644 _applicationResumeEventHandler += value;
646 _applicationResumeEventCallbackDelegate = new NUIApplicationResumeEventCallbackDelegate(OnNUIApplicationResume);
647 this.ResumeSignal().Connect(_applicationResumeEventCallbackDelegate);
656 if (_applicationResumeEventHandler != null)
658 this.ResumeSignal().Disconnect(_applicationResumeEventCallbackDelegate);
661 _applicationResumeEventHandler -= value;
666 // Callback for Application ResumeSignal
667 private void OnNUIApplicationResume(IntPtr data)
669 NUIApplicationResumedEventArgs e = new NUIApplicationResumedEventArgs();
671 // Populate all members of "e" (NUIApplicationResumeEventArgs) with real data
672 e.Application = Application.GetApplicationFromPtr(data);
674 if (_applicationResumeEventHandler != null)
676 //here we send all data to user event handlers
677 _applicationResumeEventHandler(this, e);
682 * @brief Event for Reset signal which can be used to subscribe/unsubscribe the event handler
683 * (in the type of NUIApplicationResetEventHandler-DaliEventHandler<object,NUIApplicationResetEventArgs>)
684 * provided by the user. Reset signal is emitted when application is reset
686 public event DaliEventHandler<object, NUIApplicationResetEventArgs> Reset
692 // Restricted to only one listener
693 if (_applicationResetEventHandler == null)
695 _applicationResetEventHandler += value;
697 _applicationResetEventCallbackDelegate = new NUIApplicationResetEventCallbackDelegate(OnNUIApplicationReset);
698 this.ResetSignal().Connect(_applicationResetEventCallbackDelegate);
707 if (_applicationResetEventHandler != null)
709 this.ResetSignal().Disconnect(_applicationResetEventCallbackDelegate);
712 _applicationResetEventHandler -= value;
717 // Callback for Application ResetSignal
718 private void OnNUIApplicationReset(IntPtr data)
720 NUIApplicationResetEventArgs e = new NUIApplicationResetEventArgs();
722 // Populate all members of "e" (NUIApplicationResetEventArgs) with real data
723 e.Application = Application.GetApplicationFromPtr(data);
725 if (_applicationResetEventHandler != null)
727 //here we send all data to user event handlers
728 _applicationResetEventHandler(this, e);
733 * @brief Event for Resized signal which can be used to subscribe/unsubscribe the event handler
734 * (in the type of NUIApplicationResizeEventHandler-DaliEventHandler<object,NUIApplicationResizeEventArgs>)
735 * provided by the user. Resized signal is emitted when application is resized
737 public event DaliEventHandler<object, NUIApplicationResizedEventArgs> Resized
743 // Restricted to only one listener
744 if (_applicationResizeEventHandler == null)
746 _applicationResizeEventHandler += value;
748 _applicationResizeEventCallbackDelegate = new NUIApplicationResizeEventCallbackDelegate(OnNUIApplicationResize);
749 this.ResizeSignal().Connect(_applicationResizeEventCallbackDelegate);
758 if (_applicationResizeEventHandler != null)
760 this.ResizeSignal().Disconnect(_applicationResizeEventCallbackDelegate);
763 _applicationResizeEventHandler -= value;
768 // Callback for Application ResizeSignal
769 private void OnNUIApplicationResize(IntPtr data)
771 NUIApplicationResizedEventArgs e = new NUIApplicationResizedEventArgs();
773 // Populate all members of "e" (NUIApplicationResizeEventArgs) with real data
774 e.Application = Application.GetApplicationFromPtr(data);
776 if (_applicationResizeEventHandler != null)
778 //here we send all data to user event handlers
779 _applicationResizeEventHandler(this, e);
784 * @brief Event for LanguageChanged signal which can be used to subscribe/unsubscribe the event handler
785 * (in the type of NUIApplicationLanguageChangedEventHandler-DaliEventHandler<object,NUIApplicationLanguageChangedEventArgs>)
786 * provided by the user. LanguageChanged signal is emitted when the region of the device is changed.
788 public event DaliEventHandler<object, NUIApplicationLanguageChangedEventArgs> LanguageChanged
794 // Restricted to only one listener
795 if (_applicationLanguageChangedEventHandler == null)
797 _applicationLanguageChangedEventHandler += value;
799 _applicationLanguageChangedEventCallbackDelegate = new NUIApplicationLanguageChangedEventCallbackDelegate(OnNUIApplicationLanguageChanged);
800 this.LanguageChangedSignal().Connect(_applicationLanguageChangedEventCallbackDelegate);
809 if (_applicationLanguageChangedEventHandler != null)
811 this.LanguageChangedSignal().Disconnect(_applicationLanguageChangedEventCallbackDelegate);
814 _applicationLanguageChangedEventHandler -= value;
819 // Callback for Application LanguageChangedSignal
820 private void OnNUIApplicationLanguageChanged(IntPtr data)
822 NUIApplicationLanguageChangedEventArgs e = new NUIApplicationLanguageChangedEventArgs();
824 // Populate all members of "e" (NUIApplicationLanguageChangedEventArgs) with real data
825 e.Application = Application.GetApplicationFromPtr(data);
827 if (_applicationLanguageChangedEventHandler != null)
829 //here we send all data to user event handlers
830 _applicationLanguageChangedEventHandler(this, e);
835 * @brief Event for RegionChanged signal which can be used to subscribe/unsubscribe the event handler
836 * (in the type of NUIApplicationRegionChangedEventHandler-DaliEventHandler<object,NUIApplicationRegionChangedEventArgs>)
837 * provided by the user. RegionChanged signal is emitted when the region of the device is changed.
839 public event DaliEventHandler<object, NUIApplicationRegionChangedEventArgs> RegionChanged
845 // Restricted to only one listener
846 if (_applicationRegionChangedEventHandler == null)
848 _applicationRegionChangedEventHandler += value;
850 _applicationRegionChangedEventCallbackDelegate = new NUIApplicationRegionChangedEventCallbackDelegate(OnNUIApplicationRegionChanged);
851 this.RegionChangedSignal().Connect(_applicationRegionChangedEventCallbackDelegate);
860 if (_applicationRegionChangedEventHandler != null)
862 this.RegionChangedSignal().Disconnect(_applicationRegionChangedEventCallbackDelegate);
865 _applicationRegionChangedEventHandler -= value;
870 // Callback for Application RegionChangedSignal
871 private void OnNUIApplicationRegionChanged(IntPtr data)
873 NUIApplicationRegionChangedEventArgs e = new NUIApplicationRegionChangedEventArgs();
875 // Populate all members of "e" (NUIApplicationRegionChangedEventArgs) with real data
876 e.Application = Application.GetApplicationFromPtr(data);
878 if (_applicationRegionChangedEventHandler != null)
880 //here we send all data to user event handlers
881 _applicationRegionChangedEventHandler(this, e);
886 * @brief Event for BatteryLow signal which can be used to subscribe/unsubscribe the event handler
887 * (in the type of NUIApplicationBatteryLowEventHandler-DaliEventHandler<object,NUIApplicationBatteryLowEventArgs>)
888 * provided by the user. BatteryLow signal is emitted when the battery level of the device is low.
890 public event DaliEventHandler<object, NUIApplicationBatteryLowEventArgs> BatteryLow
896 // Restricted to only one listener
897 if (_applicationBatteryLowEventHandler == null)
899 _applicationBatteryLowEventHandler += value;
901 _applicationBatteryLowEventCallbackDelegate = new NUIApplicationBatteryLowEventCallbackDelegate(OnNUIApplicationBatteryLow);
902 this.BatteryLowSignal().Connect(_applicationBatteryLowEventCallbackDelegate);
911 if (_applicationBatteryLowEventHandler != null)
913 this.BatteryLowSignal().Disconnect(_applicationBatteryLowEventCallbackDelegate);
916 _applicationBatteryLowEventHandler -= value;
921 // Callback for Application BatteryLowSignal
922 private void OnNUIApplicationBatteryLow(IntPtr data)
924 NUIApplicationBatteryLowEventArgs e = new NUIApplicationBatteryLowEventArgs();
926 // Populate all members of "e" (NUIApplicationBatteryLowEventArgs) with real data
927 e.Application = Application.GetApplicationFromPtr(data);
929 if (_applicationBatteryLowEventHandler != null)
931 //here we send all data to user event handlers
932 _applicationBatteryLowEventHandler(this, e);
937 * @brief Event for MemoryLow signal which can be used to subscribe/unsubscribe the event handler
938 * (in the type of NUIApplicationMemoryLowEventHandler-DaliEventHandler<object,NUIApplicationMemoryLowEventArgs>)
939 * provided by the user. MemoryLow signal is emitted when the memory level of the device is low.
941 public event DaliEventHandler<object, NUIApplicationMemoryLowEventArgs> MemoryLow
947 // Restricted to only one listener
948 if (_applicationMemoryLowEventHandler == null)
950 _applicationMemoryLowEventHandler += value;
952 _applicationMemoryLowEventCallbackDelegate = new NUIApplicationMemoryLowEventCallbackDelegate(OnNUIApplicationMemoryLow);
953 this.MemoryLowSignal().Connect(_applicationMemoryLowEventCallbackDelegate);
962 if (_applicationMemoryLowEventHandler != null)
964 this.MemoryLowSignal().Disconnect(_applicationMemoryLowEventCallbackDelegate);
967 _applicationMemoryLowEventHandler -= value;
972 // Callback for Application MemoryLowSignal
973 private void OnNUIApplicationMemoryLow(IntPtr data)
975 NUIApplicationMemoryLowEventArgs e = new NUIApplicationMemoryLowEventArgs();
977 // Populate all members of "e" (NUIApplicationMemoryLowEventArgs) with real data
978 e.Application = Application.GetApplicationFromPtr(data);
980 if (_applicationMemoryLowEventHandler != null)
982 //here we send all data to user event handlers
983 _applicationMemoryLowEventHandler(this, e);
988 * @brief Event for AppControl signal which can be used to subscribe/unsubscribe the event handler
989 * (in the type of NUIApplicationAppControlEventHandler-DaliEventHandler<object,NUIApplicationAppControlEventArgs>)
990 * provided by the user. AppControl signal is emitted when another application sends a launch request to the application.
992 public event DaliEventHandler<object, NUIApplicationAppControlEventArgs> AppControl
998 // Restricted to only one listener
999 if (_applicationAppControlEventHandler == null)
1001 _applicationAppControlEventHandler += value;
1003 _applicationAppControlEventCallbackDelegate = new NUIApplicationAppControlEventCallbackDelegate(OnNUIApplicationAppControl);
1004 this.AppControlSignal().Connect(_applicationAppControlEventCallbackDelegate);
1013 if (_applicationAppControlEventHandler != null)
1015 this.AppControlSignal().Disconnect(_applicationAppControlEventCallbackDelegate);
1018 _applicationAppControlEventHandler -= value;
1023 // Callback for Application AppControlSignal
1024 private void OnNUIApplicationAppControl(IntPtr application, IntPtr voidp)
1026 NUIApplicationAppControlEventArgs e = new NUIApplicationAppControlEventArgs();
1028 // Populate all members of "e" (NUIApplicationAppControlEventArgs) with real data
1029 e.Application = Application.GetApplicationFromPtr(application);
1032 if (_applicationAppControlEventHandler != null)
1034 //here we send all data to user event handlers
1035 _applicationAppControlEventHandler(this, e);
1039 private static Application _instance; // singleton
1041 public delegate void InitDelegate();
1043 public delegate void TerminateDelegate();
1045 public delegate void PauseDelegate();
1047 public delegate void ResumeDelegate();
1049 public delegate void ResizeDelegate();
1051 public delegate void AppControlDelegate();
1053 public delegate void LanguageChangedDelegate();
1055 public delegate void RegionChangedDelegate();
1057 public delegate void BatteryLowDelegate();
1059 public delegate void MemoryLowDelegate();
1061 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1062 internal delegate void InitDelegateInternal();
1064 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1065 internal delegate void TerminateDelegateInternal();
1067 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1068 internal delegate void PauseDelegateInternal();
1070 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1071 internal delegate void ResumeDelegateInternal();
1073 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1074 internal delegate void ResizeDelegateInternal();
1076 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1077 internal delegate void AppControlDelegateInternal();
1079 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1080 internal delegate void LanguageChangedDelegateInternal();
1082 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1083 internal delegate void RegionChangedDelegateInternal();
1085 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1086 internal delegate void BatteryLowDelegateInternal();
1088 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1089 internal delegate void MemoryLowDelegateInternal();
1091 static void Initialization()
1093 // instance.InitDelegate();
1096 public static Application Instance
1104 public static Application GetApplicationFromPtr(global::System.IntPtr cPtr)
1106 Application ret = new Application(cPtr, false);
1107 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1111 internal void SetupDelegates()
1113 InitDelegateInternal initializeCallback = new InitDelegateInternal(Initialization);
1115 NUILog.Debug("InitSignal connection count");
1117 this.InitSignal().Connect(initializeCallback);
1119 NUILog.Debug("InitSignal connection count = " + InitSignal().GetConnectionCount());
1122 public static Application NewApplication()
1124 _instance = NewApplication("", Application.WindowMode.Opaque);
1128 public static Application NewApplication(string stylesheet)
1130 _instance = NewApplication(stylesheet, Application.WindowMode.Opaque);
1134 public static Application NewApplication(string stylesheet, Application.WindowMode windowMode)
1143 if (NDalicManualPINVOKE.NativeVersionCheck(ref ver1, ref ver2, ref ver3))
1145 if (ver1 != Version.ver1 || ver2 != Version.ver2 || ver3 != Version.ver3)
1147 //throw new System.InvalidOperationException("Dali native version mismatch error! nui=" + Version.ver1 + "." + Version.ver2 + "." + Version.ver3 + " but dali=" + ver1 + "." + ver2 + "." + ver3);
1148 NUILog.Error("Dali native version mismatch error! nui=" + Version.nuiVer1 + "." + Version.nuiVer2 + "." + Version.nuiVer3 + Version.nuiRelease + " but native dali=" + ver1 + "." + ver2 + "." + ver3);
1153 //throw new System.InvalidOperationException("Dali native version mismatch error! nui=" + Version.ver1 + "." + Version.ver2 + "." + Version.ver3 + " but dali=" + ver1 + "." + ver2 + "." + ver3);
1154 NUILog.Error("Dali native version mismatch error! nui=" + Version.nuiVer1 + "." + Version.nuiVer2 + "." + Version.nuiVer3 + Version.nuiRelease + " but native dali=" + ver1 + "." + ver2 + "." + ver3);
1157 catch (Exception exc)
1159 //throw new System.InvalidOperationException("Dali native version is very old! nui=" + Version.ver1 + "." + Version.ver2 + "." + Version.ver3);
1160 NUILog.Error("Dali native version is very old! nui=" + Version.nuiVer1 + "." + Version.nuiVer2 + "." + Version.nuiVer3 + Version.nuiRelease);
1161 NUILog.Error("exception occured! =" + exc.Message);
1163 NUILog.Debug(" Dali native version=" + ver1 + "." + ver2 + "." + ver3 + " NUI version=" + Version.nuiVer1 + "." + Version.nuiVer2 + "." + Version.nuiVer3 + Version.nuiRelease);
1165 NUILog.Debug(" NewApplication(string stylesheet, Application.WindowMode windowMode) is called! ");
1167 // register all Views with the type registry, so that can be created / styled via JSON
1168 //ViewRegistryHelper.Initialize(); //moved to Application side.
1170 Application ret = New(1, stylesheet, windowMode);
1171 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1173 // we've got an application now connect the signals
1174 ret.SetupDelegates();
1175 // set the singleton
1180 //Removed from v0.2.33
1181 /*public bool AddIdle(System.Delegate func)
1183 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
1184 System.IntPtr ip2 = NDalicManualPINVOKE.MakeCallback(new System.Runtime.InteropServices.HandleRef(this, ip));
1186 bool ret = NDalicPINVOKE.Application_AddIdle(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip2));
1188 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1195 * Outer::outer_method(int)
1197 public static Application New()
1199 NUILog.Debug("New() is called!");
1201 Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_0(), true);
1202 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1206 public static Application New(int argc)
1208 NUILog.Debug("New(int argc) is called!");
1210 Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_1(argc), true);
1211 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1215 public static Application New(int argc, string stylesheet)
1217 NUILog.Debug("New(int argc, string stylesheet) is called!");
1219 Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_2(argc, stylesheet), true);
1220 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1224 public static Application New(int argc, string stylesheet, Application.WindowMode windowMode)
1226 NUILog.Debug("New(int argc, string stylesheet, Application.WindowMode windowMode) is called!");
1228 Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_3(argc, stylesheet, (int)windowMode), true);
1229 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1233 public static Application New(int argc, string stylesheet, Application.WindowMode windowMode, Rectangle positionSize)
1235 Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_4(argc, stylesheet, (int)windowMode, Rectangle.getCPtr(positionSize)), true);
1236 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1240 public Application() : this(NDalicPINVOKE.new_Application__SWIG_0(), true)
1242 NUILog.Debug("Application() is called!");
1244 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1247 public Application(Application application) : this(NDalicPINVOKE.new_Application__SWIG_1(Application.getCPtr(application)), true)
1249 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1252 public Application Assign(Application application)
1254 Application ret = new Application(NDalicPINVOKE.Application_Assign(swigCPtr, Application.getCPtr(application)), false);
1255 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1259 public void MainLoop()
1261 NDalicPINVOKE.Application_MainLoop__SWIG_0(swigCPtr);
1262 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1265 internal void MainLoop(SWIGTYPE_p_Configuration__ContextLoss configuration)
1267 NDalicPINVOKE.Application_MainLoop__SWIG_1(swigCPtr, SWIGTYPE_p_Configuration__ContextLoss.getCPtr(configuration));
1268 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1273 NDalicPINVOKE.Application_Lower(swigCPtr);
1274 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1279 NDalicPINVOKE.Application_Quit(swigCPtr);
1280 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1283 internal bool AddIdle(SWIGTYPE_p_Dali__CallbackBase callback)
1285 bool ret = NDalicPINVOKE.Application_AddIdle(swigCPtr, SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback));
1286 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1290 public Window GetWindow()
1292 Window ret = new Window(NDalicPINVOKE.Application_GetWindow(swigCPtr), true);
1293 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1297 public void ReplaceWindow(Rectangle windowPosition, string name)
1299 NDalicPINVOKE.Application_ReplaceWindow(swigCPtr, Rectangle.getCPtr(windowPosition), name);
1300 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1303 public static string GetResourcePath()
1305 string ret = NDalicPINVOKE.Application_GetResourcePath();
1306 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1310 internal void SetViewMode(ViewMode viewMode)
1312 NDalicPINVOKE.Application_SetViewMode(swigCPtr, (int)viewMode);
1313 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1316 internal ViewMode GetViewMode()
1318 ViewMode ret = (ViewMode)NDalicPINVOKE.Application_GetViewMode(swigCPtr);
1319 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1323 public void SetStereoBase(float stereoBase)
1325 NDalicPINVOKE.Application_SetStereoBase(swigCPtr, stereoBase);
1326 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1329 public float GetStereoBase()
1331 float ret = NDalicPINVOKE.Application_GetStereoBase(swigCPtr);
1332 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1336 internal ApplicationSignal InitSignal()
1338 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_InitSignal(swigCPtr), false);
1339 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1343 internal ApplicationSignal TerminateSignal()
1345 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_TerminateSignal(swigCPtr), false);
1346 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1350 internal ApplicationSignal PauseSignal()
1352 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_PauseSignal(swigCPtr), false);
1353 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1357 internal ApplicationSignal ResumeSignal()
1359 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_ResumeSignal(swigCPtr), false);
1360 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1364 internal ApplicationSignal ResetSignal()
1366 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_ResetSignal(swigCPtr), false);
1367 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1371 internal ApplicationSignal ResizeSignal()
1373 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_ResizeSignal(swigCPtr), false);
1374 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1378 internal ApplicationControlSignal AppControlSignal()
1380 ApplicationControlSignal ret = new ApplicationControlSignal(NDalicPINVOKE.Application_AppControlSignal(swigCPtr), false);
1381 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1385 internal ApplicationSignal LanguageChangedSignal()
1387 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_LanguageChangedSignal(swigCPtr), false);
1388 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1392 internal ApplicationSignal RegionChangedSignal()
1394 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_RegionChangedSignal(swigCPtr), false);
1395 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1399 internal ApplicationSignal BatteryLowSignal()
1401 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_BatteryLowSignal(swigCPtr), false);
1402 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1406 internal ApplicationSignal MemoryLowSignal()
1408 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_MemoryLowSignal(swigCPtr), false);
1409 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1413 public enum WindowMode