Revert "[NUI] Dialog and AlertDialog code refactoring with adding DialogPage"
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Samples / Tizen.NUI.Samples / Samples / AnimatedVectorImageViewTest.cs
1 using System;
2 using Tizen.NUI;
3 using Tizen.NUI.BaseComponents;
4
5 namespace Tizen.NUI.Samples
6 {
7     public class AnimatedVectorImageViewTest : IExample
8     {
9         Window win;
10         AnimatedVectorImageView avi, avi2, avi3, avi4, avi5, avi6;
11         public void Activate()
12         {
13             Tizen.Log.Fatal("NUITEST", $"###Activate()");
14             win = NUIApplication.GetDefaultWindow();
15             win.BackgroundColor = Color.Green;
16             win.KeyEvent += Win_KeyEvent;
17
18             avi = new AnimatedVectorImageView();
19             avi.ResourceURL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "images/marker.json";
20             avi.RepeatCount = -1;
21             avi.BackgroundColor = Color.White;
22             avi.Position2D = new Position2D(50, 10);
23             avi.Size2D = new Size2D(500, 500);
24             win.GetDefaultLayer().Add(avi);
25             avi.Play();
26
27             avi2 = new AnimatedVectorImageView();
28             avi2.ResourceURL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "images/marker.json";
29             avi2.RepeatCount = -1;
30             avi2.BackgroundColor = Color.White;
31             avi2.Position2D = new Position2D(600, 10);
32             avi2.Size2D = new Size2D(500, 500);
33             avi2.SetMinMaxFrameByMarker("first");
34             win.GetDefaultLayer().Add(avi2);
35             avi2.Play();
36
37             avi3 = new AnimatedVectorImageView();
38             avi3.ResourceURL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "images/marker.json";
39             avi3.RepeatCount = -1;
40             avi3.BackgroundColor = Color.White;
41             avi3.Position2D = new Position2D(1150, 10);
42             avi3.Size2D = new Size2D(500, 500);
43             avi3.SetMinMaxFrameByMarker("second", "third");
44             win.GetDefaultLayer().Add(avi3);
45             avi3.Play();
46
47             avi4 = new AnimatedVectorImageView();
48             avi4.ResourceURL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "images/marker.json";
49             avi4.RepeatCount = -1;
50             avi4.BackgroundColor = Color.White;
51             avi4.Position2D = new Position2D(50, 550);
52             avi4.Size2D = new Size2D(500, 500);
53             avi4.SetMinMaxFrameByMarker("second");
54             win.GetDefaultLayer().Add(avi4);
55             avi4.Play();
56
57             avi5 = new AnimatedVectorImageView();
58             avi5.ResourceURL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "images/marker.json";
59             avi5.RepeatCount = -1;
60             avi5.BackgroundColor = Color.White;
61             avi5.Position2D = new Position2D(600, 550);
62             avi5.Size2D = new Size2D(500, 500);
63             avi5.SetMinMaxFrameByMarker("third");
64             win.GetDefaultLayer().Add(avi5);
65             avi5.Play();
66
67             avi6 = new AnimatedVectorImageView();
68             avi6.ResourceURL = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "images/marker.json";
69             avi6.RepeatCount = -1;
70             avi6.BackgroundColor = Color.White;
71             avi6.Position2D = new Position2D(1150, 550);
72             avi6.Size2D = new Size2D(500, 500);
73             avi6.SetMinMaxFrameByMarker("third", "first");
74             win.GetDefaultLayer().Add(avi6);
75             avi6.Play();
76
77         }
78         public void Deactivate()
79         {
80             win.KeyEvent -= Win_KeyEvent;
81
82             win.GetDefaultLayer().Remove(avi);
83             win.GetDefaultLayer().Remove(avi2);
84             win.GetDefaultLayer().Remove(avi3);
85             win.GetDefaultLayer().Remove(avi4);
86             win.GetDefaultLayer().Remove(avi5);
87             win.GetDefaultLayer().Remove(avi6);
88         }
89
90         private void Win_KeyEvent(object sender, Window.KeyEventArgs e)
91         {
92             if (e.Key.State == Key.StateType.Down)
93             {
94                 if (e.Key.KeyPressedName == "1")
95                 {
96                     var l = avi.GetContentInfo();
97                     foreach (var iter in l)
98                     {
99                         Tizen.Log.Fatal("NUITEST", $"content [{iter.Item1}, {iter.Item2}, {iter.Item3}]");
100                     }
101                 }
102                 else if (e.Key.KeyPressedName == "2")
103                 {
104                     avi2.SetMinAndMaxFrame(0, 1000);
105                 }
106                 else if (e.Key.KeyPressedName == "3")
107                 {
108                     avi3.SetMinMaxFrameByMarker("first", "second");
109                 }
110                 else if (e.Key.KeyPressedName == "4")
111                 {
112                     avi6.SetMinMaxFrameByMarker("second", "third");
113                 }
114                 else if (e.Key.KeyPressedName == "5")
115                 {
116                     avi6.SetMinMaxFrameByMarker("first", "second");
117                 }
118                 else if (e.Key.KeyPressedName == "6")
119                 {
120                     avi6.SetMinMaxFrame(0, 1000);
121                 }
122                 else if (e.Key.KeyPressedName == "7")
123                 {
124                     avi.Stop(AnimatedVectorImageView.EndActions.Discard);
125                     avi2.Stop(AnimatedVectorImageView.EndActions.Discard);
126                     avi3.Stop(AnimatedVectorImageView.EndActions.Discard);
127                     avi4.Stop(AnimatedVectorImageView.EndActions.Discard);
128                     avi5.Stop(AnimatedVectorImageView.EndActions.Discard);
129                     avi6.Stop(AnimatedVectorImageView.EndActions.Discard);
130                 }
131                 else if (e.Key.KeyPressedName == "8")
132                 {
133                     avi.Stop(AnimatedVectorImageView.EndActions.StopFinal);
134                     avi2.Stop(AnimatedVectorImageView.EndActions.StopFinal);
135                     avi3.Stop(AnimatedVectorImageView.EndActions.StopFinal);
136                     avi4.Stop(AnimatedVectorImageView.EndActions.StopFinal);
137                     avi5.Stop(AnimatedVectorImageView.EndActions.StopFinal);
138                     avi6.Stop(AnimatedVectorImageView.EndActions.StopFinal);
139                 }
140                 else if (e.Key.KeyPressedName == "9")
141                 {
142                     avi.Play();
143                     avi2.Play();
144                     avi3.Play();
145                     avi4.Play();
146                     avi5.Play();
147                     avi6.Play();
148                 }
149                 else if (e.Key.KeyPressedName == "0")
150                 {
151                     Tizen.Log.Fatal("NUITEST", $"get MinMaxFrame() !");
152                     var temp = avi.GetMinMaxFrame();
153                     Tizen.Log.Fatal("NUITEST", $"avi min={temp.Item1}, max={temp.Item2}");
154                     temp = avi2.GetMinMaxFrame();
155                     Tizen.Log.Fatal("NUITEST", $"avi2 min={temp.Item1}, max={temp.Item2}");
156                     temp = avi3.GetMinMaxFrame();
157                     Tizen.Log.Fatal("NUITEST", $"avi3 min={temp.Item1}, max={temp.Item2}");
158                     temp = avi4.GetMinMaxFrame();
159                     Tizen.Log.Fatal("NUITEST", $"avi4 min={temp.Item1}, max={temp.Item2}");
160                     temp = avi5.GetMinMaxFrame();
161                     Tizen.Log.Fatal("NUITEST", $"avi5 min={temp.Item1}, max={temp.Item2}");
162                     temp = avi6.GetMinMaxFrame();
163                     Tizen.Log.Fatal("NUITEST", $"avi6 min={temp.Item1}, max={temp.Item2}");
164                 }
165             }
166         }
167     }
168 }