Revert "[NUI] Dialog and AlertDialog code refactoring with adding DialogPage"
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Samples / Tizen.NUI.Samples / Samples / ControlSample.cs
1 using Tizen.NUI;
2 using Tizen.NUI.BaseComponents;
3 using Tizen.NUI.Components;
4
5 namespace Tizen.NUI.Samples
6 {
7     public class ControlSample : IExample
8     {
9         private View root;
10         private Control control;
11
12         public void Activate()
13         {
14             Window window = NUIApplication.GetDefaultWindow();
15
16             root = new View()
17             {
18                 Size = window.Size,
19                 BackgroundColor = new Color(0.8f, 0.8f, 0.8f, 0.6f),
20                 ParentOrigin = ParentOrigin.Center,
21                 PivotPoint = PivotPoint.Center,
22                 PositionUsesPivotPoint = true,
23             };
24             window.Add(root);
25
26             control = new Control()
27             {
28                 Size = new Size(100, 100),
29                 BackgroundColor = Color.Blue,
30                 ParentOrigin = ParentOrigin.Center,
31                 PivotPoint = PivotPoint.Center,
32                 PositionUsesPivotPoint = true,
33                 BoxShadow = new Shadow(0, new Color(0.2f, 0.2f, 0.2f, 0.3f), new Vector2(5, 5)),
34                 CornerRadius = 0.5f,
35                 CornerRadiusPolicy = VisualTransformPolicyType.Relative,
36             };
37
38             root.Add(control);
39
40             var animation = new Animation(2000);
41             animation.AnimateTo(control, "SizeWidth", 200, 0, 1000);
42             animation.AnimateTo(control, "SizeWidth", 100, 1000, 2000);
43             animation.Looping = true;
44             animation.Play();
45         }
46
47         public void Deactivate()
48         {
49             if (root != null)
50             {
51                 NUIApplication.GetDefaultWindow().Remove(root);
52                 root.Dispose();
53             }
54         }
55     }
56 }