[NUI] Fix NUITizenGallery to run on Ubuntu VS-Code debugging
[platform/core/csapi/tizenfx.git] / test / NUITizenGallery / Examples / RotationTest / RotationTest1Page.xaml.cs
1 /*
2  * Copyright(c) 2021 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 using System;
18 using Tizen.NUI;
19 using Tizen.NUI.BaseComponents;
20 using Tizen.NUI.Components;
21
22 namespace NUITizenGallery
23 {
24     public partial class RotationTest1Page : ContentPage
25     {
26         private readonly string ResourcePath = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "/images/";
27         public RotationTest1Page()
28         {
29             InitializeComponent();
30             img.SetImage(ResourcePath + "a.jpg");
31
32             int count = 0;
33             btn.Clicked += (o, e) =>
34             {
35                 count++;
36                 if (count == 1)
37                 {
38                     btn.Orientation = new Rotation(new Radian(new Degree(45.0f)), Vector3.ZAxis);
39                 }
40                 else if (count == 2)
41                 {
42                     btn.Orientation = new Rotation(new Radian(new Degree(-45.0f)), Vector3.ZAxis);
43                     btn.Orientation = new Rotation(new Radian(new Degree(45.0f)), Vector3.XAxis);
44                 }
45                 else if (count == 3)
46                 {
47                     btn.Orientation = new Rotation(new Radian(new Degree(0.0f)), Vector3.ZAxis);
48                     btn.Orientation = new Rotation(new Radian(new Degree(-45.0f)), Vector3.XAxis);
49                     btn.Orientation = new Rotation(new Radian(new Degree(45.0f)), Vector3.YAxis);
50                 }
51                 else if (count == 4)
52                 {
53                     btn.Orientation = new Rotation(new Radian(new Degree(45.0f)), Vector3.ZAxis);
54                     btn.Orientation = new Rotation(new Radian(new Degree(45.0f)), Vector3.XAxis);
55                     btn.Orientation = new Rotation(new Radian(new Degree(0.0f)), Vector3.YAxis);
56                 }
57                 else
58                 {
59                     btn.Orientation = new Rotation(new Radian(new Degree(-45.0f)), Vector3.ZAxis);
60                     btn.Orientation = new Rotation(new Radian(new Degree(-45.0f)), Vector3.XAxis);
61                     btn.Orientation = new Rotation(new Radian(new Degree(-45.0f)), Vector3.YAxis);
62                     count = 0;
63                 }
64             };
65             sliderX.ValueChanged += (s, e) =>
66             {
67                 btn.Orientation = new Rotation(new Radian(new Degree(sliderX.CurrentValue)), Vector3.XAxis);
68                 rect.Orientation = new Rotation(new Radian(new Degree(sliderX.CurrentValue)), Vector3.XAxis);
69                 img.Orientation = new Rotation(new Radian(new Degree(sliderX.CurrentValue)), Vector3.XAxis);
70                 label.Orientation = new Rotation(new Radian(new Degree(sliderX.CurrentValue)), Vector3.XAxis);
71             };
72             sliderY.ValueChanged += (s, e) =>
73             {
74                 btn.Orientation = new Rotation(new Radian(new Degree(sliderY.CurrentValue)), Vector3.YAxis);
75                 rect.Orientation = new Rotation(new Radian(new Degree(sliderY.CurrentValue)), Vector3.YAxis);
76                 img.Orientation = new Rotation(new Radian(new Degree(sliderY.CurrentValue)), Vector3.YAxis);
77                 label.Orientation = new Rotation(new Radian(new Degree(sliderY.CurrentValue)), Vector3.YAxis);
78             };
79             sliderZ.ValueChanged += (s, e) =>
80             {
81                 btn.Orientation = new Rotation(new Radian(new Degree(sliderZ.CurrentValue)), Vector3.ZAxis);
82                 rect.Orientation = new Rotation(new Radian(new Degree(sliderZ.CurrentValue)), Vector3.ZAxis);
83                 img.Orientation = new Rotation(new Radian(new Degree(sliderZ.CurrentValue)), Vector3.ZAxis);
84                 label.Orientation = new Rotation(new Radian(new Degree(sliderZ.CurrentValue)), Vector3.ZAxis);
85             };
86         }
87     }
88 }