[NUI] Add InterceptTouchEvent (#2098)
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Seamless / NUISimpleCallee / NUISimpleCallee.cs
1 using System;
2 using Tizen.NUI;
3 using Tizen.NUI.BaseComponents;
4
5 namespace NUISimpleCallee
6 {
7     class Program : NUIApplication
8     {
9         protected override void OnCreate()
10         {
11             base.OnCreate();
12             Initialize();
13         }
14
15         void Initialize()
16         {
17             Window.Instance.KeyEvent += OnKeyEvent;
18             Window.Instance.TouchEvent += OnTouchEvent;
19
20             TextLabel text = new TextLabel("Callee");
21             text.HorizontalAlignment = HorizontalAlignment.Center;
22             text.VerticalAlignment = VerticalAlignment.Center;
23             text.TextColor = Color.Red;
24             text.PointSize = 12.0f;
25             text.HeightResizePolicy = ResizePolicyType.FillToParent;
26             text.WidthResizePolicy = ResizePolicyType.FillToParent;
27             Window.Instance.GetDefaultLayer().Add(text);
28
29             TransitionOptions = new TransitionOptions(GetDefaultWindow());
30             TransitionOptions.EnableTransition = true;
31         }
32
33         private void OnTouchEvent(object sender, Window.TouchEventArgs e)
34         {
35             if (e.Touch.GetState(0) == PointStateType.Up)
36             {
37                 Exit();
38             }
39         }
40
41         public void OnKeyEvent(object sender, Window.KeyEventArgs e)
42         {
43             if (e.Key.State == Key.StateType.Down && (e.Key.KeyPressedName == "XF86Back" || e.Key.KeyPressedName == "Escape"))
44             {
45                 Exit();
46             }
47         }
48
49         static void Main(string[] args)
50         {
51             var app = new Program();
52             app.Run(args);
53         }
54     }
55 }