5abfcffe67cef61c316eb6bd245a13fe7dcd8b31
[platform/core/csapi/tizenfx.git] / src / Tizen.Applications.ComponentBased.Default / Tizen.Applications.ComponentBased.Default / EFLComponentBasedApplication.cs
1 using ElmSharp;
2 using System;
3 using System.Collections.Generic;
4 using Tizen.Applications.ComponentBased.Common;
5
6 namespace Tizen.Applications.ComponentBased.Default
7 {
8     /// <summary>
9     /// The basic EFL component-based application class.
10     /// </summary>
11     /// <since_tizen> 6 </since_tizen>
12     public class EFLComponentBasedApplication : ComponentBasedApplication
13     {
14         private const string LogTag = "Tizen.Applications";
15
16         /// <summary>
17         /// Initializes the ComponentBasedApplication class.
18         /// </summary>
19         /// <param name="typeInfo">The component type information.
20         /// The key should be a class type of BaseComponent subclass.
21         /// The value should be a component id which is declared in tizen-manifest.xml.
22         /// </param>
23         /// <since_tizen> 6 </since_tizen>
24         public EFLComponentBasedApplication(IDictionary<Type, string> typeInfo) : base(typeInfo)
25         {
26         }
27
28         /// <summary>
29         /// This method will be called before running main-loop
30         /// </summary>
31         /// <param name="args"></param>
32         /// <since_tizen> 6 </since_tizen>
33         protected override void OnInit(string[] args)
34         {
35             Interop.Elementary.ElmInit(args.Length, args);
36             string hwacc = Environment.GetEnvironmentVariable("HWACC");
37
38             if (hwacc == "USE")
39             {
40                 Interop.Elementary.ElmConfigAccelPreferenceSet("hw");
41                 Log.Info(LogTag, "elm_config_accel_preference_set: hw");
42             }
43             else if (hwacc == "NOT_USE")
44             {
45                 Interop.Elementary.ElmConfigAccelPreferenceSet("none");
46                 Log.Info(LogTag, "elm_config_accel_preference_set: none");
47             }
48             else
49             {
50                 Log.Info(LogTag, "elm_config_accel_preference_set is not called");
51             }
52         }
53
54         /// <summary>
55         /// This method will be called after exiting main-loop
56         /// </summary>
57         /// <since_tizen> 6 </since_tizen>
58         protected override void OnFinished()
59         {
60             Interop.Elementary.ElmShutdown();
61             if (Environment.GetEnvironmentVariable("AUL_LOADER_INIT") == null)
62                 return;
63
64             Environment.SetEnvironmentVariable("AUL_LOADER_INIT", null);
65             Interop.Elementary.ElmShutdown();
66         }
67
68         /// <summary>
69         /// This method will be called to start main-loop
70         /// </summary>
71         /// <since_tizen> 6 </since_tizen>
72         protected override void OnRun()
73         {
74             Interop.Elementary.ElmRun();
75         }
76
77         /// <summary>
78         /// This method will be called to exit main-loop
79         /// </summary>
80         /// <since_tizen> 6 </since_tizen>
81         protected override void OnExit()
82         {
83             Interop.Elementary.ElmExit();
84         }
85     }
86 }