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 = 39;
29 public const int nuiVer1 = 0;
30 public const int nuiVer2 = 2;
31 public const int nuiVer3 = 39;
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 (swigCPtr.Handle != global::System.IntPtr.Zero)
355 //Unreference this instance from Registry.
356 Registry.Unregister(this);
358 NDalicPINVOKE.delete_Application(swigCPtr);
360 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
366 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
367 private delegate void NUIApplicationInitEventCallbackDelegate(IntPtr application);
368 private DaliEventHandler<object, NUIApplicationInitEventArgs> _applicationInitEventHandler;
369 private NUIApplicationInitEventCallbackDelegate _applicationInitEventCallbackDelegate;
372 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
373 private delegate void NUIApplicationTerminateEventCallbackDelegate(IntPtr application);
374 private DaliEventHandler<object, NUIApplicationTerminatingEventArgs> _applicationTerminateEventHandler;
375 private NUIApplicationTerminateEventCallbackDelegate _applicationTerminateEventCallbackDelegate;
378 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
379 private delegate void NUIApplicationPauseEventCallbackDelegate(IntPtr application);
380 private DaliEventHandler<object, NUIApplicationPausedEventArgs> _applicationPauseEventHandler;
381 private NUIApplicationPauseEventCallbackDelegate _applicationPauseEventCallbackDelegate;
383 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
384 private delegate void NUIApplicationResumeEventCallbackDelegate(IntPtr application);
385 private DaliEventHandler<object, NUIApplicationResumedEventArgs> _applicationResumeEventHandler;
386 private NUIApplicationResumeEventCallbackDelegate _applicationResumeEventCallbackDelegate;
388 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
389 private delegate void NUIApplicationResetEventCallbackDelegate(IntPtr application);
390 private DaliEventHandler<object, NUIApplicationResetEventArgs> _applicationResetEventHandler;
391 private NUIApplicationResetEventCallbackDelegate _applicationResetEventCallbackDelegate;
393 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
394 private delegate void NUIApplicationResizeEventCallbackDelegate(IntPtr application);
395 private DaliEventHandler<object, NUIApplicationResizedEventArgs> _applicationResizeEventHandler;
396 private NUIApplicationResizeEventCallbackDelegate _applicationResizeEventCallbackDelegate;
398 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
399 private delegate void NUIApplicationLanguageChangedEventCallbackDelegate(IntPtr application);
400 private DaliEventHandler<object, NUIApplicationLanguageChangedEventArgs> _applicationLanguageChangedEventHandler;
401 private NUIApplicationLanguageChangedEventCallbackDelegate _applicationLanguageChangedEventCallbackDelegate;
404 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
405 private delegate void NUIApplicationRegionChangedEventCallbackDelegate(IntPtr application);
406 private DaliEventHandler<object, NUIApplicationRegionChangedEventArgs> _applicationRegionChangedEventHandler;
407 private NUIApplicationRegionChangedEventCallbackDelegate _applicationRegionChangedEventCallbackDelegate;
409 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
410 private delegate void NUIApplicationBatteryLowEventCallbackDelegate(IntPtr application);
411 private DaliEventHandler<object, NUIApplicationBatteryLowEventArgs> _applicationBatteryLowEventHandler;
412 private NUIApplicationBatteryLowEventCallbackDelegate _applicationBatteryLowEventCallbackDelegate;
414 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
415 private delegate void NUIApplicationMemoryLowEventCallbackDelegate(IntPtr application);
416 private DaliEventHandler<object, NUIApplicationMemoryLowEventArgs> _applicationMemoryLowEventHandler;
417 private NUIApplicationMemoryLowEventCallbackDelegate _applicationMemoryLowEventCallbackDelegate;
419 [UnmanagedFunctionPointer(CallingConvention.StdCall)]
420 private delegate void NUIApplicationAppControlEventCallbackDelegate(IntPtr application, IntPtr voidp);
421 private DaliEventHandler<object, NUIApplicationAppControlEventArgs> _applicationAppControlEventHandler;
422 private NUIApplicationAppControlEventCallbackDelegate _applicationAppControlEventCallbackDelegate;
425 * @brief Event for Initialized signal which can be used to subscribe/unsubscribe the event handler
426 * (in the type of NUIApplicationInitEventHandler - DaliEventHandler<object,NUIApplicationInitEventArgs>)
427 * provided by the user. Initialized signal is emitted when application is initialised
429 public event DaliEventHandler<object, NUIApplicationInitEventArgs> Initialized
435 // Restricted to only one listener
436 if (_applicationInitEventHandler == null)
438 _applicationInitEventHandler += value;
440 _applicationInitEventCallbackDelegate = new NUIApplicationInitEventCallbackDelegate(OnApplicationInit);
441 this.InitSignal().Connect(_applicationInitEventCallbackDelegate);
450 if (_applicationInitEventHandler != null)
452 this.InitSignal().Disconnect(_applicationInitEventCallbackDelegate);
455 _applicationInitEventHandler -= value;
460 // Callback for Application InitSignal
461 private void OnApplicationInit(IntPtr data)
463 // Initialize DisposeQueue Singleton class. This is also required to create DisposeQueue on main thread.
464 DisposeQueue.Instance.Initialize();
465 NUIApplicationInitEventArgs e = new NUIApplicationInitEventArgs();
467 // Populate all members of "e" (NUIApplicationInitEventArgs) with real data
468 e.Application = Application.GetApplicationFromPtr(data);
470 if (_applicationInitEventHandler != null)
472 //here we send all data to user event handlers
473 _applicationInitEventHandler(this, e);
478 * @brief Event for Terminated signal which can be used to subscribe/unsubscribe the event handler
479 * (in the type of NUIApplicationTerminateEventHandler-DaliEventHandler<object,NUIApplicationTerminateEventArgs>)
480 * provided by the user. Terminated signal is emitted when application is terminating
482 public event DaliEventHandler<object, NUIApplicationTerminatingEventArgs> Terminating
488 // Restricted to only one listener
489 if (_applicationTerminateEventHandler == null)
491 _applicationTerminateEventHandler += value;
493 _applicationTerminateEventCallbackDelegate = new NUIApplicationTerminateEventCallbackDelegate(OnNUIApplicationTerminate);
494 this.TerminateSignal().Connect(_applicationTerminateEventCallbackDelegate);
503 if (_applicationTerminateEventHandler != null)
505 this.TerminateSignal().Disconnect(_applicationTerminateEventCallbackDelegate);
508 _applicationTerminateEventHandler -= value;
513 // Callback for Application TerminateSignal
514 private void OnNUIApplicationTerminate(IntPtr data)
516 NUIApplicationTerminatingEventArgs e = new NUIApplicationTerminatingEventArgs();
518 // Populate all members of "e" (NUIApplicationTerminateEventArgs) with real data
519 e.Application = Application.GetApplicationFromPtr(data);
521 if (_applicationTerminateEventHandler != null)
523 //here we send all data to user event handlers
524 _applicationTerminateEventHandler(this, e);
529 * @brief Event for Paused signal which can be used to subscribe/unsubscribe the event handler
530 * (in the type of NUIApplicationPauseEventHandler-DaliEventHandler<object,NUIApplicationPauseEventArgs>)
531 * provided by the user. Paused signal is emitted when application is paused
533 public event DaliEventHandler<object, NUIApplicationPausedEventArgs> Paused
539 // Restricted to only one listener
540 if (_applicationPauseEventHandler == null)
542 _applicationPauseEventHandler += value;
544 _applicationPauseEventCallbackDelegate = new NUIApplicationPauseEventCallbackDelegate(OnNUIApplicationPause);
545 this.PauseSignal().Connect(_applicationPauseEventCallbackDelegate);
554 if (_applicationPauseEventHandler != null)
556 this.PauseSignal().Disconnect(_applicationPauseEventCallbackDelegate);
559 _applicationPauseEventHandler -= value;
564 // Callback for Application PauseSignal
565 private void OnNUIApplicationPause(IntPtr data)
567 NUIApplicationPausedEventArgs e = new NUIApplicationPausedEventArgs();
569 // Populate all members of "e" (NUIApplicationPauseEventArgs) with real data
570 e.Application = Application.GetApplicationFromPtr(data);
572 if (_applicationPauseEventHandler != null)
574 //here we send all data to user event handlers
575 _applicationPauseEventHandler(this, e);
580 * @brief Event for Resumed signal which can be used to subscribe/unsubscribe the event handler
581 * (in the type of NUIApplicationResumeEventHandler-DaliEventHandler<object,NUIApplicationResumeEventArgs>)
582 * provided by the user. Resumed signal is emitted when application is resumed
584 public event DaliEventHandler<object, NUIApplicationResumedEventArgs> Resumed
590 // Restricted to only one listener
591 if (_applicationResumeEventHandler == null)
593 _applicationResumeEventHandler += value;
595 _applicationResumeEventCallbackDelegate = new NUIApplicationResumeEventCallbackDelegate(OnNUIApplicationResume);
596 this.ResumeSignal().Connect(_applicationResumeEventCallbackDelegate);
605 if (_applicationResumeEventHandler != null)
607 this.ResumeSignal().Disconnect(_applicationResumeEventCallbackDelegate);
610 _applicationResumeEventHandler -= value;
615 // Callback for Application ResumeSignal
616 private void OnNUIApplicationResume(IntPtr data)
618 NUIApplicationResumedEventArgs e = new NUIApplicationResumedEventArgs();
620 // Populate all members of "e" (NUIApplicationResumeEventArgs) with real data
621 e.Application = Application.GetApplicationFromPtr(data);
623 if (_applicationResumeEventHandler != null)
625 //here we send all data to user event handlers
626 _applicationResumeEventHandler(this, e);
631 * @brief Event for Reset signal which can be used to subscribe/unsubscribe the event handler
632 * (in the type of NUIApplicationResetEventHandler-DaliEventHandler<object,NUIApplicationResetEventArgs>)
633 * provided by the user. Reset signal is emitted when application is reset
635 public event DaliEventHandler<object, NUIApplicationResetEventArgs> Reset
641 // Restricted to only one listener
642 if (_applicationResetEventHandler == null)
644 _applicationResetEventHandler += value;
646 _applicationResetEventCallbackDelegate = new NUIApplicationResetEventCallbackDelegate(OnNUIApplicationReset);
647 this.ResetSignal().Connect(_applicationResetEventCallbackDelegate);
656 if (_applicationResetEventHandler != null)
658 this.ResetSignal().Disconnect(_applicationResetEventCallbackDelegate);
661 _applicationResetEventHandler -= value;
666 // Callback for Application ResetSignal
667 private void OnNUIApplicationReset(IntPtr data)
669 NUIApplicationResetEventArgs e = new NUIApplicationResetEventArgs();
671 // Populate all members of "e" (NUIApplicationResetEventArgs) with real data
672 e.Application = Application.GetApplicationFromPtr(data);
674 if (_applicationResetEventHandler != null)
676 //here we send all data to user event handlers
677 _applicationResetEventHandler(this, e);
682 * @brief Event for Resized signal which can be used to subscribe/unsubscribe the event handler
683 * (in the type of NUIApplicationResizeEventHandler-DaliEventHandler<object,NUIApplicationResizeEventArgs>)
684 * provided by the user. Resized signal is emitted when application is resized
686 public event DaliEventHandler<object, NUIApplicationResizedEventArgs> Resized
692 // Restricted to only one listener
693 if (_applicationResizeEventHandler == null)
695 _applicationResizeEventHandler += value;
697 _applicationResizeEventCallbackDelegate = new NUIApplicationResizeEventCallbackDelegate(OnNUIApplicationResize);
698 this.ResizeSignal().Connect(_applicationResizeEventCallbackDelegate);
707 if (_applicationResizeEventHandler != null)
709 this.ResizeSignal().Disconnect(_applicationResizeEventCallbackDelegate);
712 _applicationResizeEventHandler -= value;
717 // Callback for Application ResizeSignal
718 private void OnNUIApplicationResize(IntPtr data)
720 NUIApplicationResizedEventArgs e = new NUIApplicationResizedEventArgs();
722 // Populate all members of "e" (NUIApplicationResizeEventArgs) with real data
723 e.Application = Application.GetApplicationFromPtr(data);
725 if (_applicationResizeEventHandler != null)
727 //here we send all data to user event handlers
728 _applicationResizeEventHandler(this, e);
733 * @brief Event for LanguageChanged signal which can be used to subscribe/unsubscribe the event handler
734 * (in the type of NUIApplicationLanguageChangedEventHandler-DaliEventHandler<object,NUIApplicationLanguageChangedEventArgs>)
735 * provided by the user. LanguageChanged signal is emitted when the region of the device is changed.
737 public event DaliEventHandler<object, NUIApplicationLanguageChangedEventArgs> LanguageChanged
743 // Restricted to only one listener
744 if (_applicationLanguageChangedEventHandler == null)
746 _applicationLanguageChangedEventHandler += value;
748 _applicationLanguageChangedEventCallbackDelegate = new NUIApplicationLanguageChangedEventCallbackDelegate(OnNUIApplicationLanguageChanged);
749 this.LanguageChangedSignal().Connect(_applicationLanguageChangedEventCallbackDelegate);
758 if (_applicationLanguageChangedEventHandler != null)
760 this.LanguageChangedSignal().Disconnect(_applicationLanguageChangedEventCallbackDelegate);
763 _applicationLanguageChangedEventHandler -= value;
768 // Callback for Application LanguageChangedSignal
769 private void OnNUIApplicationLanguageChanged(IntPtr data)
771 NUIApplicationLanguageChangedEventArgs e = new NUIApplicationLanguageChangedEventArgs();
773 // Populate all members of "e" (NUIApplicationLanguageChangedEventArgs) with real data
774 e.Application = Application.GetApplicationFromPtr(data);
776 if (_applicationLanguageChangedEventHandler != null)
778 //here we send all data to user event handlers
779 _applicationLanguageChangedEventHandler(this, e);
784 * @brief Event for RegionChanged signal which can be used to subscribe/unsubscribe the event handler
785 * (in the type of NUIApplicationRegionChangedEventHandler-DaliEventHandler<object,NUIApplicationRegionChangedEventArgs>)
786 * provided by the user. RegionChanged signal is emitted when the region of the device is changed.
788 public event DaliEventHandler<object, NUIApplicationRegionChangedEventArgs> RegionChanged
794 // Restricted to only one listener
795 if (_applicationRegionChangedEventHandler == null)
797 _applicationRegionChangedEventHandler += value;
799 _applicationRegionChangedEventCallbackDelegate = new NUIApplicationRegionChangedEventCallbackDelegate(OnNUIApplicationRegionChanged);
800 this.RegionChangedSignal().Connect(_applicationRegionChangedEventCallbackDelegate);
809 if (_applicationRegionChangedEventHandler != null)
811 this.RegionChangedSignal().Disconnect(_applicationRegionChangedEventCallbackDelegate);
814 _applicationRegionChangedEventHandler -= value;
819 // Callback for Application RegionChangedSignal
820 private void OnNUIApplicationRegionChanged(IntPtr data)
822 NUIApplicationRegionChangedEventArgs e = new NUIApplicationRegionChangedEventArgs();
824 // Populate all members of "e" (NUIApplicationRegionChangedEventArgs) with real data
825 e.Application = Application.GetApplicationFromPtr(data);
827 if (_applicationRegionChangedEventHandler != null)
829 //here we send all data to user event handlers
830 _applicationRegionChangedEventHandler(this, e);
835 * @brief Event for BatteryLow signal which can be used to subscribe/unsubscribe the event handler
836 * (in the type of NUIApplicationBatteryLowEventHandler-DaliEventHandler<object,NUIApplicationBatteryLowEventArgs>)
837 * provided by the user. BatteryLow signal is emitted when the battery level of the device is low.
839 public event DaliEventHandler<object, NUIApplicationBatteryLowEventArgs> BatteryLow
845 // Restricted to only one listener
846 if (_applicationBatteryLowEventHandler == null)
848 _applicationBatteryLowEventHandler += value;
850 _applicationBatteryLowEventCallbackDelegate = new NUIApplicationBatteryLowEventCallbackDelegate(OnNUIApplicationBatteryLow);
851 this.BatteryLowSignal().Connect(_applicationBatteryLowEventCallbackDelegate);
860 if (_applicationBatteryLowEventHandler != null)
862 this.BatteryLowSignal().Disconnect(_applicationBatteryLowEventCallbackDelegate);
865 _applicationBatteryLowEventHandler -= value;
870 // Callback for Application BatteryLowSignal
871 private void OnNUIApplicationBatteryLow(IntPtr data)
873 NUIApplicationBatteryLowEventArgs e = new NUIApplicationBatteryLowEventArgs();
875 // Populate all members of "e" (NUIApplicationBatteryLowEventArgs) with real data
876 e.Application = Application.GetApplicationFromPtr(data);
878 if (_applicationBatteryLowEventHandler != null)
880 //here we send all data to user event handlers
881 _applicationBatteryLowEventHandler(this, e);
886 * @brief Event for MemoryLow signal which can be used to subscribe/unsubscribe the event handler
887 * (in the type of NUIApplicationMemoryLowEventHandler-DaliEventHandler<object,NUIApplicationMemoryLowEventArgs>)
888 * provided by the user. MemoryLow signal is emitted when the memory level of the device is low.
890 public event DaliEventHandler<object, NUIApplicationMemoryLowEventArgs> MemoryLow
896 // Restricted to only one listener
897 if (_applicationMemoryLowEventHandler == null)
899 _applicationMemoryLowEventHandler += value;
901 _applicationMemoryLowEventCallbackDelegate = new NUIApplicationMemoryLowEventCallbackDelegate(OnNUIApplicationMemoryLow);
902 this.MemoryLowSignal().Connect(_applicationMemoryLowEventCallbackDelegate);
911 if (_applicationMemoryLowEventHandler != null)
913 this.MemoryLowSignal().Disconnect(_applicationMemoryLowEventCallbackDelegate);
916 _applicationMemoryLowEventHandler -= value;
921 // Callback for Application MemoryLowSignal
922 private void OnNUIApplicationMemoryLow(IntPtr data)
924 NUIApplicationMemoryLowEventArgs e = new NUIApplicationMemoryLowEventArgs();
926 // Populate all members of "e" (NUIApplicationMemoryLowEventArgs) with real data
927 e.Application = Application.GetApplicationFromPtr(data);
929 if (_applicationMemoryLowEventHandler != null)
931 //here we send all data to user event handlers
932 _applicationMemoryLowEventHandler(this, e);
937 * @brief Event for AppControl signal which can be used to subscribe/unsubscribe the event handler
938 * (in the type of NUIApplicationAppControlEventHandler-DaliEventHandler<object,NUIApplicationAppControlEventArgs>)
939 * provided by the user. AppControl signal is emitted when another application sends a launch request to the application.
941 public event DaliEventHandler<object, NUIApplicationAppControlEventArgs> AppControl
947 // Restricted to only one listener
948 if (_applicationAppControlEventHandler == null)
950 _applicationAppControlEventHandler += value;
952 _applicationAppControlEventCallbackDelegate = new NUIApplicationAppControlEventCallbackDelegate(OnNUIApplicationAppControl);
953 this.AppControlSignal().Connect(_applicationAppControlEventCallbackDelegate);
962 if (_applicationAppControlEventHandler != null)
964 this.AppControlSignal().Disconnect(_applicationAppControlEventCallbackDelegate);
967 _applicationAppControlEventHandler -= value;
972 // Callback for Application AppControlSignal
973 private void OnNUIApplicationAppControl(IntPtr application, IntPtr voidp)
975 NUIApplicationAppControlEventArgs e = new NUIApplicationAppControlEventArgs();
977 // Populate all members of "e" (NUIApplicationAppControlEventArgs) with real data
978 e.Application = Application.GetApplicationFromPtr(application);
981 if (_applicationAppControlEventHandler != null)
983 //here we send all data to user event handlers
984 _applicationAppControlEventHandler(this, e);
988 private static Application _instance; // singleton
990 public delegate void InitDelegate();
992 public delegate void TerminateDelegate();
994 public delegate void PauseDelegate();
996 public delegate void ResumeDelegate();
998 public delegate void ResizeDelegate();
1000 public delegate void AppControlDelegate();
1002 public delegate void LanguageChangedDelegate();
1004 public delegate void RegionChangedDelegate();
1006 public delegate void BatteryLowDelegate();
1008 public delegate void MemoryLowDelegate();
1010 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1011 internal delegate void InitDelegateInternal();
1013 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1014 internal delegate void TerminateDelegateInternal();
1016 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1017 internal delegate void PauseDelegateInternal();
1019 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1020 internal delegate void ResumeDelegateInternal();
1022 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1023 internal delegate void ResizeDelegateInternal();
1025 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1026 internal delegate void AppControlDelegateInternal();
1028 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1029 internal delegate void LanguageChangedDelegateInternal();
1031 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1032 internal delegate void RegionChangedDelegateInternal();
1034 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1035 internal delegate void BatteryLowDelegateInternal();
1037 [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)]
1038 internal delegate void MemoryLowDelegateInternal();
1040 static void Initialization()
1042 // instance.InitDelegate();
1045 public static Application Instance
1053 public static Application GetApplicationFromPtr(global::System.IntPtr cPtr)
1055 Application ret = new Application(cPtr, false);
1056 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1060 internal void SetupDelegates()
1062 InitDelegateInternal initializeCallback = new InitDelegateInternal(Initialization);
1064 NUILog.Debug("InitSignal connection count");
1066 this.InitSignal().Connect(initializeCallback);
1068 NUILog.Debug("InitSignal connection count = " + InitSignal().GetConnectionCount());
1071 public static Application NewApplication()
1073 _instance = NewApplication("", Application.WindowMode.Opaque);
1077 public static Application NewApplication(string stylesheet)
1079 _instance = NewApplication(stylesheet, Application.WindowMode.Opaque);
1083 public static Application NewApplication(string stylesheet, Application.WindowMode windowMode)
1092 if (NDalicManualPINVOKE.NativeVersionCheck(ref ver1, ref ver2, ref ver3))
1094 if (ver1 != Version.ver1 || ver2 != Version.ver2 || ver3 != Version.ver3)
1096 //throw new System.InvalidOperationException("Dali native version mismatch error! nui=" + Version.ver1 + "." + Version.ver2 + "." + Version.ver3 + " but dali=" + ver1 + "." + ver2 + "." + ver3);
1097 NUILog.Error("Dali native version mismatch error! nui=" + Version.nuiVer1 + "." + Version.nuiVer2 + "." + Version.nuiVer3 + Version.nuiRelease + " but native dali=" + ver1 + "." + ver2 + "." + ver3);
1102 //throw new System.InvalidOperationException("Dali native version mismatch error! nui=" + Version.ver1 + "." + Version.ver2 + "." + Version.ver3 + " but dali=" + ver1 + "." + ver2 + "." + ver3);
1103 NUILog.Error("Dali native version mismatch error! nui=" + Version.nuiVer1 + "." + Version.nuiVer2 + "." + Version.nuiVer3 + Version.nuiRelease + " but native dali=" + ver1 + "." + ver2 + "." + ver3);
1106 catch (Exception exc)
1108 //throw new System.InvalidOperationException("Dali native version is very old! nui=" + Version.ver1 + "." + Version.ver2 + "." + Version.ver3);
1109 NUILog.Error("Dali native version is very old! nui=" + Version.nuiVer1 + "." + Version.nuiVer2 + "." + Version.nuiVer3 + Version.nuiRelease);
1110 NUILog.Error("exception occured! =" + exc.Message);
1112 NUILog.Debug(" Dali native version=" + ver1 + "." + ver2 + "." + ver3 + " NUI version=" + Version.nuiVer1 + "." + Version.nuiVer2 + "." + Version.nuiVer3 + Version.nuiRelease);
1114 NUILog.Debug(" NewApplication(string stylesheet, Application.WindowMode windowMode) is called! ");
1116 // register all Views with the type registry, so that can be created / styled via JSON
1117 //ViewRegistryHelper.Initialize(); //moved to Application side.
1119 Application ret = New(1, stylesheet, windowMode);
1120 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1122 // we've got an application now connect the signals
1123 ret.SetupDelegates();
1124 // set the singleton
1129 //Removed from v0.2.33
1130 /*public bool AddIdle(System.Delegate func)
1132 System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
1133 System.IntPtr ip2 = NDalicManualPINVOKE.MakeCallback(new System.Runtime.InteropServices.HandleRef(this, ip));
1135 bool ret = NDalicPINVOKE.Application_AddIdle(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip2));
1137 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1144 * Outer::outer_method(int)
1146 public static Application New()
1148 NUILog.Debug("New() is called!");
1150 Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_0(), true);
1151 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1155 public static Application New(int argc)
1157 NUILog.Debug("New(int argc) is called!");
1159 Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_1(argc), true);
1160 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1164 public static Application New(int argc, string stylesheet)
1166 NUILog.Debug("New(int argc, string stylesheet) is called!");
1168 Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_2(argc, stylesheet), true);
1169 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1173 public static Application New(int argc, string stylesheet, Application.WindowMode windowMode)
1175 NUILog.Debug("New(int argc, string stylesheet, Application.WindowMode windowMode) is called!");
1177 Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_3(argc, stylesheet, (int)windowMode), true);
1178 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1182 public Application() : this(NDalicPINVOKE.new_Application__SWIG_0(), true)
1184 NUILog.Debug("Application() is called!");
1186 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1189 public Application(Application application) : this(NDalicPINVOKE.new_Application__SWIG_1(Application.getCPtr(application)), true)
1191 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1194 public Application Assign(Application application)
1196 Application ret = new Application(NDalicPINVOKE.Application_Assign(swigCPtr, Application.getCPtr(application)), false);
1197 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1201 public void MainLoop()
1203 NDalicPINVOKE.Application_MainLoop__SWIG_0(swigCPtr);
1204 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1207 internal void MainLoop(SWIGTYPE_p_Configuration__ContextLoss configuration)
1209 NDalicPINVOKE.Application_MainLoop__SWIG_1(swigCPtr, SWIGTYPE_p_Configuration__ContextLoss.getCPtr(configuration));
1210 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1215 NDalicPINVOKE.Application_Lower(swigCPtr);
1216 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1221 NDalicPINVOKE.Application_Quit(swigCPtr);
1222 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1225 internal bool AddIdle(SWIGTYPE_p_Dali__CallbackBase callback)
1227 bool ret = NDalicPINVOKE.Application_AddIdle(swigCPtr, SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback));
1228 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1232 public Window GetWindow()
1234 Window ret = new Window(NDalicPINVOKE.Application_GetWindow(swigCPtr), true);
1235 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1239 public void ReplaceWindow(Rectangle windowPosition, string name)
1241 NDalicPINVOKE.Application_ReplaceWindow(swigCPtr, Rectangle.getCPtr(windowPosition), name);
1242 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1245 public static string GetResourcePath()
1247 string ret = NDalicPINVOKE.Application_GetResourcePath();
1248 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1252 internal void SetViewMode(ViewMode viewMode)
1254 NDalicPINVOKE.Application_SetViewMode(swigCPtr, (int)viewMode);
1255 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1258 internal ViewMode GetViewMode()
1260 ViewMode ret = (ViewMode)NDalicPINVOKE.Application_GetViewMode(swigCPtr);
1261 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1265 public void SetStereoBase(float stereoBase)
1267 NDalicPINVOKE.Application_SetStereoBase(swigCPtr, stereoBase);
1268 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1271 public float GetStereoBase()
1273 float ret = NDalicPINVOKE.Application_GetStereoBase(swigCPtr);
1274 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1278 internal ApplicationSignal InitSignal()
1280 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_InitSignal(swigCPtr), false);
1281 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1285 internal ApplicationSignal TerminateSignal()
1287 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_TerminateSignal(swigCPtr), false);
1288 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1292 internal ApplicationSignal PauseSignal()
1294 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_PauseSignal(swigCPtr), false);
1295 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1299 internal ApplicationSignal ResumeSignal()
1301 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_ResumeSignal(swigCPtr), false);
1302 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1306 internal ApplicationSignal ResetSignal()
1308 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_ResetSignal(swigCPtr), false);
1309 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1313 internal ApplicationSignal ResizeSignal()
1315 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_ResizeSignal(swigCPtr), false);
1316 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1320 internal ApplicationControlSignal AppControlSignal()
1322 ApplicationControlSignal ret = new ApplicationControlSignal(NDalicPINVOKE.Application_AppControlSignal(swigCPtr), false);
1323 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1327 internal ApplicationSignal LanguageChangedSignal()
1329 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_LanguageChangedSignal(swigCPtr), false);
1330 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1334 internal ApplicationSignal RegionChangedSignal()
1336 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_RegionChangedSignal(swigCPtr), false);
1337 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1341 internal ApplicationSignal BatteryLowSignal()
1343 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_BatteryLowSignal(swigCPtr), false);
1344 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1348 internal ApplicationSignal MemoryLowSignal()
1350 ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_MemoryLowSignal(swigCPtr), false);
1351 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1355 public enum WindowMode