Refactor AppFW
[platform/core/csapi/tizenfx.git] / Tizen.Applications / Tizen.Applications / ServiceApplication.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
16 namespace Tizen.Applications
17 {
18     /// <summary>
19     /// 
20     /// </summary>
21     public class ServiceApplication : Application
22     {
23         /// <summary>
24         /// 
25         /// </summary>
26         /// <param name="args"></param>
27         public override void Run(string[] args)
28         {
29             base.Run(args);
30
31             Interop.Service.ServiceAppLifecycleCallbacks ops;
32             ops.OnCreate = (data) =>
33             {
34                 SendCreate();
35                 return true;
36             };
37             ops.OnTerminate = (data) =>
38             {
39                 OnTerminate();
40             };
41             ops.OnAppControl = (appControlHandle, data) =>
42             {
43                 OnAppControlReceived(new ReceivedAppControl(appControlHandle));
44             };
45
46             TizenSynchronizationContext.Initialize();
47             Interop.Service.Main(args.Length, args, ref ops, IntPtr.Zero);
48         }
49
50         /// <summary>
51         /// 
52         /// </summary>
53         public override void Exit()
54         {
55             Interop.Service.Exit();
56         }
57     }
58 }