Refactor AppFW
[platform/core/csapi/tizenfx.git] / Tizen.Applications / Tizen.Applications / UIApplication.cs
1 /// Copyright 2016 by Samsung Electronics, Inc.,
2 ///
3 /// This software is the confidential and proprietary information
4 /// of Samsung Electronics, Inc. ("Confidential Information"). You
5 /// shall not disclose such Confidential Information and shall use
6 /// it only in accordance with the terms of the license agreement
7 /// you entered into with Samsung.
8
9
10 using System;
11 using System.Collections.Generic;
12 using System.Linq;
13 using System.Text;
14 using System.Threading.Tasks;
15 using Tizen.Internals.Errors;
16
17 namespace Tizen.Applications
18 {
19     /// <summary>
20     /// 
21     /// </summary>
22     public class UIApplication : Application
23     {
24         /// <summary>
25         /// 
26         /// </summary>
27         /// <param name="args"></param>
28         public override void Run(string[] args)
29         {
30             base.Run(args);
31
32             Interop.Application.UIAppLifecycleCallbacks ops;
33             ops.OnCreate = (data) =>
34             {
35                 SendCreate();
36                 return true;
37             };
38             ops.OnTerminate = (data) =>
39             {
40                 OnTerminate();
41             };
42             ops.OnAppControl = (appControlHandle, data) =>
43             {
44                 OnAppControlReceived(new ReceivedAppControl(appControlHandle));
45             };
46             ops.OnResume = (data) =>
47             {
48                 OnResume();
49             };
50             ops.OnPause = (data) =>
51             {
52                 OnPause();
53             };
54
55             TizenSynchronizationContext.Initialize();
56             Interop.Application.Main(args.Length, args, ref ops, IntPtr.Zero);
57         }
58
59         /// <summary>
60         /// 
61         /// </summary>
62         public override void Exit()
63         {
64             Interop.Application.Exit();
65         }
66
67         /// <summary>
68         /// 
69         /// </summary>
70         protected virtual void OnResume()
71         {
72         }
73
74         /// <summary>
75         /// 
76         /// </summary>
77         protected virtual void OnPause()
78         {
79         }
80     }
81 }