[NUI] Modify seamless bug & update sample (#2102)
[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             Window.Instance.BackgroundColor = Color.Yellow;
20
21             TextLabel text = new TextLabel("Callee");
22             text.HorizontalAlignment = HorizontalAlignment.Center;
23             text.VerticalAlignment = VerticalAlignment.Center;
24             text.TextColor = Color.Red;
25             text.PointSize = 25.0f;
26             text.HeightResizePolicy = ResizePolicyType.FillToParent;
27             text.WidthResizePolicy = ResizePolicyType.FillToParent;
28             Window.Instance.GetDefaultLayer().Add(text);
29
30             TransitionOptions = new TransitionOptions(GetDefaultWindow());
31             TransitionOptions.EnableTransition = true;
32
33             TransitionOptions.CallerScreenShown += TransitionOptions_CallerScreenShown;
34             TransitionOptions.CallerScreenHidden += TransitionOptions_CallerScreenHidden;
35         }
36
37         private void TransitionOptions_CallerScreenShown(object sender, EventArgs e)
38         {
39             Tizen.Log.Error("MYLOG", "Shown");
40         }
41
42         private void TransitionOptions_CallerScreenHidden(object sender, EventArgs e)
43         {
44             Tizen.Log.Error("MYLOG", "Hidden");
45         }
46
47         private void OnTouchEvent(object sender, Window.TouchEventArgs e)
48         {
49             if (e.Touch.GetState(0) == PointStateType.Up)
50             {
51                 //Window.Instance.Hide();
52                 Exit();
53             }
54         }
55
56         public void OnKeyEvent(object sender, Window.KeyEventArgs e)
57         {
58             if (e.Key.State == Key.StateType.Down && (e.Key.KeyPressedName == "XF86Back" || e.Key.KeyPressedName == "Escape"))
59             {
60                 Exit();
61             }
62         }
63
64         static void Main(string[] args)
65         {
66             var app = new Program();
67             app.Run(args);
68         }
69     }
70 }